]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: get rid of compressed_folios[] usage for encoded writes
authorQu Wenruo <wqu@suse.com>
Thu, 29 Jan 2026 03:23:45 +0000 (13:53 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:59:07 +0000 (07:59 +0100)
commite1bc83f8b157689e5de4f651b6fbb9dcdccd33c1
tree6a0bddcf13944434d37b1c6a4d29cb610fd3b696
parentdafcfa1c8e377a3d8e2e1d72a76435b57ed1ac7d
btrfs: get rid of compressed_folios[] usage for encoded writes

Currently only encoded writes utilized btrfs_submit_compressed_write(),
which utilized compressed_bio::compressed_folios[] array.

Change the only call site to call the new helper,
btrfs_alloc_compressed_write(), to allocate a compressed bio, then queue
needed folios into that bio, and finally call
btrfs_submit_compressed_write() to submit the compressed bio.

This change has one hidden benefit, previously we used
btrfs_alloc_folio_array() for the folios of
btrfs_submit_compressed_read(), which doesn't utilize the compression
page pool for bs == ps cases.

Now we call btrfs_alloc_compr_folio() which will benefit from the page pool.

The other obvious benefit is that we no longer need to allocate an array
to hold all those folios, thus one less error path.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/compression.h
fs/btrfs/inode.c