linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] ext3 writepages for writeback mode
@ 2005-02-11  1:31 Badari Pulavarty
  2005-02-11  1:53 ` Andrew Morton
  2005-02-14 16:50 ` Thiago Rondon
  0 siblings, 2 replies; 20+ messages in thread
From: Badari Pulavarty @ 2005-02-11  1:31 UTC (permalink / raw)
  To: ext2-devel, linux-fsdevel; +Cc: sct, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

Hi,

Here is my first cut at adding writepages() support for
ext3 writeback mode.

I have not done any performance analysis on the patch, 
so try it at your own risk.

Please let me know, if I am completely off or its a
stupid idea.

Thanks,
Badari



[-- Attachment #2: ext3-writeback-writepages.patch --]
[-- Type: text/plain, Size: 1559 bytes --]

--- linux-2.6.10.org/fs/ext3/inode.c	2004-12-06 11:45:49.000000000 -0800
+++ linux-2.6.10/fs/ext3/inode.c	2005-02-10 18:14:17.987263744 -0800
@@ -856,6 +856,12 @@
 	return ret;
 }
 
+static int ext3_writepages_get_block(struct inode *inode, sector_t iblock,
+			struct buffer_head *bh, int create)
+{
+	return ext3_direct_io_get_blocks(inode, iblock, 1, bh, create);
+}
+
 /*
  * `handle' can be NULL if create is zero
  */
@@ -1321,6 +1327,37 @@
 	return ret;
 }
 
+static int
+ext3_writeback_writepages(struct address_space *mapping, 
+				struct writeback_control *wbc)
+{
+	struct inode *inode = mapping->host;
+	handle_t *handle = NULL;
+	int err, ret = 0;
+
+	if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
+		return ret;
+
+	handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode));
+	if (IS_ERR(handle)) {
+		ret = PTR_ERR(handle);
+		return ret;
+	}
+
+        ret = mpage_writepages(mapping, wbc, ext3_writepages_get_block);
+
+	/*
+	 * Need to reaquire the handle since ext3_writepages_get_block()
+	 * can restart the handle
+	 */
+	handle = journal_current_handle();
+
+	err = ext3_journal_stop(handle);
+	if (!ret)
+		ret = err;
+	return ret;
+}
+
 static int ext3_writeback_writepage(struct page *page,
 				struct writeback_control *wbc)
 {
@@ -1552,6 +1589,7 @@
 	.readpage	= ext3_readpage,
 	.readpages	= ext3_readpages,
 	.writepage	= ext3_writeback_writepage,
+	.writepages	= ext3_writeback_writepages,
 	.sync_page	= block_sync_page,
 	.prepare_write	= ext3_prepare_write,
 	.commit_write	= ext3_writeback_commit_write,

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2005-02-14 20:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-11  1:31 [RFC] ext3 writepages for writeback mode Badari Pulavarty
2005-02-11  1:53 ` Andrew Morton
2005-02-11  3:06   ` Badari Pulavarty
2005-02-11 23:29   ` Badari Pulavarty
2005-02-11 23:58     ` Andrew Morton
2005-02-12  0:09       ` Badari Pulavarty
2005-02-14 20:02         ` Sonny Rao
2005-02-14 20:22           ` [Ext2-devel] " Sonny Rao
2005-02-12  0:51       ` Badari Pulavarty
2005-02-12  1:00         ` Andrew Morton
2005-02-12  1:55           ` Badari Pulavarty
2005-02-12 12:20         ` [Ext2-devel] " Alex Tomas
2005-02-12 18:47           ` Badari Pulavarty
2005-02-12 21:43             ` Alex Tomas
2005-02-12 23:26           ` Badari Pulavarty
2005-02-12 23:29             ` Alex Tomas
2005-02-14 15:58               ` Badari Pulavarty
2005-02-14 16:34                 ` Alex Tomas
2005-02-14 16:50 ` Thiago Rondon
2005-02-14 18:08   ` Badari Pulavarty

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).