From patchwork Thu Sep 14 13:18:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9953089 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 AEDA9602C9 for ; Thu, 14 Sep 2017 13:20:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88D9B28458 for ; Thu, 14 Sep 2017 13:20:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C2A528CF1; Thu, 14 Sep 2017 13:20:01 +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 272DA28DF0 for ; Thu, 14 Sep 2017 13:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751621AbdINNTq (ORCPT ); Thu, 14 Sep 2017 09:19:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:34022 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751363AbdINNSi (ORCPT ); Thu, 14 Sep 2017 09:18:38 -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 6D1FBACD7; Thu, 14 Sep 2017 13:18:37 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id C46F21E3472; Thu, 14 Sep 2017 15:18:36 +0200 (CEST) From: Jan Kara To: Cc: , linux-f2fs-devel@lists.sourceforge.net, Jaegeuk Kim , ceph-devel@vger.kernel.org, "Yan, Zheng" , Ilya Dryomov , Jan Kara , "Theodore Ts'o" , linux-ext4@vger.kernel.org Subject: [PATCH 04/15] ext4: Use pagevec_lookup_range_tag() Date: Thu, 14 Sep 2017 15:18:08 +0200 Message-Id: <20170914131819.26266-5-jack@suse.cz> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170914131819.26266-1-jack@suse.cz> References: <20170914131819.26266-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 ext4_writepages(). Use pagevec_lookup_range_tag() instead of pagevec_lookup_tag() and remove unnecessary code. CC: "Theodore Ts'o" CC: linux-ext4@vger.kernel.org Signed-off-by: Jan Kara --- fs/ext4/inode.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 31db875bc7a1..69f11233d0d6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2619,8 +2619,8 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) mpd->map.m_len = 0; mpd->next_page = index; while (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, PAGEVEC_SIZE); if (nr_pages == 0) goto out; @@ -2628,16 +2628,6 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) struct page *page = pvec.pages[i]; /* - * At this point, the page may be truncated or - * invalidated (changing page->mapping to NULL), or - * even swizzled back from swapper_space to tmpfs file - * mapping. However, page->index will not change - * because we have a reference on the page. - */ - if (page->index > end) - goto out; - - /* * Accumulated enough dirty pages? This doesn't apply * to WB_SYNC_ALL mode. For integrity sync we have to * keep going because someone may be concurrently