@@ -841,7 +841,7 @@ int dax_writeback_mapping_range(struct address_space *mapping,
pagevec_init(&pvec, 0);
while (!done) {
- pvec.nr = find_get_entries_tag(mapping, start_index,
+ pvec.nr = find_get_entries_tag(mapping, &start_index,
PAGECACHE_TAG_TOWRITE, PAGEVEC_SIZE,
pvec.pages, indices);
@@ -859,7 +859,6 @@ int dax_writeback_mapping_range(struct address_space *mapping,
if (ret < 0)
goto out;
}
- start_index = indices[pvec.nr - 1] + 1;
}
out:
put_dax(dax_dev);
@@ -365,7 +365,7 @@ static inline unsigned find_get_pages_tag(struct address_space *mapping,
return find_get_pages_range_tag(mapping, index, (pgoff_t)-1, tag,
nr_pages, pages);
}
-unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start,
+unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t *start,
int tag, unsigned int nr_entries,
struct page **entries, pgoff_t *indices);
@@ -1731,7 +1731,7 @@ EXPORT_SYMBOL(find_get_pages_range_tag);
* Like find_get_entries, except we only return entries which are tagged with
* @tag.
*/
-unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start,
+unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t *start,
int tag, unsigned int nr_entries,
struct page **entries, pgoff_t *indices)
{
@@ -1744,7 +1744,7 @@ unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start,
rcu_read_lock();
radix_tree_for_each_tagged(slot, &mapping->page_tree,
- &iter, start, tag) {
+ &iter, *start, tag) {
struct page *head, *page;
repeat:
page = radix_tree_deref_slot(slot);
@@ -1786,6 +1786,10 @@ unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start,
break;
}
rcu_read_unlock();
+
+ if (ret)
+ *start = indices[ret - 1] + 1;
+
return ret;
}
EXPORT_SYMBOL(find_get_entries_tag);
Make find_get_entries_tag() update 'start' to index the next page for iteration. Signed-off-by: Jan Kara <jack@suse.cz> --- fs/dax.c | 3 +-- include/linux/pagemap.h | 2 +- mm/filemap.c | 8 ++++++-- 3 files changed, 8 insertions(+), 5 deletions(-)