diff options
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r-- | mm/page-writeback.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 24de8b65fdbd..2970e35fd03f 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Contains functions related to writing back dirty pages at the | 7 | * Contains functions related to writing back dirty pages at the |
8 | * address_space level. | 8 | * address_space level. |
9 | * | 9 | * |
10 | * 10Apr2002 akpm@zip.com.au | 10 | * 10Apr2002 Andrew Morton |
11 | * Initial version | 11 | * Initial version |
12 | */ | 12 | */ |
13 | 13 | ||
@@ -329,9 +329,7 @@ static unsigned long highmem_dirtyable_memory(unsigned long total) | |||
329 | struct zone *z = | 329 | struct zone *z = |
330 | &NODE_DATA(node)->node_zones[ZONE_HIGHMEM]; | 330 | &NODE_DATA(node)->node_zones[ZONE_HIGHMEM]; |
331 | 331 | ||
332 | x += zone_page_state(z, NR_FREE_PAGES) | 332 | x += zone_page_state(z, NR_FREE_PAGES) + zone_lru_pages(z); |
333 | + zone_page_state(z, NR_INACTIVE) | ||
334 | + zone_page_state(z, NR_ACTIVE); | ||
335 | } | 333 | } |
336 | /* | 334 | /* |
337 | * Make sure that the number of highmem pages is never larger | 335 | * Make sure that the number of highmem pages is never larger |
@@ -355,9 +353,7 @@ unsigned long determine_dirtyable_memory(void) | |||
355 | { | 353 | { |
356 | unsigned long x; | 354 | unsigned long x; |
357 | 355 | ||
358 | x = global_page_state(NR_FREE_PAGES) | 356 | x = global_page_state(NR_FREE_PAGES) + global_lru_pages(); |
359 | + global_page_state(NR_INACTIVE) | ||
360 | + global_page_state(NR_ACTIVE); | ||
361 | 357 | ||
362 | if (!vm_highmem_is_dirtyable) | 358 | if (!vm_highmem_is_dirtyable) |
363 | x -= highmem_dirtyable_memory(x); | 359 | x -= highmem_dirtyable_memory(x); |
@@ -876,6 +872,7 @@ int write_cache_pages(struct address_space *mapping, | |||
876 | pgoff_t end; /* Inclusive */ | 872 | pgoff_t end; /* Inclusive */ |
877 | int scanned = 0; | 873 | int scanned = 0; |
878 | int range_whole = 0; | 874 | int range_whole = 0; |
875 | long nr_to_write = wbc->nr_to_write; | ||
879 | 876 | ||
880 | if (wbc->nonblocking && bdi_write_congested(bdi)) { | 877 | if (wbc->nonblocking && bdi_write_congested(bdi)) { |
881 | wbc->encountered_congestion = 1; | 878 | wbc->encountered_congestion = 1; |
@@ -939,7 +936,7 @@ retry: | |||
939 | unlock_page(page); | 936 | unlock_page(page); |
940 | ret = 0; | 937 | ret = 0; |
941 | } | 938 | } |
942 | if (ret || (--(wbc->nr_to_write) <= 0)) | 939 | if (ret || (--nr_to_write <= 0)) |
943 | done = 1; | 940 | done = 1; |
944 | if (wbc->nonblocking && bdi_write_congested(bdi)) { | 941 | if (wbc->nonblocking && bdi_write_congested(bdi)) { |
945 | wbc->encountered_congestion = 1; | 942 | wbc->encountered_congestion = 1; |
@@ -958,11 +955,12 @@ retry: | |||
958 | index = 0; | 955 | index = 0; |
959 | goto retry; | 956 | goto retry; |
960 | } | 957 | } |
961 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) | 958 | if (!wbc->no_nrwrite_index_update) { |
962 | mapping->writeback_index = index; | 959 | if (wbc->range_cyclic || (range_whole && nr_to_write > 0)) |
960 | mapping->writeback_index = index; | ||
961 | wbc->nr_to_write = nr_to_write; | ||
962 | } | ||
963 | 963 | ||
964 | if (wbc->range_cont) | ||
965 | wbc->range_start = index << PAGE_CACHE_SHIFT; | ||
966 | return ret; | 964 | return ret; |
967 | } | 965 | } |
968 | EXPORT_SYMBOL(write_cache_pages); | 966 | EXPORT_SYMBOL(write_cache_pages); |