linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	David Howells <dhowells@redhat.com>,
	linux-afs@lists.infradead.org
Subject: Re: [PATCH 15/15] afs: Use find_get_pages_range_tag()
Date: Tue, 3 Oct 2017 14:03:18 +0200	[thread overview]
Message-ID: <20171003120318.GI11879@quack2.suse.cz> (raw)
In-Reply-To: <ea1aa003-aaff-a17c-5a2c-28ed3c97a588@oracle.com>

On Fri 29-09-17 17:46:45, Daniel Jordan wrote:
> On 09/27/2017 12:03 PM, Jan Kara wrote:
> >Use find_get_pages_range_tag() in afs_writepages_region() as we are
> >interested only in pages from given range. Remove unnecessary code after
> >this conversion.
> >
> >CC: David Howells <dhowells@redhat.com>
> >CC: linux-afs@lists.infradead.org
> >Signed-off-by: Jan Kara <jack@suse.cz>
> >---
> >  fs/afs/write.c | 11 ++---------
> >  1 file changed, 2 insertions(+), 9 deletions(-)
> >
> >diff --git a/fs/afs/write.c b/fs/afs/write.c
> >index 106e43db1115..d62a6b54152d 100644
> >--- a/fs/afs/write.c
> >+++ b/fs/afs/write.c
> >@@ -497,20 +497,13 @@ static int afs_writepages_region(struct address_space *mapping,
> >  	_enter(",,%lx,%lx,", index, end);
> >  	do {
> >-		n = find_get_pages_tag(mapping, &index, PAGECACHE_TAG_DIRTY,
> >-				       1, &page);
> >+		n = find_get_pages_range_tag(mapping, &index, end,
> >+					PAGECACHE_TAG_DIRTY, 1, &page);
> >  		if (!n)
> >  			break;
> >  		_debug("wback %lx", page->index);
> >-		if (page->index > end) {
> >-			*_next = index;
> >-			put_page(page);
> >-			_leave(" = 0 [%lx]", *_next);
> >-			return 0;
> >-		}
> >-
> >  		/* at this point we hold neither mapping->tree_lock nor lock on
> >  		 * the page itself: the page may be truncated or invalidated
> >  		 * (changing page->mapping to NULL), or even swizzled back from
> 
> There's also one other caller of find_get_pages_tag that could be converted,
> wdata_alloc_and_fillpages.  Since the 256 max mentioned in the comment below
> no longer seems to apply, maybe something like this?:

Yeah, added a patch doing something like this.

> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 92fdf9c35de2..4dbd24231e8a 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -1963,31 +1963,14 @@ wdata_alloc_and_fillpages(pgoff_t tofind, struct
> address_space *mapping,
>                           pgoff_t end, pgoff_t *index,
>                           unsigned int *found_pages)
>  {
> -       unsigned int nr_pages;
> -       struct page **pages;
> -       struct cifs_writedata *wdata;
> -
> -       wdata = cifs_writedata_alloc((unsigned int)tofind,
> -                                    cifs_writev_complete);
> +       struct cifs_writedata *wdata =
> cifs_writedata_alloc((unsigned)tofind,
> + cifs_writev_complete);
>         if (!wdata)
>                 return NULL;
> 
> -       /*
> -        * find_get_pages_tag seems to return a max of 256 on each
> -        * iteration, so we must call it several times in order to
> -        * fill the array or the wsize is effectively limited to
> -        * 256 * PAGE_SIZE.
> -        */
> -       *found_pages = 0;
> -       pages = wdata->pages;
> -       do {
> -               nr_pages = find_get_pages_tag(mapping, index,
> -                                             PAGECACHE_TAG_DIRTY, tofind,
> -                                             pages);
> -               *found_pages += nr_pages;
> -               tofind -= nr_pages;
> -               pages += nr_pages;
> -       } while (nr_pages && tofind && *index <= end);
> +       *found_pages = find_get_pages_range_tag(mapping, index, end,
> +                                               PAGECACHE_TAG_DIRTY, tofind,
> +                                               wdata->pages);
> 
>         return wdata;
>  }
> 
> Otherwise the set looks good, so for the whole thing,
> 
> Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>

Thanks for review!

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

  reply	other threads:[~2017-10-03 12:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 16:03 [PATCH 0/15 v2] Ranged pagevec tagged lookup Jan Kara
2017-09-27 16:03 ` [PATCH 01/15] mm: Implement find_get_pages_range_tag() Jan Kara
2017-09-27 16:03 ` [PATCH 02/15] btrfs: Use pagevec_lookup_range_tag() Jan Kara
2017-09-27 16:03 ` [PATCH 03/15] ceph: " Jan Kara
2017-09-29  1:20   ` Yan, Zheng
2017-09-27 16:03 ` [PATCH 04/15] ext4: " Jan Kara
2017-09-27 16:03 ` [PATCH 05/15] f2fs: " Jan Kara
2017-09-27 16:03 ` [PATCH 06/15] f2fs: Simplify page iteration loops Jan Kara
2017-09-27 16:03 ` [PATCH 07/15] f2fs: Use find_get_pages_tag() for looking up single page Jan Kara
2017-09-27 16:03 ` [PATCH 08/15] gfs2: Use pagevec_lookup_range_tag() Jan Kara
2017-09-27 16:03 ` [PATCH 09/15] nilfs2: " Jan Kara
2017-09-28  1:40   ` Ryusuke Konishi
2017-09-27 16:03 ` [PATCH 10/15] mm: Use pagevec_lookup_range_tag() in __filemap_fdatawait_range() Jan Kara
2017-09-27 22:19   ` Dave Chinner
2017-10-03  8:38     ` Jan Kara
2017-09-27 16:03 ` [PATCH 11/15] mm: Use pagevec_lookup_range_tag() in write_cache_pages() Jan Kara
2017-09-27 16:03 ` [PATCH 12/15] mm: Add variant of pagevec_lookup_range_tag() taking number of pages Jan Kara
2017-09-29 21:45   ` Daniel Jordan
2017-10-03  8:51     ` Jan Kara
2017-09-27 16:03 ` [PATCH 13/15] ceph: Use pagevec_lookup_range_nr_tag() Jan Kara
2017-09-27 16:03 ` [PATCH 14/15] mm: Remove nr_pages argument from pagevec_lookup_{,range}_tag() Jan Kara
2017-09-29 21:46   ` Daniel Jordan
2017-10-03  9:07     ` Jan Kara
2017-09-27 16:03 ` [PATCH 15/15] afs: Use find_get_pages_range_tag() Jan Kara
2017-09-29 21:46   ` Daniel Jordan
2017-10-03 12:03     ` Jan Kara [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-14 13:18 [PATCH 0/15 v1] Ranged pagevec tagged lookup Jan Kara
2017-09-14 13:18 ` [PATCH 15/15] afs: Use find_get_pages_range_tag() Jan Kara

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=20171003120318.GI11879@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox