fs/ceph/addr: remove redundant field `nr_folios`
PATCH 1/1 fs/ceph/addr: remove redundant field `nr_folios`
This variable was added by commit 590a2b5f0a9b ("ceph: convert ceph_writepages_start() to use filemap_get_folios_tag()"), but it was redundant and unnecessary right from the start, because it was just a copy of fbatch.nr.
This patch just uses folio_batch_count(&ceph_wbc->fbatch) instead, but keeps the filemap_get_folios_tag() return value in a new local variable because calling folio_batch_count() would add unnecessary overhead when we already have the return value of filemap_get_folios_tag() in a register.
Signed-off-by Max Kellermann <[email protected]>
--- fs/ceph/addr.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
fs/ceph/addr.c +10 -12
@@ -597,7 +597,6 @@ struct ceph_writeback_ctlpgoff_t strip_unit_end;unsigned int wsize; -unsigned int nr_folios;unsigned int max_pages;unsigned int locked_pages;
@@ -1033,7 +1032,6 @@ void ceph_init_writeback_ctl(struct address_space *mapping, ceph_wbc->strip_unit_end =0 ; ceph_wbc->wsize =ceph_define_write_size (mapping); - ceph_wbc->nr_folios =0 ; ceph_wbc->max_pages =0 ; ceph_wbc->locked_pages =0 ;
@@ -1129,7 +1127,7 @@ static inlinebool can_next_page_be_processed (struct ceph_writeback_ctl *ceph_wbc,unsigned index) { -return index < ceph_wbc->nr_folios && +return index <folio_batch_count (&ceph_wbc->fbatch) && ceph_wbc->locked_pages < ceph_wbc->max_pages; }
@@ -1668,21 +1666,23 @@ static int ceph_writepages_start(struct address_space *mapping,tag_pages_for_writeback (mapping, ceph_wbc.index, ceph_wbc.end);while (!has_writeback_done (&ceph_wbc)) { +unsigned int nr_folios; + ceph_wbc.locked_pages =0 ; ceph_wbc.max_pages = ceph_wbc.wsize >>PAGE_SHIFT ; get_more_pages:ceph_folio_batch_reinit (&ceph_wbc); - ceph_wbc.nr_folios =filemap_get_folios_tag (mapping, - &ceph_wbc.index, - ceph_wbc.end, - ceph_wbc.tag, - &ceph_wbc.fbatch); + nr_folios =filemap_get_folios_tag (mapping, + &ceph_wbc.index, + ceph_wbc.end, + ceph_wbc.tag, + &ceph_wbc.fbatch);doutc (cl,"pagevec_lookup_range_tag for tag %#x got %d\n" , - ceph_wbc.tag, ceph_wbc.nr_folios); + ceph_wbc.tag, nr_folios); -if (!ceph_wbc.nr_folios && !ceph_wbc.locked_pages) +if (!nr_folios && !ceph_wbc.locked_pages)break ; process_folio_batch:
@@ -1712,8 +1712,6 @@ static int ceph_writepages_start(struct address_space *mapping, ceph_wbc.strip_unit_end =0 ;if (folio_batch_count (&ceph_wbc.fbatch) >0 ) { - ceph_wbc.nr_folios = -folio_batch_count (&ceph_wbc.fbatch); goto process_folio_batch; }
Signature · 1 line
2.47.2