public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Holden Karau <holdenk@xandros.com>
Cc: Josef Sipek <jsipek@fsl.cs.sunysb.edu>,
	hirofumi@mail.parknet.co.jp, linux-kernel@vger.kernel.org,
	"akpm@osdl.org" <akpm@osdl.org>,
	linux-fsdevel@vger.kernel.org, holden@pigscanfly.ca,
	holden.karau@gmail.com, Nick Piggin <nickpiggin@yahoo.com.au>,
	J?rn Engel <joern@wohnheim.fh-wedel.de>
Subject: Re: [PATCH 1/1] fat: improve sync performance by grouping writes revised
Date: Tue, 31 Oct 2006 09:28:25 -0700	[thread overview]
Message-ID: <20061031162825.GD26964@parisc-linux.org> (raw)
In-Reply-To: <454765AC.1050905@xandros.com>

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().

  reply	other threads:[~2006-10-31 16:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-31 15:03 [PATCH 1/1] fat: improve sync performance by grouping writes revised Holden Karau
2006-10-31 16:28 ` Matthew Wilcox [this message]
2006-10-31 16:46   ` Holden Karau
2006-11-01  3:10     ` Holden Karau
2006-11-01 13:50       ` Matthew Wilcox
2006-10-31 16:30 ` Jörn Engel
2006-10-31 18:10   ` Holden Karau
2006-10-31 16:54 ` OGAWA Hirofumi
2006-10-31 18:46   ` Holden Karau
2006-10-31 20:23     ` OGAWA Hirofumi
2006-10-31 20:54       ` Holden Karau
2006-11-01  0:58         ` OGAWA Hirofumi
2006-11-01  2:33           ` Holden Karau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061031162825.GD26964@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=akpm@osdl.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=holden.karau@gmail.com \
    --cc=holden@pigscanfly.ca \
    --cc=holdenk@xandros.com \
    --cc=joern@wohnheim.fh-wedel.de \
    --cc=jsipek@fsl.cs.sunysb.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox