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 CC: Theodore Ts'o CC: Dave Chinner CC: Jens Axboe CC: Chris Mason CC: Christoph Hellwig Signed-off-by: Wu Fengguang --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/