All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Cong Ding <dinggnu@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs:ext3: remove lock_buffer in bclean() and setup_new_group_blocks
Date: Wed, 5 Dec 2012 15:41:07 +0100	[thread overview]
Message-ID: <20121205144107.GE5706@quack.suse.cz> (raw)
In-Reply-To: <1354412428-8938-1-git-send-email-dinggnu@gmail.com>

On Sun 02-12-12 01:40:28, Cong Ding wrote:
> it's not necessary to lock the buffers because no one touches them
> beyond the file system.
  Although I agree those locks are not strictly necessary, I prefer to keep
them because the general rula is buffer contents should be changed under
buffer lock unless we have a good reason to do otherwise. And here the cost
of additional lock is really marginal...

								Honza

> 
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
>  fs/ext3/resize.c |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
> index 0f814f3..f76fcd6 100644
> --- a/fs/ext3/resize.c
> +++ b/fs/ext3/resize.c
> @@ -122,10 +122,8 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
>  		brelse(bh);
>  		bh = ERR_PTR(err);
>  	} else {
> -		lock_buffer(bh);
>  		memset(bh->b_data, 0, sb->s_blocksize);
>  		set_buffer_uptodate(bh);
> -		unlock_buffer(bh);
>  	}
>  
>  	return bh;
> @@ -242,10 +240,8 @@ static int setup_new_group_blocks(struct super_block *sb,
>  			brelse(gdb);
>  			goto exit_bh;
>  		}
> -		lock_buffer(gdb);
>  		memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, gdb->b_size);
>  		set_buffer_uptodate(gdb);
> -		unlock_buffer(gdb);
>  		err = ext3_journal_dirty_metadata(handle, gdb);
>  		if (err) {
>  			brelse(gdb);
> -- 
> 1.7.4.5
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2012-12-05 14:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-02  1:40 [PATCH] fs:ext3: remove lock_buffer in bclean() and setup_new_group_blocks Cong Ding
2012-12-05 14:41 ` Jan Kara [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-12-02 15:36 Toralf Förster

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=20121205144107.GE5706@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=akpm@linux-foundation.org \
    --cc=dinggnu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.