linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Badari Pulavarty <pbadari@us.ibm.com>
To: ext2-devel <ext2-devel@lists.sourceforge.net>,
	linux-fsdevel@vger.kernel.org
Cc: sct@redhat.com, Andrew Morton <akpm@osdl.org>
Subject: [RFC] ext3 writepages for writeback mode
Date: 10 Feb 2005 17:31:33 -0800	[thread overview]
Message-ID: <1108085493.20053.1191.camel@dyn318077bld.beaverton.ibm.com> (raw)

[-- 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,

             reply	other threads:[~2005-02-11  1:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11  1:31 Badari Pulavarty [this message]
2005-02-11  1:53 ` [RFC] ext3 writepages for writeback mode 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

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=1108085493.20053.1191.camel@dyn318077bld.beaverton.ibm.com \
    --to=pbadari@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sct@redhat.com \
    /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).