aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index b289310e2c89..54f28bd493d3 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -597,7 +597,7 @@ static void balance_dirty_pages(struct address_space *mapping,
597 (!laptop_mode && ((global_page_state(NR_FILE_DIRTY) 597 (!laptop_mode && ((global_page_state(NR_FILE_DIRTY)
598 + global_page_state(NR_UNSTABLE_NFS)) 598 + global_page_state(NR_UNSTABLE_NFS))
599 > background_thresh))) 599 > background_thresh)))
600 bdi_start_writeback(bdi, NULL, 0, 0); 600 bdi_start_background_writeback(bdi);
601} 601}
602 602
603void set_page_dirty_balance(struct page *page, int page_mkwrite) 603void set_page_dirty_balance(struct page *page, int page_mkwrite)
@@ -705,9 +705,8 @@ void laptop_mode_timer_fn(unsigned long data)
705 * We want to write everything out, not just down to the dirty 705 * We want to write everything out, not just down to the dirty
706 * threshold 706 * threshold
707 */ 707 */
708
709 if (bdi_has_dirty_io(&q->backing_dev_info)) 708 if (bdi_has_dirty_io(&q->backing_dev_info))
710 bdi_start_writeback(&q->backing_dev_info, NULL, nr_pages, 0); 709 bdi_start_writeback(&q->backing_dev_info, nr_pages);
711} 710}
712 711
713/* 712/*
@@ -835,7 +834,6 @@ int write_cache_pages(struct address_space *mapping,
835 pgoff_t done_index; 834 pgoff_t done_index;
836 int cycled; 835 int cycled;
837 int range_whole = 0; 836 int range_whole = 0;
838 long nr_to_write = wbc->nr_to_write;
839 837
840 pagevec_init(&pvec, 0); 838 pagevec_init(&pvec, 0);
841 if (wbc->range_cyclic) { 839 if (wbc->range_cyclic) {
@@ -852,7 +850,22 @@ int write_cache_pages(struct address_space *mapping,
852 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) 850 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
853 range_whole = 1; 851 range_whole = 1;
854 cycled = 1; /* ignore range_cyclic tests */ 852 cycled = 1; /* ignore range_cyclic tests */
853
854 /*
855 * If this is a data integrity sync, cap the writeback to the
856 * current end of file. Any extension to the file that occurs
857 * after this is a new write and we don't need to write those
858 * pages out to fulfil our data integrity requirements. If we
859 * try to write them out, we can get stuck in this scan until
860 * the concurrent writer stops adding dirty pages and extending
861 * EOF.
862 */
863 if (wbc->sync_mode == WB_SYNC_ALL &&
864 wbc->range_end == LLONG_MAX) {
865 end = i_size_read(mapping->host) >> PAGE_CACHE_SHIFT;
866 }
855 } 867 }
868
856retry: 869retry:
857 done_index = index; 870 done_index = index;
858 while (!done && (index <= end)) { 871 while (!done && (index <= end)) {
@@ -935,11 +948,10 @@ continue_unlock:
935 done = 1; 948 done = 1;
936 break; 949 break;
937 } 950 }
938 } 951 }
939 952
940 if (nr_to_write > 0) { 953 if (wbc->nr_to_write > 0) {
941 nr_to_write--; 954 if (--wbc->nr_to_write == 0 &&
942 if (nr_to_write == 0 &&
943 wbc->sync_mode == WB_SYNC_NONE) { 955 wbc->sync_mode == WB_SYNC_NONE) {
944 /* 956 /*
945 * We stop writing back only if we are 957 * We stop writing back only if we are
@@ -970,11 +982,8 @@ continue_unlock:
970 end = writeback_index - 1; 982 end = writeback_index - 1;
971 goto retry; 983 goto retry;
972 } 984 }
973 if (!wbc->no_nrwrite_index_update) { 985 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
974 if (wbc->range_cyclic || (range_whole && nr_to_write > 0)) 986 mapping->writeback_index = done_index;
975 mapping->writeback_index = done_index;
976 wbc->nr_to_write = nr_to_write;
977 }
978 987
979 return ret; 988 return ret;
980} 989}