[PATCH 6/6] writeback: redirty a fully scanned inode

From: Wu Fengguang
Date: Wed Sep 23 2009 - 08:43:55 EST


Redirty inode when its writeback_index wrapped around.
This is mainly to avoid unnecessary IOs for fast dirtier
that do lots of overwrites.

CC: Jan Kara <jack@xxxxxxx>
CC: Theodore Ts'o <tytso@xxxxxxx>
CC: Dave Chinner <david@xxxxxxxxxxxxx>
CC: Jens Axboe <jens.axboe@xxxxxxxxxx>
CC: Chris Mason <chris.mason@xxxxxxxxxx>
CC: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
fs/fs-writeback.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

--- linux.orig/fs/fs-writeback.c 2009-09-23 18:44:56.000000000 +0800
+++ linux/fs/fs-writeback.c 2009-09-23 18:52:22.000000000 +0800
@@ -397,6 +397,7 @@ writeback_single_inode(struct inode *ino
{
struct address_space *mapping = inode->i_mapping;
int wait = wbc->sync_mode == WB_SYNC_ALL;
+ pgoff_t start_index;
unsigned dirty;
int ret;

@@ -434,6 +435,7 @@ writeback_single_inode(struct inode *ino

spin_unlock(&inode_lock);

+ start_index = mapping->writeback_index;
ret = do_writepages(mapping, wbc);

/* Don't write the inode if only I_DIRTY_PAGES was set */
@@ -485,7 +487,9 @@ writeback_single_inode(struct inode *ino
* soon as the queue becomes uncongested.
*/
inode->i_state |= I_DIRTY_PAGES;
- if (wbc->nr_to_write <= 0) {
+select_queue:
+ if (wbc->nr_to_write <= 0 &&
+ start_index < mapping->writeback_index) {
/*
* slice used up: queue for next turn
*/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/