]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - mm/page-writeback.c
Merge branches 'topic/asoc', 'topic/misc-fixes' and 'topic/hda' into for-linus
[linux-2.6-omap-h63xx.git] / mm / page-writeback.c
index 24de8b65fdbd1f3cd26fafe888277401125c7bc9..b40f6d5f8fe9bc24750fb829742ef655f0f4c42c 100644 (file)
@@ -7,7 +7,7 @@
  * Contains functions related to writing back dirty pages at the
  * address_space level.
  *
- * 10Apr2002   akpm@zip.com.au
+ * 10Apr2002   Andrew Morton
  *             Initial version
  */
 
@@ -876,6 +876,7 @@ int write_cache_pages(struct address_space *mapping,
        pgoff_t end;            /* Inclusive */
        int scanned = 0;
        int range_whole = 0;
+       long nr_to_write = wbc->nr_to_write;
 
        if (wbc->nonblocking && bdi_write_congested(bdi)) {
                wbc->encountered_congestion = 1;
@@ -939,7 +940,7 @@ retry:
                                unlock_page(page);
                                ret = 0;
                        }
-                       if (ret || (--(wbc->nr_to_write) <= 0))
+                       if (ret || (--nr_to_write <= 0))
                                done = 1;
                        if (wbc->nonblocking && bdi_write_congested(bdi)) {
                                wbc->encountered_congestion = 1;
@@ -958,11 +959,12 @@ retry:
                index = 0;
                goto retry;
        }
-       if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
-               mapping->writeback_index = index;
+       if (!wbc->no_nrwrite_index_update) {
+               if (wbc->range_cyclic || (range_whole && nr_to_write > 0))
+                       mapping->writeback_index = index;
+               wbc->nr_to_write = nr_to_write;
+       }
 
-       if (wbc->range_cont)
-               wbc->range_start = index << PAGE_CACHE_SHIFT;
        return ret;
 }
 EXPORT_SYMBOL(write_cache_pages);