diff options
author | Christoph Hellwig <hch@lst.de> | 2023-01-21 07:50:18 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-02-15 19:38:52 +0100 |
commit | 69ccf3f4244abc5f6d73ca5d8caf6b42a1db42c6 (patch) | |
tree | 60bfdf0a168ccbee436da4297f39b18a43ee2d24 /fs/btrfs/bio.c | |
parent | f8a53bb58ec7e2150f9b03f210675ba3e6d8b919 (diff) | |
download | lwn-69ccf3f4244abc5f6d73ca5d8caf6b42a1db42c6.tar.gz lwn-69ccf3f4244abc5f6d73ca5d8caf6b42a1db42c6.zip |
btrfs: handle recording of zoned writes in the storage layer
Move the code that splits the ordered extents and records the physical
location for them to the storage layer so that the higher level consumers
don't have to care about physical block numbers at all. This will also
allow to eventually remove accounting for the zone append write sizes in
the upper layer with a little bit more block layer work.
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/bio.c')
-rw-r--r-- | fs/btrfs/bio.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 0856440d3adf..c49a4d7d4a57 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -281,6 +281,8 @@ static void btrfs_simple_end_io(struct bio *bio) INIT_WORK(&bbio->end_io_work, btrfs_end_bio_work); queue_work(btrfs_end_io_wq(fs_info, bio), &bbio->end_io_work); } else { + if (bio_op(bio) == REQ_OP_ZONE_APPEND) + btrfs_record_physical_zoned(bbio); bbio->end_io(bbio); } } @@ -599,6 +601,12 @@ void btrfs_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio, int mirror } if (btrfs_op(bio) == BTRFS_MAP_WRITE) { + if (bio_op(bio) == REQ_OP_ZONE_APPEND) { + ret = btrfs_extract_ordered_extent(btrfs_bio(bio)); + if (ret) + goto fail; + } + /* * Csum items for reloc roots have already been cloned at this * point, so they are handled as part of the no-checksum case. |