* [PATCH] fs:ext3: remove lock_buffer in bclean() and setup_new_group_blocks
@ 2012-12-02 1:40 Cong Ding
2012-12-05 14:41 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Cong Ding @ 2012-12-02 1:40 UTC (permalink / raw)
To: Jan Kara, Andrew Morton, Andreas Dilger, linux-ext4, linux-kernel
Cc: Cong Ding
it's not necessary to lock the buffers because no one touches them
beyond the file system.
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs:ext3: remove lock_buffer in bclean() and setup_new_group_blocks
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
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2012-12-05 14:41 UTC (permalink / raw)
To: Cong Ding
Cc: Jan Kara, Andrew Morton, Andreas Dilger, linux-ext4, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs:ext3: remove lock_buffer in bclean() and setup_new_group_blocks
@ 2012-12-02 15:36 Toralf Förster
0 siblings, 0 replies; 3+ messages in thread
From: Toralf Förster @ 2012-12-02 15:36 UTC (permalink / raw)
To: Cong Ding, linux-ext4
Your patch might call memcpy up to 3x more often than the current code
or ? If yes then to avoid this the current code might be desigend for ?
--
MfG/Sincerely
Toralf Förster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-05 14:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2012-12-02 15:36 Toralf Förster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).