btrfs: simplify the pending I/O counting in struct compressed_bio
authorChristoph Hellwig <hch@lst.de>
Thu, 7 Jul 2022 05:33:27 +0000 (07:33 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 17:54:47 +0000 (19:54 +0200)
commit524bcd1e178da1dccf24d9fc60fb20a35ec45e88
tree9331397638556fcb0a32b112b2cdc5294d8c9a9e
parentc144c63fd33a1fc0e43e0b851a35b09c9460d94d
btrfs: simplify the pending I/O counting in struct compressed_bio

Instead of counting the sectors just count the bios, with an extra
reference held during submission.  This significantly simplifies the
submission side error handling.

This slightly changes completion and error handling of
btrfs_submit_compressed_{read,write} because with the old code the
compressed_bio could have been completed in
submit_compressed_{read,write} only if there was an error during
submission for one of the lower bio, whilst with the new code there is a
chance for this to happen even for successful submission if the all the
lower bios complete before the end of the function is reached.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/compression.h