summaryrefslogtreecommitdiff
path: root/fs/btrfs/compression.h
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2026-01-29 13:53:45 +1030
committerDavid Sterba <dsterba@suse.com>2026-02-03 07:59:07 +0100
commite1bc83f8b157689e5de4f651b6fbb9dcdccd33c1 (patch)
tree6a0bddcf13944434d37b1c6a4d29cb610fd3b696 /fs/btrfs/compression.h
parentdafcfa1c8e377a3d8e2e1d72a76435b57ed1ac7d (diff)
downloadlinux-next-e1bc83f8b157689e5de4f651b6fbb9dcdccd33c1.tar.gz
linux-next-e1bc83f8b157689e5de4f651b6fbb9dcdccd33c1.zip
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>
Diffstat (limited to 'fs/btrfs/compression.h')
-rw-r--r--fs/btrfs/compression.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
index 7dc48e556313..2d3a28b26997 100644
--- a/fs/btrfs/compression.h
+++ b/fs/btrfs/compression.h
@@ -96,10 +96,10 @@ int btrfs_decompress(int type, const u8 *data_in, struct folio *dest_folio,
int btrfs_decompress_buf2page(const char *buf, u32 buf_len,
struct compressed_bio *cb, u32 decompressed);
+struct compressed_bio *btrfs_alloc_compressed_write(struct btrfs_inode *inode,
+ u64 start, u64 len);
void btrfs_submit_compressed_write(struct btrfs_ordered_extent *ordered,
- struct folio **compressed_folios,
- unsigned int nr_folios, blk_opf_t write_flags,
- bool writeback);
+ struct compressed_bio *cb);
void btrfs_submit_compressed_read(struct btrfs_bio *bbio);
int btrfs_compress_str2level(unsigned int type, const char *str, int *level_ret);