All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-fsdevel@vger.kernel.org>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	Jan Kara <jack@suse.cz>, Bob Peterson <rpeterso@redhat.com>,
	cluster-devel@redhat.com
Subject: [PATCH 08/16] gfs2: Use pagevec_lookup_range_tag()
Date: Mon,  9 Oct 2017 17:13:51 +0200	[thread overview]
Message-ID: <20171009151359.31984-9-jack@suse.cz> (raw)
In-Reply-To: <20171009151359.31984-1-jack@suse.cz>

We want only pages from given range in gfs2_write_cache_jdata(). Use
pagevec_lookup_range_tag() instead of pagevec_lookup_tag() and remove
unnecessary code.

CC: Bob Peterson <rpeterso@redhat.com>
CC: cluster-devel@redhat.com
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/aops.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 68ed06962537..d0848d9623fb 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -280,22 +280,6 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping,
 	for(i = 0; i < nr_pages; i++) {
 		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) {
-			/*
-			 * can't be range_cyclic (1st pass) because
-			 * end == -1 in that case.
-			 */
-			ret = 1;
-			break;
-		}
-
 		*done_index = page->index;
 
 		lock_page(page);
@@ -413,8 +397,8 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
 		tag_pages_for_writeback(mapping, index, end);
 	done_index = index;
 	while (!done && (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)
 			break;
 
-- 
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	Jan Kara <jack@suse.cz>, Bob Peterson <rpeterso@redhat.com>,
	cluster-devel@redhat.com
Subject: [PATCH 08/16] gfs2: Use pagevec_lookup_range_tag()
Date: Mon,  9 Oct 2017 17:13:51 +0200	[thread overview]
Message-ID: <20171009151359.31984-9-jack@suse.cz> (raw)
In-Reply-To: <20171009151359.31984-1-jack@suse.cz>

We want only pages from given range in gfs2_write_cache_jdata(). Use
pagevec_lookup_range_tag() instead of pagevec_lookup_tag() and remove
unnecessary code.

CC: Bob Peterson <rpeterso@redhat.com>
CC: cluster-devel@redhat.com
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/aops.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 68ed06962537..d0848d9623fb 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -280,22 +280,6 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping,
 	for(i = 0; i < nr_pages; i++) {
 		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) {
-			/*
-			 * can't be range_cyclic (1st pass) because
-			 * end == -1 in that case.
-			 */
-			ret = 1;
-			break;
-		}
-
 		*done_index = page->index;
 
 		lock_page(page);
@@ -413,8 +397,8 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
 		tag_pages_for_writeback(mapping, index, end);
 	done_index = index;
 	while (!done && (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)
 			break;
 
-- 
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 08/16] gfs2: Use pagevec_lookup_range_tag()
Date: Mon,  9 Oct 2017 17:13:51 +0200	[thread overview]
Message-ID: <20171009151359.31984-9-jack@suse.cz> (raw)
In-Reply-To: <20171009151359.31984-1-jack@suse.cz>

We want only pages from given range in gfs2_write_cache_jdata(). Use
pagevec_lookup_range_tag() instead of pagevec_lookup_tag() and remove
unnecessary code.

CC: Bob Peterson <rpeterso@redhat.com>
CC: cluster-devel at redhat.com
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/aops.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 68ed06962537..d0848d9623fb 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -280,22 +280,6 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping,
 	for(i = 0; i < nr_pages; i++) {
 		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) {
-			/*
-			 * can't be range_cyclic (1st pass) because
-			 * end == -1 in that case.
-			 */
-			ret = 1;
-			break;
-		}
-
 		*done_index = page->index;
 
 		lock_page(page);
@@ -413,8 +397,8 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
 		tag_pages_for_writeback(mapping, index, end);
 	done_index = index;
 	while (!done && (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)
 			break;
 
-- 
2.12.3



  parent reply	other threads:[~2017-10-09 15:13 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 15:13 [PATCH 0/16 v3] Ranged pagevec tagged lookup Jan Kara
2017-10-09 15:13 ` Jan Kara
2017-10-09 15:13 ` [PATCH 01/16] mm: Implement find_get_pages_range_tag() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 02/16] btrfs: Use pagevec_lookup_range_tag() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 03/16] ceph: " Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 04/16] ext4: " Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 05/16] f2fs: " Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 06/16] f2fs: Simplify page iteration loops Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 07/16] f2fs: Use find_get_pages_tag() for looking up single page Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` Jan Kara [this message]
2017-10-09 15:13   ` [Cluster-devel] [PATCH 08/16] gfs2: Use pagevec_lookup_range_tag() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 09/16] nilfs2: " Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 10/16] mm: Use pagevec_lookup_range_tag() in __filemap_fdatawait_range() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 11/16] mm: Use pagevec_lookup_range_tag() in write_cache_pages() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 12/16] mm: Add variant of pagevec_lookup_range_tag() taking number of pages Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 13/16] ceph: Use pagevec_lookup_range_nr_tag() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 14/16] mm: Remove nr_pages argument from pagevec_lookup_{,range}_tag() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 15/16] afs: Use find_get_pages_range_tag() Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-09 15:13 ` [PATCH 16/16] cifs: " Jan Kara
2017-10-09 15:13   ` Jan Kara
2017-10-10 17:48   ` Daniel Jordan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171009151359.31984-9-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cluster-devel@redhat.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.