From patchwork Wed Sep 27 16:03:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 819219 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y2N1G71zBz9sRg for ; Thu, 28 Sep 2017 02:04:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753434AbdI0QD6 (ORCPT ); Wed, 27 Sep 2017 12:03:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:59014 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752994AbdI0QD4 (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 D9712ACEA; Wed, 27 Sep 2017 16:03:54 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 6EC411E35B3; Wed, 27 Sep 2017 18:03:54 +0200 (CEST) From: Jan Kara To: Andrew Morton Cc: , , Jan Kara , "Theodore Ts'o" , linux-ext4@vger.kernel.org Subject: [PATCH 04/15] ext4: Use pagevec_lookup_range_tag() Date: Wed, 27 Sep 2017 18:03:23 +0200 Message-Id: <20170927160334.29513-5-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: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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