mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-06 10:34:09 +08:00
btrfs: convert btree_write_cache_pages() to use filemap_get_folio_tag()
Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). Link: https://lkml.kernel.org/r/20230104211448.4804-7-vishal.moola@gmail.com Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Acked-by: David Sterba <dsterba@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
acc8d8588c
commit
51c5cd3baf
@ -2865,14 +2865,14 @@ int btree_write_cache_pages(struct address_space *mapping,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
int nr_to_write_done = 0;
|
int nr_to_write_done = 0;
|
||||||
struct pagevec pvec;
|
struct folio_batch fbatch;
|
||||||
int nr_pages;
|
unsigned int nr_folios;
|
||||||
pgoff_t index;
|
pgoff_t index;
|
||||||
pgoff_t end; /* Inclusive */
|
pgoff_t end; /* Inclusive */
|
||||||
int scanned = 0;
|
int scanned = 0;
|
||||||
xa_mark_t tag;
|
xa_mark_t tag;
|
||||||
|
|
||||||
pagevec_init(&pvec);
|
folio_batch_init(&fbatch);
|
||||||
if (wbc->range_cyclic) {
|
if (wbc->range_cyclic) {
|
||||||
index = mapping->writeback_index; /* Start from prev offset */
|
index = mapping->writeback_index; /* Start from prev offset */
|
||||||
end = -1;
|
end = -1;
|
||||||
@ -2895,14 +2895,15 @@ retry:
|
|||||||
if (wbc->sync_mode == WB_SYNC_ALL)
|
if (wbc->sync_mode == WB_SYNC_ALL)
|
||||||
tag_pages_for_writeback(mapping, index, end);
|
tag_pages_for_writeback(mapping, index, end);
|
||||||
while (!done && !nr_to_write_done && (index <= end) &&
|
while (!done && !nr_to_write_done && (index <= end) &&
|
||||||
(nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end,
|
(nr_folios = filemap_get_folios_tag(mapping, &index, end,
|
||||||
tag))) {
|
tag, &fbatch))) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < nr_pages; i++) {
|
for (i = 0; i < nr_folios; i++) {
|
||||||
struct page *page = pvec.pages[i];
|
struct folio *folio = fbatch.folios[i];
|
||||||
|
|
||||||
ret = submit_eb_page(page, wbc, &bio_ctrl, &eb_context);
|
ret = submit_eb_page(&folio->page, wbc, &bio_ctrl,
|
||||||
|
&eb_context);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
continue;
|
continue;
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -2917,7 +2918,7 @@ retry:
|
|||||||
*/
|
*/
|
||||||
nr_to_write_done = wbc->nr_to_write <= 0;
|
nr_to_write_done = wbc->nr_to_write <= 0;
|
||||||
}
|
}
|
||||||
pagevec_release(&pvec);
|
folio_batch_release(&fbatch);
|
||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
if (!scanned && !done) {
|
if (!scanned && !done) {
|
||||||
|
Loading…
Reference in New Issue
Block a user