diff options
Diffstat (limited to 'fs/mpage.c')
-rw-r--r-- | fs/mpage.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/mpage.c b/fs/mpage.c index 9bf2eb30e6f4..1e4598247d0b 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -707,9 +707,9 @@ mpage_writepages(struct address_space *mapping, | |||
707 | struct pagevec pvec; | 707 | struct pagevec pvec; |
708 | int nr_pages; | 708 | int nr_pages; |
709 | pgoff_t index; | 709 | pgoff_t index; |
710 | pgoff_t end = -1; /* Inclusive */ | 710 | pgoff_t end; /* Inclusive */ |
711 | int scanned = 0; | 711 | int scanned = 0; |
712 | int is_range = 0; | 712 | int range_whole = 0; |
713 | 713 | ||
714 | if (wbc->nonblocking && bdi_write_congested(bdi)) { | 714 | if (wbc->nonblocking && bdi_write_congested(bdi)) { |
715 | wbc->encountered_congestion = 1; | 715 | wbc->encountered_congestion = 1; |
@@ -721,16 +721,14 @@ mpage_writepages(struct address_space *mapping, | |||
721 | writepage = mapping->a_ops->writepage; | 721 | writepage = mapping->a_ops->writepage; |
722 | 722 | ||
723 | pagevec_init(&pvec, 0); | 723 | pagevec_init(&pvec, 0); |
724 | if (wbc->sync_mode == WB_SYNC_NONE) { | 724 | if (wbc->range_cyclic) { |
725 | index = mapping->writeback_index; /* Start from prev offset */ | 725 | index = mapping->writeback_index; /* Start from prev offset */ |
726 | end = -1; | ||
726 | } else { | 727 | } else { |
727 | index = 0; /* whole-file sweep */ | 728 | index = wbc->range_start >> PAGE_CACHE_SHIFT; |
728 | scanned = 1; | 729 | end = wbc->range_end >> PAGE_CACHE_SHIFT; |
729 | } | 730 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) |
730 | if (wbc->start || wbc->end) { | 731 | range_whole = 1; |
731 | index = wbc->start >> PAGE_CACHE_SHIFT; | ||
732 | end = wbc->end >> PAGE_CACHE_SHIFT; | ||
733 | is_range = 1; | ||
734 | scanned = 1; | 732 | scanned = 1; |
735 | } | 733 | } |
736 | retry: | 734 | retry: |
@@ -759,7 +757,7 @@ retry: | |||
759 | continue; | 757 | continue; |
760 | } | 758 | } |
761 | 759 | ||
762 | if (unlikely(is_range) && page->index > end) { | 760 | if (!wbc->range_cyclic && page->index > end) { |
763 | done = 1; | 761 | done = 1; |
764 | unlock_page(page); | 762 | unlock_page(page); |
765 | continue; | 763 | continue; |
@@ -810,7 +808,7 @@ retry: | |||
810 | index = 0; | 808 | index = 0; |
811 | goto retry; | 809 | goto retry; |
812 | } | 810 | } |
813 | if (!is_range) | 811 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) |
814 | mapping->writeback_index = index; | 812 | mapping->writeback_index = index; |
815 | if (bio) | 813 | if (bio) |
816 | mpage_bio_submit(WRITE, bio); | 814 | mpage_bio_submit(WRITE, bio); |