diff options
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index abb922daf1b6..89bbde46bd83 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2421,6 +2421,7 @@ static int extent_write_cache_pages(struct extent_io_tree *tree, | |||
2421 | pgoff_t index; | 2421 | pgoff_t index; |
2422 | pgoff_t end; /* Inclusive */ | 2422 | pgoff_t end; /* Inclusive */ |
2423 | int scanned = 0; | 2423 | int scanned = 0; |
2424 | int tag; | ||
2424 | 2425 | ||
2425 | pagevec_init(&pvec, 0); | 2426 | pagevec_init(&pvec, 0); |
2426 | if (wbc->range_cyclic) { | 2427 | if (wbc->range_cyclic) { |
@@ -2431,11 +2432,16 @@ static int extent_write_cache_pages(struct extent_io_tree *tree, | |||
2431 | end = wbc->range_end >> PAGE_CACHE_SHIFT; | 2432 | end = wbc->range_end >> PAGE_CACHE_SHIFT; |
2432 | scanned = 1; | 2433 | scanned = 1; |
2433 | } | 2434 | } |
2435 | if (wbc->sync_mode == WB_SYNC_ALL) | ||
2436 | tag = PAGECACHE_TAG_TOWRITE; | ||
2437 | else | ||
2438 | tag = PAGECACHE_TAG_DIRTY; | ||
2434 | retry: | 2439 | retry: |
2440 | if (wbc->sync_mode == WB_SYNC_ALL) | ||
2441 | tag_pages_for_writeback(mapping, index, end); | ||
2435 | while (!done && !nr_to_write_done && (index <= end) && | 2442 | while (!done && !nr_to_write_done && (index <= end) && |
2436 | (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, | 2443 | (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag, |
2437 | PAGECACHE_TAG_DIRTY, min(end - index, | 2444 | min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) { |
2438 | (pgoff_t)PAGEVEC_SIZE-1) + 1))) { | ||
2439 | unsigned i; | 2445 | unsigned i; |
2440 | 2446 | ||
2441 | scanned = 1; | 2447 | scanned = 1; |