linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 09/15] nilfs2: Use pagevec_lookup_range_tag()
       [not found] <20170914131819.26266-1-jack@suse.cz>
@ 2017-09-14 13:18 ` Jan Kara
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2017-09-14 13:18 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-fsdevel, linux-f2fs-devel, Jaegeuk Kim, ceph-devel,
	Yan, Zheng, Ilya Dryomov, Jan Kara, Ryusuke Konishi, linux-nilfs

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

CC: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
CC: linux-nilfs@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/nilfs2/segment.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 70ded52dc1dd..68e5769cef3b 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -711,18 +711,14 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,
 	pagevec_init(&pvec, 0);
  repeat:
 	if (unlikely(index > last) ||
-	    !pagevec_lookup_tag(&pvec, mapping, &index, PAGECACHE_TAG_DIRTY,
-				min_t(pgoff_t, last - index,
-				      PAGEVEC_SIZE - 1) + 1))
+	    !pagevec_lookup_range_tag(&pvec, mapping, &index, last,
+				PAGECACHE_TAG_DIRTY, PAGEVEC_SIZE))
 		return ndirties;
 
 	for (i = 0; i < pagevec_count(&pvec); i++) {
 		struct buffer_head *bh, *head;
 		struct page *page = pvec.pages[i];
 
-		if (unlikely(page->index > last))
-			break;
-
 		lock_page(page);
 		if (!page_has_buffers(page))
 			create_empty_buffers(page, i_blocksize(inode), 0);
-- 
2.12.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 09/15] nilfs2: Use pagevec_lookup_range_tag()
       [not found] ` <20170927160334.29513-1-jack-AlSwsSmVLrQ@public.gmane.org>
@ 2017-09-27 16:03   ` Jan Kara
  2017-09-28  1:40     ` Ryusuke Konishi
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2017-09-27 16:03 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Jan Kara, Ryusuke Konishi,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA

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

CC: Ryusuke Konishi <konishi.ryusuke-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
CC: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
---
 fs/nilfs2/segment.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 70ded52dc1dd..68e5769cef3b 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -711,18 +711,14 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,
 	pagevec_init(&pvec, 0);
  repeat:
 	if (unlikely(index > last) ||
-	    !pagevec_lookup_tag(&pvec, mapping, &index, PAGECACHE_TAG_DIRTY,
-				min_t(pgoff_t, last - index,
-				      PAGEVEC_SIZE - 1) + 1))
+	    !pagevec_lookup_range_tag(&pvec, mapping, &index, last,
+				PAGECACHE_TAG_DIRTY, PAGEVEC_SIZE))
 		return ndirties;
 
 	for (i = 0; i < pagevec_count(&pvec); i++) {
 		struct buffer_head *bh, *head;
 		struct page *page = pvec.pages[i];
 
-		if (unlikely(page->index > last))
-			break;
-
 		lock_page(page);
 		if (!page_has_buffers(page))
 			create_empty_buffers(page, i_blocksize(inode), 0);
-- 
2.12.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 09/15] nilfs2: Use pagevec_lookup_range_tag()
  2017-09-27 16:03   ` Jan Kara
@ 2017-09-28  1:40     ` Ryusuke Konishi
  0 siblings, 0 replies; 3+ messages in thread
From: Ryusuke Konishi @ 2017-09-28  1:40 UTC (permalink / raw)
  To: Jan Kara, Andrew Morton; +Cc: linux-mm, linux-fsdevel, linux-nilfs


On 2017/09/28 1:03, Jan Kara wrote:
> We want only pages from given range in
> nilfs_lookup_dirty_data_buffers(). Use pagevec_lookup_range_tag()
> instead of pagevec_lookup_tag() and remove unnecessary code.
> 
> CC: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
> CC: linux-nilfs@vger.kernel.org
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>   fs/nilfs2/segment.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)

Nice patch. Thanks.

Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

> 
> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
> index 70ded52dc1dd..68e5769cef3b 100644
> --- a/fs/nilfs2/segment.c
> +++ b/fs/nilfs2/segment.c
> @@ -711,18 +711,14 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode,
>   	pagevec_init(&pvec, 0);
>    repeat:
>   	if (unlikely(index > last) ||
> -	    !pagevec_lookup_tag(&pvec, mapping, &index, PAGECACHE_TAG_DIRTY,
> -				min_t(pgoff_t, last - index,
> -				      PAGEVEC_SIZE - 1) + 1))
> +	    !pagevec_lookup_range_tag(&pvec, mapping, &index, last,
> +				PAGECACHE_TAG_DIRTY, PAGEVEC_SIZE))
>   		return ndirties;
>   
>   	for (i = 0; i < pagevec_count(&pvec); i++) {
>   		struct buffer_head *bh, *head;
>   		struct page *page = pvec.pages[i];
>   
> -		if (unlikely(page->index > last))
> -			break;
> -
>   		lock_page(page);
>   		if (!page_has_buffers(page))
>   			create_empty_buffers(page, i_blocksize(inode), 0);
> 

--
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-28  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170914131819.26266-1-jack@suse.cz>
2017-09-14 13:18 ` [PATCH 09/15] nilfs2: Use pagevec_lookup_range_tag() Jan Kara
     [not found] <20170927160334.29513-1-jack@suse.cz>
     [not found] ` <20170927160334.29513-1-jack-AlSwsSmVLrQ@public.gmane.org>
2017-09-27 16:03   ` Jan Kara
2017-09-28  1:40     ` Ryusuke Konishi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).