btrfs: simplify adding pages in btrfs_add_compressed_bio_pages
authorChristoph Hellwig <hch@lst.de>
Tue, 14 Mar 2023 16:51:10 +0000 (17:51 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 16:01:18 +0000 (18:01 +0200)
commit43fa4219bcf012385150de299364b5044de6500d
tree19a4566c6a3e461488bbb22dc9b4ecd8a943c84a
parent4513cb0c40d79599f72a5d1a6ab2fb279b63500d
btrfs: simplify adding pages in btrfs_add_compressed_bio_pages

btrfs_add_compressed_bio_pages is needlessly complicated.  Instead
of iterating over the logic disk offset just to add pages to the bio
use a simple offset starting at 0, which also removes most of the
claiming.  Additionally __bio_add_pages already takes care of the
assert that the bio is always properly sized, and btrfs_submit_bio
called right after asserts that the bio size is non-zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c