aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2008-10-14 09:20:19 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-14 09:20:19 -0400
commitaf6f029d3836eb7264cd3fbb13a6baf0e5fdb5ea (patch)
treeb7c1334ad5fab10eaf4962c79ad6025d334b902c /fs/ext4
parent8a0aba733db1adb5e1f0e828889a18f4c1c512de (diff)
ext4: Use tag dirty lookup during mpage_da_submit_io
This enables us to drop the range_cont writeback mode use from ext4_da_writepages. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9b4ec9decfd1..4ee3f0692eeb 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1656,17 +1656,23 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd)
1656 1656
1657 while (index <= end) { 1657 while (index <= end) {
1658 /* XXX: optimize tail */ 1658 /* XXX: optimize tail */
1659 nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE); 1659 /*
1660 * We can use PAGECACHE_TAG_DIRTY lookup here because
1661 * even though we have cleared the dirty flag on the page
1662 * We still keep the page in the radix tree with tag
1663 * PAGECACHE_TAG_DIRTY. See clear_page_dirty_for_io.
1664 * The PAGECACHE_TAG_DIRTY is cleared in set_page_writeback
1665 * which is called via the below writepage callback.
1666 */
1667 nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
1668 PAGECACHE_TAG_DIRTY,
1669 min(end - index,
1670 (pgoff_t)PAGEVEC_SIZE-1) + 1);
1660 if (nr_pages == 0) 1671 if (nr_pages == 0)
1661 break; 1672 break;
1662 for (i = 0; i < nr_pages; i++) { 1673 for (i = 0; i < nr_pages; i++) {
1663 struct page *page = pvec.pages[i]; 1674 struct page *page = pvec.pages[i];
1664 1675
1665 index = page->index;
1666 if (index > end)
1667 break;
1668 index++;
1669
1670 err = mapping->a_ops->writepage(page, mpd->wbc); 1676 err = mapping->a_ops->writepage(page, mpd->wbc);
1671 if (!err) 1677 if (!err)
1672 mpd->pages_written++; 1678 mpd->pages_written++;
@@ -2361,7 +2367,6 @@ static int ext4_da_writepages(struct address_space *mapping,
2361 struct writeback_control *wbc) 2367 struct writeback_control *wbc)
2362{ 2368{
2363 handle_t *handle = NULL; 2369 handle_t *handle = NULL;
2364 loff_t range_start = 0;
2365 struct mpage_da_data mpd; 2370 struct mpage_da_data mpd;
2366 struct inode *inode = mapping->host; 2371 struct inode *inode = mapping->host;
2367 int needed_blocks, ret = 0, nr_to_writebump = 0; 2372 int needed_blocks, ret = 0, nr_to_writebump = 0;
@@ -2386,14 +2391,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2386 wbc->nr_to_write = sbi->s_mb_stream_request; 2391 wbc->nr_to_write = sbi->s_mb_stream_request;
2387 } 2392 }
2388 2393
2389 if (!wbc->range_cyclic)
2390 /*
2391 * If range_cyclic is not set force range_cont
2392 * and save the old writeback_index
2393 */
2394 wbc->range_cont = 1;
2395 2394
2396 range_start = wbc->range_start;
2397 pages_skipped = wbc->pages_skipped; 2395 pages_skipped = wbc->pages_skipped;
2398 2396
2399 mpd.wbc = wbc; 2397 mpd.wbc = wbc;
@@ -2452,9 +2450,8 @@ restart_loop:
2452 wbc->nr_to_write = to_write; 2450 wbc->nr_to_write = to_write;
2453 } 2451 }
2454 2452
2455 if (wbc->range_cont && (pages_skipped != wbc->pages_skipped)) { 2453 if (!wbc->range_cyclic && (pages_skipped != wbc->pages_skipped)) {
2456 /* We skipped pages in this loop */ 2454 /* We skipped pages in this loop */
2457 wbc->range_start = range_start;
2458 wbc->nr_to_write = to_write + 2455 wbc->nr_to_write = to_write +
2459 wbc->pages_skipped - pages_skipped; 2456 wbc->pages_skipped - pages_skipped;
2460 wbc->pages_skipped = pages_skipped; 2457 wbc->pages_skipped = pages_skipped;
@@ -2463,7 +2460,6 @@ restart_loop:
2463 2460
2464out_writepages: 2461out_writepages:
2465 wbc->nr_to_write = to_write - nr_to_writebump; 2462 wbc->nr_to_write = to_write - nr_to_writebump;
2466 wbc->range_start = range_start;
2467 return ret; 2463 return ret;
2468} 2464}
2469 2465