linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: NeilBrown <neilb@suse.de>, Jan Kara <jack@suse.cz>,
	axboe@kernel.dk, lucho@ionkov.net, ericvh@gmail.com,
	tytso@mit.edu, rminnich@sandia.gov, viro@zeniv.linux.org.uk,
	martin.petersen@oracle.com, david@fromorbit.com,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	adilger.kernel@dilger.ca, bharrosh@panasas.com,
	jlayton@samba.org, v9fs-developer@lists.sourceforge.net,
	linux-ext4@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] jbd: Stabilize pages during writes when in ordered mode
Date: Thu, 22 Nov 2012 10:19:31 +0100	[thread overview]
Message-ID: <20121122091931.GB11154@quack.suse.cz> (raw)
In-Reply-To: <20121122023645.GB32182@blackbox.djwong.org>

On Wed 21-11-12 18:36:45, Darrick J. Wong wrote:
> When writing buffers out to disk ahead of committing a transaction, set the
> Stable bit on the page to prevent others from wandering in and modifying the
> page.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/jbd/commit.c |   18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
> index 86b39b1..b1f0eed 100644
> --- a/fs/jbd/commit.c
> +++ b/fs/jbd/commit.c
> @@ -155,13 +155,29 @@ static int journal_write_commit_record(journal_t *journal,
>  	return (ret == -EIO);
>  }
>  
> +static void end_stable_write_sync(struct buffer_head *bh, int uptodate)
> +{
> +	clear_page_stable(bh->b_page);
> +	end_buffer_write_sync(bh, uptodate);
> +}
  This doesn't work when blocksize < pagesize... There can be more buffers
in one page under IO so you can clear the stable bit only after the last of
them is done. See how PageWriteback bit is handled in
end_buffer_async_write().

> +
>  static void journal_do_submit_data(struct buffer_head **wbuf, int bufs,
>  				   int write_op)
>  {
>  	int i;
>  
>  	for (i = 0; i < bufs; i++) {
> -		wbuf[i]->b_end_io = end_buffer_write_sync;
> +		struct page *p = wbuf[i]->b_page;
> +		if (TestSetPageStable(p))
> +			wbuf[i]->b_end_io = end_buffer_write_sync;
> +		else
> +			wbuf[i]->b_end_io = end_stable_write_sync;
  Umm, why is this? It presume it is some attempt to handle blocksize <
page size?

> +
> +		if (trylock_page(p)) {
> +			clear_page_dirty_for_io(p);
> +			unlock_page(p);
> +		}
> +
  And this is wrong again for blocksize < pagesize. There can be other
dirty buffers under the page...

>  		/* We use-up our safety reference in submit_bh() */
>  		submit_bh(write_op, wbuf[i]);
>  	}

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2012-11-22 20:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21  2:00 [PATCH v2.1 0/3] mm/fs: Implement faster stable page writes on filesystems Darrick J. Wong
2012-11-21  2:00 ` [PATCH 1/4] bdi: Track users that require stable page writes Darrick J. Wong
2012-11-21  7:54   ` Christoph Hellwig
2012-11-21 10:52     ` Christoph Hellwig
2012-11-21 10:56   ` Christoph Hellwig
2012-11-21 21:52     ` Darrick J. Wong
2012-11-21 22:06       ` NeilBrown
2012-11-22  2:33         ` [PATCH] " Darrick J. Wong
2012-11-22  7:08           ` Christoph Hellwig
2012-11-21  2:00 ` [PATCH 2/4] mm: Only enforce stable page writes if the backing device requires it Darrick J. Wong
2012-11-21 10:57   ` Christoph Hellwig
2012-11-21  2:00 ` [PATCH 3/4] 9pfs: Fix filesystem to wait for stable page writeback Darrick J. Wong
2012-11-21  2:00 ` [PATCH 4/4] ext3: Warn if mounting rw on a disk requiring stable page writes Darrick J. Wong
2012-11-21  2:15   ` Jan Kara
2012-11-21 21:13     ` Darrick J. Wong
2012-11-21 21:33       ` Jan Kara
2012-11-21 21:47         ` NeilBrown
2012-11-22  1:47           ` Darrick J. Wong
2012-11-22  2:36             ` [RFC PATCH 1/2] mm: Introduce page flag to indicate stable page status Darrick J. Wong
2012-11-22  2:36             ` [RFC PATCH 2/2] jbd: Stabilize pages during writes when in ordered mode Darrick J. Wong
2012-11-22  9:19               ` Jan Kara [this message]
2012-11-22  9:12             ` [PATCH 4/4] ext3: Warn if mounting rw on a disk requiring stable page writes Jan Kara
2012-11-27  2:17               ` Darrick J. Wong
2012-12-05 12:12                 ` Jan Kara
2012-12-08  1:09                   ` Darrick J. Wong
2012-12-10 10:41                     ` Jan Kara
2012-11-22 23:15             ` Dave Chinner

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=20121122091931.GB11154@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=bharrosh@panasas.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=ericvh@gmail.com \
    --cc=jlayton@samba.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=martin.petersen@oracle.com \
    --cc=neilb@suse.de \
    --cc=rminnich@sandia.gov \
    --cc=tytso@mit.edu \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).