]> git.hungrycats.org Git - linux/commitdiff
btrfs: convert btrfs_compr_pool_scan() to use folios
authorTal Zussman <tz2294@columbia.edu>
Mon, 7 Sep 2026 20:19:58 +0000 (16:19 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Sep 2026 11:23:37 +0000 (13:23 +0200)
The compression pool holds order-0 folios, but btrfs_compr_pool_scan()
walks it as struct page through page->lru. Walk it as folios, matching
the other compression pool functions. This removes the last use of
page->lru in btrfs and saves a call to compound_head() per freed
folio.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c

index c62b5148d5ac19fbef8f6a91983f54cf11fdd43d..979b2ffbd8fc7e87fa5fda98976c0db601bcaf8d 100644 (file)
@@ -168,10 +168,10 @@ static unsigned long btrfs_compr_pool_scan(struct shrinker *sh, struct shrink_co
        spin_unlock(&compr_pool.lock);
 
        list_for_each_safe(tmp, next, &remove) {
-               struct page *page = list_entry(tmp, struct page, lru);
+               struct folio *folio = list_entry(tmp, struct folio, lru);
 
-               ASSERT(page_ref_count(page) == 1);
-               put_page(page);
+               ASSERT(folio_ref_count(folio) == 1);
+               folio_put(folio);
        }
 
        return freed;