]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ceph: use pagevec_lookup_range_tag()
authorJan Kara <jack@suse.cz>
Thu, 16 Nov 2017 01:34:41 +0000 (17:34 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Nov 2017 02:21:03 +0000 (18:21 -0800)
We want only pages from given range in ceph_writepages_start().  Use
pagevec_lookup_range_tag() instead of pagevec_lookup_tag() and remove
unnecessary code.

Link: http://lkml.kernel.org/r/20171009151359.31984-4-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ceph/addr.c

index 4d622654bfbcc2eb10ce81d461c53a35e5f2c44d..1af5cc899cb46f2fbfe79f268189dd9da3588ad0 100644 (file)
@@ -872,13 +872,10 @@ retry:
 get_more_pages:
                pvec_pages = min_t(unsigned, PAGEVEC_SIZE,
                                   max_pages - locked_pages);
-               if (end - index < (u64)(pvec_pages - 1))
-                       pvec_pages = (unsigned)(end - index) + 1;
-
-               pvec_pages = pagevec_lookup_tag(&pvec, mapping, &index,
-                                               PAGECACHE_TAG_DIRTY,
+               pvec_pages = pagevec_lookup_range_tag(&pvec, mapping, &index,
+                                               end, PAGECACHE_TAG_DIRTY,
                                                pvec_pages);
-               dout("pagevec_lookup_tag got %d\n", pvec_pages);
+               dout("pagevec_lookup_range_tag got %d\n", pvec_pages);
                if (!pvec_pages && !locked_pages)
                        break;
                for (i = 0; i < pvec_pages && locked_pages < max_pages; i++) {
@@ -896,16 +893,6 @@ get_more_pages:
                                unlock_page(page);
                                continue;
                        }
-                       if (page->index > end) {
-                               dout("end of range %p\n", page);
-                               /* can't be range_cyclic (1st pass) because
-                                * end == -1 in that case. */
-                               stop = true;
-                               if (ceph_wbc.head_snapc)
-                                       done = true;
-                               unlock_page(page);
-                               break;
-                       }
                        if (strip_unit_end && (page->index > strip_unit_end)) {
                                dout("end of strip unit %p\n", page);
                                unlock_page(page);