mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 07:23:14 +00:00
f2fs: Convert f2fs_invalidate_compress_pages() to use filemap_get_folios()
Convert this function to use folios throughout. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org> Acked-by: Chao Yu <chao@kernel.org>
This commit is contained in:
parent
7530d0935c
commit
bbfe4f6600
@ -1832,45 +1832,40 @@ bool f2fs_load_compressed_page(struct f2fs_sb_info *sbi, struct page *page,
|
||||
void f2fs_invalidate_compress_pages(struct f2fs_sb_info *sbi, nid_t ino)
|
||||
{
|
||||
struct address_space *mapping = sbi->compress_inode->i_mapping;
|
||||
struct pagevec pvec;
|
||||
struct folio_batch fbatch;
|
||||
pgoff_t index = 0;
|
||||
pgoff_t end = MAX_BLKADDR(sbi);
|
||||
|
||||
if (!mapping->nrpages)
|
||||
return;
|
||||
|
||||
pagevec_init(&pvec);
|
||||
folio_batch_init(&fbatch);
|
||||
|
||||
do {
|
||||
unsigned int nr_pages;
|
||||
int i;
|
||||
unsigned int nr, i;
|
||||
|
||||
nr_pages = pagevec_lookup_range(&pvec, mapping,
|
||||
&index, end - 1);
|
||||
if (!nr_pages)
|
||||
nr = filemap_get_folios(mapping, &index, end - 1, &fbatch);
|
||||
if (!nr)
|
||||
break;
|
||||
|
||||
for (i = 0; i < nr_pages; i++) {
|
||||
struct page *page = pvec.pages[i];
|
||||
for (i = 0; i < nr; i++) {
|
||||
struct folio *folio = fbatch.folios[i];
|
||||
|
||||
if (page->index > end)
|
||||
break;
|
||||
|
||||
lock_page(page);
|
||||
if (page->mapping != mapping) {
|
||||
unlock_page(page);
|
||||
folio_lock(folio);
|
||||
if (folio->mapping != mapping) {
|
||||
folio_unlock(folio);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ino != get_page_private_data(page)) {
|
||||
unlock_page(page);
|
||||
if (ino != get_page_private_data(&folio->page)) {
|
||||
folio_unlock(folio);
|
||||
continue;
|
||||
}
|
||||
|
||||
generic_error_remove_page(mapping, page);
|
||||
unlock_page(page);
|
||||
generic_error_remove_page(mapping, &folio->page);
|
||||
folio_unlock(folio);
|
||||
}
|
||||
pagevec_release(&pvec);
|
||||
folio_batch_release(&fbatch);
|
||||
cond_resched();
|
||||
} while (index < end);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user