Convert wbc.range_cyclic to new behavior: when past EOF, abort writeback of the inode, which instructs writeback_single_inode() to delay it for a while if necessary. It removes one inefficient .range_cyclic IO pattern when writeback_index wraps: submit [10000-10100], (wrap), submit [0-100] In which the submitted pages may be consisted of two distant ranges. It also prevents submitting pointless IO for busy overwriters. CC: Theodore Ts'o <tytso@xxxxxxx> Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx> --- fs/ext4/inode.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) --- linux.orig/fs/ext4/inode.c 2009-10-06 23:37:48.000000000 +0800 +++ linux/fs/ext4/inode.c 2009-10-06 23:38:35.000000000 +0800 @@ -2805,7 +2805,7 @@ static int ext4_da_writepages(struct add int pages_written = 0; long pages_skipped; unsigned int max_pages; - int range_cyclic, cycled = 1, io_done = 0; + int range_cyclic, io_done = 0; int needed_blocks, ret = 0; long desired_nr_to_write, nr_to_writebump = 0; loff_t range_start = wbc->range_start; @@ -2840,8 +2840,6 @@ static int ext4_da_writepages(struct add range_cyclic = wbc->range_cyclic; if (wbc->range_cyclic) { index = mapping->writeback_index; - if (index) - cycled = 0; wbc->range_start = index << PAGE_CACHE_SHIFT; wbc->range_end = LLONG_MAX; wbc->range_cyclic = 0; @@ -2889,7 +2887,6 @@ static int ext4_da_writepages(struct add wbc->no_nrwrite_index_update = 1; pages_skipped = wbc->pages_skipped; -retry: while (!ret && wbc->nr_to_write > 0) { /* @@ -2963,20 +2960,13 @@ retry: wbc->pages_skipped = pages_skipped; ret = 0; io_done = 1; - } else if (wbc->nr_to_write) + } else if (wbc->nr_to_write > 0) { /* * There is no more writeout needed - * or we requested for a noblocking writeout - * and we found the device congested */ + index = 0; break; - } - if (!io_done && !cycled) { - cycled = 1; - index = 0; - wbc->range_start = index << PAGE_CACHE_SHIFT; - wbc->range_end = mapping->writeback_index - 1; - goto retry; + } } if (pages_skipped != wbc->pages_skipped) ext4_msg(inode->i_sb, KERN_CRIT, -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html