Commit f5f288a0 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

afs: convert pagevec to folio_batch in afs_extend_writeback()

Patch series "Remove pagevecs".

Removes a folio->page->folio conversion for each folio that's involved. 
More importantly, removes one of the last few uses of a pagevec.

Link: https://lkml.kernel.org/r/20230621164557.3510324-1-willy@infradead.org
Link: https://lkml.kernel.org/r/20230621164557.3510324-2-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 1bf61092
...@@ -465,7 +465,7 @@ static void afs_extend_writeback(struct address_space *mapping, ...@@ -465,7 +465,7 @@ static void afs_extend_writeback(struct address_space *mapping,
bool caching, bool caching,
unsigned int *_len) unsigned int *_len)
{ {
struct pagevec pvec; struct folio_batch fbatch;
struct folio *folio; struct folio *folio;
unsigned long priv; unsigned long priv;
unsigned int psize, filler = 0; unsigned int psize, filler = 0;
...@@ -476,7 +476,7 @@ static void afs_extend_writeback(struct address_space *mapping, ...@@ -476,7 +476,7 @@ static void afs_extend_writeback(struct address_space *mapping,
unsigned int i; unsigned int i;
XA_STATE(xas, &mapping->i_pages, index); XA_STATE(xas, &mapping->i_pages, index);
pagevec_init(&pvec); folio_batch_init(&fbatch);
do { do {
/* Firstly, we gather up a batch of contiguous dirty pages /* Firstly, we gather up a batch of contiguous dirty pages
...@@ -535,7 +535,7 @@ static void afs_extend_writeback(struct address_space *mapping, ...@@ -535,7 +535,7 @@ static void afs_extend_writeback(struct address_space *mapping,
stop = false; stop = false;
index += folio_nr_pages(folio); index += folio_nr_pages(folio);
if (!pagevec_add(&pvec, &folio->page)) if (!folio_batch_add(&fbatch, folio))
break; break;
if (stop) if (stop)
break; break;
...@@ -545,14 +545,14 @@ static void afs_extend_writeback(struct address_space *mapping, ...@@ -545,14 +545,14 @@ static void afs_extend_writeback(struct address_space *mapping,
xas_pause(&xas); xas_pause(&xas);
rcu_read_unlock(); rcu_read_unlock();
/* Now, if we obtained any pages, we can shift them to being /* Now, if we obtained any folios, we can shift them to being
* writable and mark them for caching. * writable and mark them for caching.
*/ */
if (!pagevec_count(&pvec)) if (!folio_batch_count(&fbatch))
break; break;
for (i = 0; i < pagevec_count(&pvec); i++) { for (i = 0; i < folio_batch_count(&fbatch); i++) {
folio = page_folio(pvec.pages[i]); folio = fbatch.folios[i];
trace_afs_folio_dirty(vnode, tracepoint_string("store+"), folio); trace_afs_folio_dirty(vnode, tracepoint_string("store+"), folio);
if (!folio_clear_dirty_for_io(folio)) if (!folio_clear_dirty_for_io(folio))
...@@ -565,7 +565,7 @@ static void afs_extend_writeback(struct address_space *mapping, ...@@ -565,7 +565,7 @@ static void afs_extend_writeback(struct address_space *mapping,
folio_unlock(folio); folio_unlock(folio);
} }
pagevec_release(&pvec); folio_batch_release(&fbatch);
cond_resched(); cond_resched();
} while (!stop); } while (!stop);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment