linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 16/16] cifs: Use find_get_pages_range_tag()
       [not found] <20171009151359.31984-1-jack@suse.cz>
@ 2017-10-09 15:13 ` Jan Kara
  2017-10-10 17:48   ` Daniel Jordan
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2017-10-09 15:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-fsdevel, Daniel Jordan, Jan Kara, linux-cifs,
	Steve French

wdata_alloc_and_fillpages() needlessly iterates calls to
find_get_pages_tag(). Also it wants only pages from given range. Make it
use find_get_pages_range_tag().

Suggested-by: Daniel Jordan <daniel.m.jordan@oracle.com>
CC: linux-cifs@vger.kernel.org
CC: Steve French <sfrench@samba.org>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/cifs/file.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 92fdf9c35de2..df9f682708c6 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1963,8 +1963,6 @@ 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,
@@ -1972,23 +1970,8 @@ wdata_alloc_and_fillpages(pgoff_t tofind, struct address_space *mapping,
 	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;
 }
 
-- 
2.12.3

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

* Re: [PATCH 16/16] cifs: Use find_get_pages_range_tag()
  2017-10-09 15:13 ` [PATCH 16/16] cifs: Use find_get_pages_range_tag() Jan Kara
@ 2017-10-10 17:48   ` Daniel Jordan
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jordan @ 2017-10-10 17:48 UTC (permalink / raw)
  To: Jan Kara; +Cc: Andrew Morton, linux-mm, linux-fsdevel, linux-cifs, Steve French

Hi Jan,

On 10/09/2017 11:13 AM, Jan Kara wrote:
> wdata_alloc_and_fillpages() needlessly iterates calls to
> find_get_pages_tag(). Also it wants only pages from given range. Make it
> use find_get_pages_range_tag().

Looks good, so

Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>

The rest of the v3 updates seem fine, too.

Daniel

--
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] 2+ messages in thread

end of thread, other threads:[~2017-10-10 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20171009151359.31984-1-jack@suse.cz>
2017-10-09 15:13 ` [PATCH 16/16] cifs: Use find_get_pages_range_tag() Jan Kara
2017-10-10 17:48   ` Daniel Jordan

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