cifs: use find_get_pages_range_tag()
[sfrench/cifs-2.6.git] / fs / cifs / file.c
index 92fdf9c35de2153fd6f008c4d1306ead6d806c89..df9f682708c6a6f4e17ea308c26f972ad48599e8 100644 (file)
@@ -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;
 }