From patchwork Wed Sep 27 16:03:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9974361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60C9F60365 for ; Wed, 27 Sep 2017 16:04:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5382E26E47 for ; Wed, 27 Sep 2017 16:04:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4840329108; Wed, 27 Sep 2017 16:04:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2FBB26E47 for ; Wed, 27 Sep 2017 16:04:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753403AbdI0QD5 (ORCPT ); Wed, 27 Sep 2017 12:03:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:59003 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752389AbdI0QD4 (ORCPT ); Wed, 27 Sep 2017 12:03:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A3FA8AC9D; Wed, 27 Sep 2017 16:03:54 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 6CE681E35B8; Wed, 27 Sep 2017 18:03:54 +0200 (CEST) From: Jan Kara To: Andrew Morton Cc: , , Jan Kara , Ilya Dryomov , "Yan, Zheng" , ceph-devel@vger.kernel.org Subject: [PATCH 03/15] ceph: Use pagevec_lookup_range_tag() Date: Wed, 27 Sep 2017 18:03:22 +0200 Message-Id: <20170927160334.29513-4-jack@suse.cz> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170927160334.29513-1-jack@suse.cz> References: <20170927160334.29513-1-jack@suse.cz> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 CC: "Yan, Zheng" CC: ceph-devel@vger.kernel.org Signed-off-by: Jan Kara Reviewed-by: "Yan, Zheng" --- 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);