cifs: use find_get_pages_range_tag()

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

Link: http://lkml.kernel.org/r/20171009151359.31984-17-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Suggested-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Steve French <sfrench@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jan Kara 2017-11-15 17:35:26 -08:00 коммит произвёл Linus Torvalds
Родитель aef6e415ee
Коммит 9c19a9cb16
1 изменённых файлов: 2 добавлений и 19 удалений

Просмотреть файл

@ -1963,8 +1963,6 @@ wdata_alloc_and_fillpages(pgoff_t tofind, struct address_space *mapping,
pgoff_t end, pgoff_t *index, pgoff_t end, pgoff_t *index,
unsigned int *found_pages) unsigned int *found_pages)
{ {
unsigned int nr_pages;
struct page **pages;
struct cifs_writedata *wdata; struct cifs_writedata *wdata;
wdata = cifs_writedata_alloc((unsigned int)tofind, wdata = cifs_writedata_alloc((unsigned int)tofind,
@ -1972,23 +1970,8 @@ wdata_alloc_and_fillpages(pgoff_t tofind, struct address_space *mapping,
if (!wdata) if (!wdata)
return NULL; return NULL;
/* *found_pages = find_get_pages_range_tag(mapping, index, end,
* find_get_pages_tag seems to return a max of 256 on each PAGECACHE_TAG_DIRTY, tofind, wdata->pages);
* 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);
return wdata; return wdata;
} }