From: Nick Piggin <npiggin@suse.de>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
npiggin@suse.de, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] ext3: Fix buffer dirtying in data=journal mode (fwd)
Date: Fri, 6 Aug 2010 00:19:12 +1000 [thread overview]
Message-ID: <20100805141912.GA17264@amd> (raw)
In-Reply-To: <20100804153521.GB7037@quack.suse.cz>
On Wed, Aug 04, 2010 at 05:35:22PM +0200, Jan Kara wrote:
> On Tue 03-08-10 15:58:42, Andrew Morton wrote:
> >From 40310ae771ba1d625c7917891a5d4f84f5b458ac Mon Sep 17 00:00:00 2001
> From: Jan Kara <jack@suse.cz>
> Date: Wed, 4 Aug 2010 17:10:56 +0200
> Subject: [PATCH] fs: Remove obsolete buffer handling
>
> When we freshly allocate a new block under an uptodate page, we have
> to make sure it doesn't get zeroed and gets marked dirty. Commit
> 637aff46 added a code to handle this case properly. Later, commit
> afddba49 added page_zero_new_buffers() function which takes care of
> this case properly as well and all filesystems use it either directly
> or indirectly. So let's remove the obsolete code so that we handle
> this special case only in one place.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
I don't see a problem, but it is a special case. Because the data
which is causing the buffer to be dirtied is already in the pagecache
-- not the data we're about to write in there.
But with the comment it is clear enough.
Acked-by: Nick Piggin <npiggin@suse.de>
> ---
> fs/buffer.c | 12 ++++++++++--
> 1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index d54812b..a2947c2 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -1876,9 +1876,17 @@ static int __block_prepare_write(struct inode *inode, struct page *page,
> unmap_underlying_metadata(bh->b_bdev,
> bh->b_blocknr);
> if (PageUptodate(page)) {
> - clear_buffer_new(bh);
> + /*
> + * New buffer underlying already
> + * uptodate data. This can happen when
> + * data was already written via mmap.
> + * We must not zero-out already valid
> + * data and must mark buffer dirty.
> + * page_zero_new_buffers() takes care
> + * of this (or block_commit_write() if
> + * data gets overwritten).
> + */
> set_buffer_uptodate(bh);
> - mark_buffer_dirty(bh);
> continue;
> }
> if (block_end > to || block_start < from)
> --
prev parent reply other threads:[~2010-08-05 14:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100721170854.GB1215@atrey.karlin.mff.cuni.cz>
[not found] ` <20100802145701.6952d607.akpm@linux-foundation.org>
[not found] ` <20100802230647.GM3278@quack.suse.cz>
[not found] ` <20100802161928.68e30ddc.akpm@linux-foundation.org>
[not found] ` <20100803135748.GH3322@quack.suse.cz>
[not found] ` <20100803120644.5e7247b3.akpm@linux-foundation.org>
[not found] ` <20100803223417.GL3322@quack.suse.cz>
[not found] ` <20100803155842.ce0fa9eb.akpm@linux-foundation.org>
2010-08-04 15:35 ` [PATCH 1/2] ext3: Fix buffer dirtying in data=journal mode (fwd) Jan Kara
2010-08-05 14:19 ` Nick Piggin [this message]
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=20100805141912.GA17264@amd \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox