linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: "Darrick J. Wong" <djwong@us.ibm.com>
Cc: Chris Mason <chris.mason@oracle.com>,
	Christoph Hellwig <hch@infradead.org>,
	Theodore Ts'o <tytso@mit.edu>, Jeff Layton <jlayton@redhat.com>,
	Jan Kara <jack@suse.cz>, Dave Chinner <david@fromorbit.com>,
	Joel Becker <jlbec@evilplan.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Mingming Cao <cmm@us.ibm.com>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	linux-mm <linux-mm@kvack.org>
Subject: Re: [PATCH v3 0/3] data integrity: Stabilize pages during writeback for ext4
Date: Thu, 5 May 2011 17:26:01 +0200	[thread overview]
Message-ID: <20110505152601.GI5323@quack.suse.cz> (raw)
In-Reply-To: <20110504235706.GJ20579@tux1.beaverton.ibm.com>

  Hello,

On Wed 04-05-11 16:57:06, Darrick J. Wong wrote:
> On Wed, May 04, 2011 at 03:21:55PM -0400, Chris Mason wrote:
> > Excerpts from Christoph Hellwig's message of 2011-05-04 14:46:44 -0400:
> > > This seems to miss out on a lot of the generic functionality like
> > > write_cache_pages and block_page_mkwrite and just patch it into
> > > the ext4 copy & paste variants.  Please make sure your patches also
> > > work for filesystem that use more of the generic functionality like
> > > xfs or ext2 (the latter one might be fun for the mmap case).
> > 
> > Probably after the block_commit_write in block_page_mkwrite()
> > Another question is, do we want to introduce a wait_on_stable_page_writeback()?
> 
> Something like this here?  It fixes block_page_mkwrite users and sticks in a
> simple page_mkwrite for fses that don't provide one at all.  From a quick wac
> run it seems to make xfs work.  ext2 seems to have some issues with modifying a
> buffer_head's bh_data without locking the bh during the update, so I guess it
> needs some review.
  Yes, ext2 is rather difficult because of all the metadata updates to
buffers happening. That would need a serious work I suspect.

> fs: Modify/provide generic writepage/page_mkwrite functions to wait for writeback
> 
> Modify the generic writepage function, and add an empty page_mkwrite function,
> to wait for page writeback to finish before allowing writes.  This is so that
> simple filesystems have stable pages during write operations.
> 
> Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
> ---
> 
>  fs/buffer.c  |    1 +
>  mm/filemap.c |   10 ++++++++++
>  2 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index a08bb8e..cf9a795 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -2361,6 +2361,7 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
>  	if (!ret)
>  		ret = block_commit_write(page, 0, end);
>  
> +	wait_on_page_writeback(page);
>  	if (unlikely(ret)) {
>  		unlock_page(page);
>  		if (ret == -ENOMEM)
> diff --git a/mm/filemap.c b/mm/filemap.c
> index c22675f..9cb4e51 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1713,8 +1713,18 @@ page_not_uptodate:
>  }
>  EXPORT_SYMBOL(filemap_fault);
>  
> +static int empty_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
> +{
> +	struct page *page = vmf->page;
> +
> +	lock_page(page);
> +	wait_on_page_writeback(page);
> +	return VM_FAULT_LOCKED;
> +}
> +
  I guess you miss the whether the page has been truncated here (in which
case you should return VM_FAULT_NOPAGE).

>  const struct vm_operations_struct generic_file_vm_ops = {
>  	.fault		= filemap_fault,
> +	.page_mkwrite	= empty_page_mkwrite,
>  };
>  
>  /* This is used for a general mmap of a disk file */

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-05-05 15:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110321164305.GC7153@quack.suse.cz>
     [not found] ` <20110406232938.GF1110@tux1.beaverton.ibm.com>
     [not found]   ` <20110407165700.GB7363@quack.suse.cz>
     [not found]     ` <20110408203135.GH1110@tux1.beaverton.ibm.com>
     [not found]       ` <20110411124229.47bc28f6@corrin.poochiereds.net>
     [not found]         ` <1302543595-sup-4352@think>
     [not found]           ` <1302569212.2580.13.camel@mingming-laptop>
     [not found]             ` <20110412005719.GA23077@infradead.org>
     [not found]               ` <1302742128.2586.274.camel@mingming-laptop>
     [not found]                 ` <20110422000226.GA22189@tux1.beaverton.ibm.com>
2011-05-04 17:37                   ` Darrick J. Wong
2011-05-04 18:46                     ` Christoph Hellwig
2011-05-04 19:21                       ` Chris Mason
2011-05-04 20:00                         ` Darrick J. Wong
2011-05-04 23:57                         ` Darrick J. Wong
2011-05-05 15:26                           ` Jan Kara [this message]
2011-05-04 17:39                   ` [PATCH v3 1/3] ext4: Clean up some wait_on_page_writeback calls Darrick J. Wong
2011-05-04 17:41                   ` [PATCH v3 2/3] ext4: Wait for writeback to complete while making pages writable Darrick J. Wong
2011-05-04 17:42                   ` [PATCH v3 3/3] mm: Wait for writeback when grabbing pages to begin a write Darrick J. Wong
2011-05-04 18:48                     ` Christoph Hellwig

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=20110505152601.GI5323@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=chris.mason@oracle.com \
    --cc=cmm@us.ibm.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=david@fromorbit.com \
    --cc=djwong@us.ibm.com \
    --cc=hch@infradead.org \
    --cc=jlayton@redhat.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tytso@mit.edu \
    /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