From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH] add -o flush for fat Date: Fri, 4 Aug 2006 18:31:49 -0700 Message-ID: <20060804183149.954b0e59.akpm@osdl.org> References: <20060804192721.GF1048@watt.suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from smtp.osdl.org ([65.172.181.4]:13769 "EHLO smtp.osdl.org") by vger.kernel.org with ESMTP id S1161501AbWHEBby (ORCPT ); Fri, 4 Aug 2006 21:31:54 -0400 To: Chris Mason In-Reply-To: <20060804192721.GF1048@watt.suse.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Fri, 4 Aug 2006 15:27:21 -0400 Chris Mason wrote: > /* > + * starts IO on any dirty blocks in the block device. This uses > + * filemap_flush, and so it does not wait for the io to finish, and does > + * not wait on any IO currently in flight. > + */ > +void writeback_bdev(struct super_block *sb) > +{ > + struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; > + filemap_flush(mapping); > +} > +EXPORT_SYMBOL_GPL(writeback_bdev); > + > +/* > + * start writeback on both the inode and the data blocks. > + * filemap_fdatawrite is used, so it waits for any IO that was in > + * flight for dirty blocks at the start of this call. This will not > + * wait for any IO it starts. > + */ > +void writeback_inode(struct inode *inode) > +{ > + > + struct address_space *mapping = inode->i_mapping; > + struct writeback_control wbc = { > + .sync_mode = WB_SYNC_NONE, > + .nr_to_write = 0, > + }; > + /* if we used WB_SYNC_ALL, sync_inode waits for the io for the > + * inode to finish. So WB_SYNC_NONE is sent down to sync_inode > + * and filemap_fdatawrite is used for the data blocks > + */ > + sync_inode(inode, &wbc); > + filemap_fdatawrite(mapping); > +} > +EXPORT_SYMBOL_GPL(writeback_inode); Could we have more detail on what you're trying to do here? You've obviously made some decisions about how to handle under-writeback data, dirty data, integrity versus cleaning, etc. What were those decisions and what led you to them? We should document the precise semantics of these two functions, especially wrt data integrity, handling of dirty-but-under-writeback pages, etc. (Right now I'm not sure what those semantics are). I'm also wondering what sync_inode(nr_to_write=0) does ;) I think it writes one page...