From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Jan Kara To: Andrew Morton Cc: , , Daniel Jordan , Jan Kara , "Theodore Ts'o" , linux-ext4@vger.kernel.org Subject: [PATCH 04/16] ext4: Use pagevec_lookup_range_tag() Date: Mon, 9 Oct 2017 17:13:47 +0200 Message-Id: <20171009151359.31984-5-jack@suse.cz> In-Reply-To: <20171009151359.31984-1-jack@suse.cz> References: <20171009151359.31984-1-jack@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: 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 Reviewed-by: Daniel Jordan 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 -- 2.12.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: [PATCH 04/16] ext4: Use pagevec_lookup_range_tag() Date: Mon, 9 Oct 2017 17:13:47 +0200 Message-ID: <20171009151359.31984-5-jack@suse.cz> References: <20171009151359.31984-1-jack@suse.cz> Cc: , , Daniel Jordan , Jan Kara , "Theodore Ts'o" , linux-ext4@vger.kernel.org To: Andrew Morton Return-path: Received: from mx2.suse.de ([195.135.220.15]:49795 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754740AbdJIPOJ (ORCPT ); Mon, 9 Oct 2017 11:14:09 -0400 In-Reply-To: <20171009151359.31984-1-jack@suse.cz> Sender: linux-ext4-owner@vger.kernel.org List-ID: 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 Reviewed-by: Daniel Jordan 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; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id 740BB6B026E for ; Mon, 9 Oct 2017 11:14:15 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id b189so27168448wmd.5 for ; Mon, 09 Oct 2017 08:14:15 -0700 (PDT) Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id e77si7152699wmi.245.2017.10.09.08.14.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 09 Oct 2017 08:14:07 -0700 (PDT) From: Jan Kara Subject: [PATCH 04/16] ext4: Use pagevec_lookup_range_tag() Date: Mon, 9 Oct 2017 17:13:47 +0200 Message-Id: <20171009151359.31984-5-jack@suse.cz> In-Reply-To: <20171009151359.31984-1-jack@suse.cz> References: <20171009151359.31984-1-jack@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Daniel Jordan , Jan Kara , Theodore Ts'o , 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 Reviewed-by: Daniel Jordan 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 -- 2.12.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org