diff options
author | Christoph Hellwig <hch@lst.de> | 2022-08-06 10:03:24 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-09-26 12:27:59 +0200 |
commit | c3a62baf21ad691aae04c2f091debe667439537e (patch) | |
tree | 4000a807830529312f52cac54b06dbf1b0a48c3c /fs/btrfs/volumes.h | |
parent | 2bbc72f14f19031bdb26ba7854f4fc888c492e64 (diff) | |
download | linux-stable-c3a62baf21ad691aae04c2f091debe667439537e.tar.gz linux-stable-c3a62baf21ad691aae04c2f091debe667439537e.tar.bz2 linux-stable-c3a62baf21ad691aae04c2f091debe667439537e.zip |
btrfs: use chained bios when cloning
The stripes_pending in the btrfs_io_context counts number of inflight
low-level bios for an upper btrfs_bio. For reads this is generally
one as reads are never cloned, while for writes we can trivially use
the bio remaining mechanisms that is used for chained bios.
To be able to make use of that mechanism, split out a separate trivial
end_io handler for the cloned bios that does a minimal amount of error
tracking and which then calls bio_endio on the original bio to transfer
control to that, with the remaining counter making sure it is completed
last. This then allows to merge btrfs_end_bioc into the original bio
bi_end_io handler.
To make this all work all error handling needs to happen through the
bi_end_io handler, which requires a small amount of reshuffling in
submit_stripe_bio so that the bio is cloned already by the time the
suitability of the device is checked.
This reduces the size of the btrfs_io_context and prepares splitting
the btrfs_bio at the stripe boundary.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.h')
-rw-r--r-- | fs/btrfs/volumes.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 149fb5d522d4..56fc01373b0f 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -457,7 +457,6 @@ struct btrfs_discard_stripe { */ struct btrfs_io_context { refcount_t refs; - atomic_t stripes_pending; struct btrfs_fs_info *fs_info; u64 map_type; /* get from map_lookup->type */ bio_end_io_t *end_io; |