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: Steven Whitehouse Signed-off-by: Wu Fengguang --- fs/gfs2/aops.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) --- linux.orig/fs/gfs2/aops.c 2009-10-06 23:37:48.000000000 +0800 +++ linux/fs/gfs2/aops.c 2009-10-06 23:38:41.000000000 +0800 @@ -287,7 +287,7 @@ static int gfs2_write_jdata_pagevec(stru continue; } - if (!wbc->range_cyclic && page->index > end) { + if (page->index > end) { ret = 1; unlock_page(page); continue; @@ -340,7 +340,6 @@ static int gfs2_write_cache_jdata(struct int nr_pages; pgoff_t index; pgoff_t end; - int scanned = 0; int range_whole = 0; pagevec_init(&pvec, 0); @@ -352,15 +351,12 @@ static int gfs2_write_cache_jdata(struct end = wbc->range_end >> PAGE_CACHE_SHIFT; if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) range_whole = 1; - scanned = 1; } -retry: while (!done && (index <= end) && (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, PAGECACHE_TAG_DIRTY, min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) { - scanned = 1; ret = gfs2_write_jdata_pagevec(mapping, wbc, &pvec, nr_pages, end); if (ret) done = 1; @@ -371,16 +367,8 @@ retry: cond_resched(); } - if (!scanned && !done) { - /* - * We hit the last page and there is more work to be done: wrap - * back to the start of the file - */ - scanned = 1; + if (!nr_pages) index = 0; - goto retry; - } - if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) mapping->writeback_index = index; return ret; -- 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/