]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/btrfs/extent_io.c
Merge branch 'linus' into perf/urgent, to synchronize with upstream
[linux.git] / fs / btrfs / extent_io.c
index 394beb474a693e72a01c012b90ad965c52ce893b..e2d30287e2d562f18a517adb1eba44d282a36df9 100644 (file)
@@ -3919,6 +3919,11 @@ int btree_write_cache_pages(struct address_space *mapping,
        if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
                end = -1;
+               /*
+                * Start from the beginning does not need to cycle over the
+                * range, mark it as scanned.
+                */
+               scanned = (index == 0);
        } else {
                index = wbc->range_start >> PAGE_SHIFT;
                end = wbc->range_end >> PAGE_SHIFT;
@@ -3936,7 +3941,6 @@ int btree_write_cache_pages(struct address_space *mapping,
                        tag))) {
                unsigned i;
 
-               scanned = 1;
                for (i = 0; i < nr_pages; i++) {
                        struct page *page = pvec.pages[i];
 
@@ -4065,6 +4069,11 @@ static int extent_write_cache_pages(struct address_space *mapping,
        if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
                end = -1;
+               /*
+                * Start from the beginning does not need to cycle over the
+                * range, mark it as scanned.
+                */
+               scanned = (index == 0);
        } else {
                index = wbc->range_start >> PAGE_SHIFT;
                end = wbc->range_end >> PAGE_SHIFT;
@@ -4098,7 +4107,6 @@ static int extent_write_cache_pages(struct address_space *mapping,
                                                &index, end, tag))) {
                unsigned i;
 
-               scanned = 1;
                for (i = 0; i < nr_pages; i++) {
                        struct page *page = pvec.pages[i];