diff mbox

[03/15] ceph: Use pagevec_lookup_range_tag()

Message ID 20170927160334.29513-4-jack@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kara Sept. 27, 2017, 4:03 p.m. UTC
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.

CC: Ilya Dryomov <idryomov@gmail.com>
CC: "Yan, Zheng" <zyan@redhat.com>
CC: ceph-devel@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ceph/addr.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

Comments

Yan, Zheng Sept. 29, 2017, 1:20 a.m. UTC | #1
> On 28 Sep 2017, at 00:03, Jan Kara <jack@suse.cz> wrote:
> 
> 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.
> 
> CC: Ilya Dryomov <idryomov@gmail.com>
> CC: "Yan, Zheng" <zyan@redhat.com>
> CC: ceph-devel@vger.kernel.org
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/ceph/addr.c | 19 +++----------------
> 1 file changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index b3e3edc09d80..e57e9d37bf2d 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -871,13 +871,10 @@ static int ceph_writepages_start(struct address_space *mapping,
> 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++) {
> @@ -895,16 +892,6 @@ static int ceph_writepages_start(struct address_space *mapping,
> 				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);
> -- 
> 2.12.3
> 

Reviewed-by: "Yan, Zheng" <zyan@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index b3e3edc09d80..e57e9d37bf2d 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -871,13 +871,10 @@  static int ceph_writepages_start(struct address_space *mapping,
 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++) {
@@ -895,16 +892,6 @@  static int ceph_writepages_start(struct address_space *mapping,
 				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);