From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH 14/45] writeback: quit on wrap for .range_cyclic (afs) Date: Wed, 07 Oct 2009 15:38:32 +0800 Message-ID: <20091007074902.913463607@intel.com> References: <20091007073818.318088777@intel.com> Cc: Theodore Tso , Christoph Hellwig , Dave Chinner , Chris Mason , Peter Zijlstra , "Li Shaohua" , "Myklebust Trond" , "jens.axboe@oracle.com" , Jan Kara , Nick Piggin , , David Howells , Wu Fengguang To: Andrew Morton Return-path: Received: from mga03.intel.com ([143.182.124.21]:28327 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933684AbZJGIBP (ORCPT ); Wed, 7 Oct 2009 04:01:15 -0400 Cc: LKML Content-Disposition: inline; filename=linux_fs_afs_write.c Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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: David Howells Signed-off-by: Wu Fengguang --- fs/afs/write.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- linux.orig/fs/afs/write.c 2009-10-06 23:37:48.000000000 +0800 +++ linux/fs/afs/write.c 2009-10-06 23:38:42.000000000 +0800 @@ -477,8 +477,10 @@ static int afs_writepages_region(struct do { n = find_get_pages_tag(mapping, &index, PAGECACHE_TAG_DIRTY, 1, &page); - if (!n) + if (!n) { + index = 0; break; + } _debug("wback %lx", page->index); @@ -551,9 +553,6 @@ int afs_writepages(struct address_space start = mapping->writeback_index; end = -1; ret = afs_writepages_region(mapping, wbc, start, end, &next); - if (start > 0 && wbc->nr_to_write > 0 && ret == 0) - ret = afs_writepages_region(mapping, wbc, 0, start, - &next); mapping->writeback_index = next; } else if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) { end = (pgoff_t)(LLONG_MAX >> PAGE_CACHE_SHIFT);