aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/bio.c
diff options
context:
space:
mode:
authorGravatar Christoph Hellwig <hch@lst.de> 2023-06-09 07:27:04 +0200
committerGravatar David Sterba <dsterba@suse.com> 2023-06-19 13:59:32 +0200
commit3887653c44ec1de089b8624bd53af05b946939e9 (patch)
tree5f4f166a79386c6f503d15540f27c6627ba7e99c /fs/btrfs/bio.c
parentbtrfs: optimize the logical to physical mapping for zoned writes (diff)
downloadlinux-3887653c44ec1de089b8624bd53af05b946939e9.tar.gz
linux-3887653c44ec1de089b8624bd53af05b946939e9.tar.bz2
linux-3887653c44ec1de089b8624bd53af05b946939e9.zip
btrfs: record orig_physical only for the original bio
btrfs_submit_dev_bio is also called for clone bios that aren't embedded into a btrfs_bio structure, but previous commit "btrfs: optimize the logical to physical mapping for zoned writes" added code to assign btrfs_bio.orig_physical in it. This is harmless right now as only the single data profile can be used on zoned devices, but will blow up when the RAID stripe tree is added. Move it out into the single I/O specific branch in the caller. 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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index 54cfab7394d3..b1cdd145aada 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -431,7 +431,6 @@ static void btrfs_submit_dev_bio(struct btrfs_device *dev, struct bio *bio)
u64 zone_start = round_down(physical, dev->fs_info->zone_size);
ASSERT(btrfs_dev_is_sequential(dev, physical));
- btrfs_bio(bio)->orig_physical = physical;
bio->bi_iter.bi_sector = zone_start >> SECTOR_SHIFT;
}
btrfs_debug_in_rcu(dev->fs_info,
@@ -480,6 +479,8 @@ static void __btrfs_submit_bio(struct bio *bio, struct btrfs_io_context *bioc,
/* Single mirror read/write fast path. */
btrfs_bio(bio)->mirror_num = mirror_num;
bio->bi_iter.bi_sector = smap->physical >> SECTOR_SHIFT;
+ if (bio_op(bio) != REQ_OP_READ)
+ btrfs_bio(bio)->orig_physical = smap->physical;
bio->bi_private = smap->dev;
bio->bi_end_io = btrfs_simple_end_io;
btrfs_submit_dev_bio(smap->dev, bio);