Merge tag 'for-4.15-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[sfrench/cifs-2.6.git] / fs / btrfs / extent_io.c
index 1dfd14678db86daa915b992e846e4180509dfb54..012d63870b99acfc180ef0cd05fb337e39730959 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 #include <linux/bitops.h>
 #include <linux/slab.h>
 #include <linux/bio.h>
@@ -1983,7 +1984,7 @@ int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
        struct btrfs_bio *bbio = NULL;
        int ret;
 
-       ASSERT(!(fs_info->sb->s_flags & MS_RDONLY));
+       ASSERT(!(fs_info->sb->s_flags & SB_RDONLY));
        BUG_ON(!mirror_num);
 
        bio = btrfs_io_bio_alloc(1);
@@ -3796,7 +3797,7 @@ int btree_write_cache_pages(struct address_space *mapping,
        int scanned = 0;
        int tag;
 
-       pagevec_init(&pvec, 0);
+       pagevec_init(&pvec);
        if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
                end = -1;
@@ -3813,8 +3814,8 @@ retry:
        if (wbc->sync_mode == WB_SYNC_ALL)
                tag_pages_for_writeback(mapping, index, end);
        while (!done && !nr_to_write_done && (index <= end) &&
-              (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
-                       min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
+              (nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
+                       tag))) {
                unsigned i;
 
                scanned = 1;
@@ -3824,11 +3825,6 @@ retry:
                        if (!PagePrivate(page))
                                continue;
 
-                       if (!wbc->range_cyclic && page->index > end) {
-                               done = 1;
-                               break;
-                       }
-
                        spin_lock(&mapping->private_lock);
                        if (!PagePrivate(page)) {
                                spin_unlock(&mapping->private_lock);
@@ -3940,7 +3936,7 @@ static int extent_write_cache_pages(struct address_space *mapping,
        if (!igrab(inode))
                return 0;
 
-       pagevec_init(&pvec, 0);
+       pagevec_init(&pvec);
        if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
                end = -1;
@@ -3960,8 +3956,8 @@ retry:
                tag_pages_for_writeback(mapping, index, end);
        done_index = index;
        while (!done && !nr_to_write_done && (index <= end) &&
-              (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, tag,
-                       min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
+                       (nr_pages = pagevec_lookup_range_tag(&pvec, mapping,
+                                               &index, end, tag))) {
                unsigned i;
 
                scanned = 1;
@@ -3986,12 +3982,6 @@ retry:
                                continue;
                        }
 
-                       if (!wbc->range_cyclic && page->index > end) {
-                               done = 1;
-                               unlock_page(page);
-                               continue;
-                       }
-
                        if (wbc->sync_mode != WB_SYNC_NONE) {
                                if (PageWriteback(page))
                                        flush_fn(data);