From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH 1/2] make sure data is on disk before calling ->write_inode Date: Wed, 13 Jan 2010 16:21:54 -0800 Message-ID: <20100113162154.f7e7af49.akpm@linux-foundation.org> References: <20100111173047.GA6852@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Trond.Myklebust@netapp.com, dhowells@redhat.com To: Christoph Hellwig Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:49882 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755503Ab0ANAWx (ORCPT ); Wed, 13 Jan 2010 19:22:53 -0500 In-Reply-To: <20100111173047.GA6852@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, 11 Jan 2010 18:30:47 +0100 Christoph Hellwig wrote: > --- linux-2.6.orig/fs/fs-writeback.c 2010-01-11 15:53:15.462272627 +0100 > +++ linux-2.6/fs/fs-writeback.c 2010-01-11 15:54:09.662006283 +0100 > @@ -461,15 +461,20 @@ writeback_single_inode(struct inode *ino > > ret = do_writepages(mapping, wbc); > > - /* Don't write the inode if only I_DIRTY_PAGES was set */ > - if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { > - int err = write_inode(inode, wait); > + /* > + * Make sure to wait on the data before writing out the metadata. > + * This is important for filesystems that modify metadata on data > + * I/O completion. > + */ > + if (wait) { > + int err = filemap_fdatawait(mapping); > if (ret == 0) > ret = err; > } > > - if (wait) { > - int err = filemap_fdatawait(mapping); > + /* Don't write the inode if only I_DIRTY_PAGES was set */ > + if (dirty & (I_DIRTY_SYNC | I_DIRTY_DATASYNC)) { > + int err = write_inode(inode, wait); > if (ret == 0) > ret = err; > } hm, yeah, it's hard to see how this reordering can harm throughput much. nfs_write_inode() has vanished in linux-enxt so I just dropped all the nfs parts of these two patches. You might want to check that.