lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 31 Oct 2006 09:28:25 -0700
From:	Matthew Wilcox <matthew@....cx>
To:	Holden Karau <holdenk@...dros.com>
Cc:	Josef Sipek <jsipek@....cs.sunysb.edu>,
	hirofumi@...l.parknet.co.jp, linux-kernel@...r.kernel.org,
	"akpm@...l.org" <akpm@...l.org>, linux-fsdevel@...r.kernel.org,
	holden@...scanfly.ca, holden.karau@...il.com,
	Nick Piggin <nickpiggin@...oo.com.au>,
	J?rn Engel <joern@...nheim.fh-wedel.de>
Subject: Re: [PATCH 1/1] fat: improve sync performance by grouping writes revised

On Tue, Oct 31, 2006 at 10:03:08AM -0500, Holden Karau wrote:
> @@ -343,52 +344,65 @@ int fat_ent_read(struct inode *inode, st
>  	return ops->ent_get(fatent);
>  }
>  
> -/* FIXME: We can write the blocks as more big chunk. */
> -static int fat_mirror_bhs(struct super_block *sb, struct buffer_head **bhs,
> -			  int nr_bhs)
> +
> +static int fat_mirror_bhs_optw(struct super_block *sb, struct buffer_head **bhs,
> +			       int nr_bhs , int wait)
>  {
>  	struct msdos_sb_info *sbi = MSDOS_SB(sb);
> -	struct buffer_head *c_bh;
> +	struct buffer_head *c_bh[nr_bhs*(sbi->fats)];
>  	int err, n, copy;
>  
> +	/* Always wait if mounted -o sync */
> +	if (sb->s_flags & MS_SYNCHRONOUS ) 
> +		wait = 1;
>  	err = 0;
>  	for (copy = 1; copy < sbi->fats; copy++) {
>  		sector_t backup_fat = sbi->fat_length * copy;
> -
> -		for (n = 0; n < nr_bhs; n++) {
> -			c_bh = sb_getblk(sb, backup_fat + bhs[n]->b_blocknr);
> -			if (!c_bh) {
> +		for (n = 0 ; n < nr_bhs ;  n++ ) {
> +			c_bh[(copy-1)*nr_bhs+n] = sb_getblk(sb, backup_fat + bhs[n]->b_blocknr);
> +			if (!c_bh[(copy-1)*nr_bhs+n]) {
> +				printk(KERN_CRIT "fat: out of memory while copying backup fat. possible data loss\n");

I don't like that at all.

>  				err = -ENOMEM;
>  				goto error;
>  			}
> -			memcpy(c_bh->b_data, bhs[n]->b_data, sb->s_blocksize);
> -			set_buffer_uptodate(c_bh);
> -			mark_buffer_dirty(c_bh);
> -			if (sb->s_flags & MS_SYNCHRONOUS)
> -				err = sync_dirty_buffer(c_bh);
> -			brelse(c_bh);
> -			if (err)
> -				goto error;
> +		memcpy(c_bh[(copy-1)*nr_bhs+n]->b_data, bhs[n]->b_data, sb->s_blocksize);
> +		set_buffer_uptodate(c_bh[(copy-1)*nr_bhs+n]);
> +		mark_buffer_dirty(c_bh[(copy-1)*nr_bhs+n]);
>  		}
>  	}
> +
> +	if (wait) {
> +		for (n = 0 ; n < nr_bhs ; n++) {
> +			printk("copying to %d to  %d\n" ,n,  nr_bhs*(sbi->fats-1)+n);

Is this the right version of the patch?  The printk should never be left in.
Plus, as far as I can tell, that whole loop is actually just memcpy().
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ