Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit 0fdf977

Browse files
Christoph Hellwigkdave
authored andcommitted
btrfs: fix direct I/O writes for split bios on zoned devices
When a bio is split in btrfs_submit_direct, dip->file_offset contains the file offset for the first bio. But this means the start value used in btrfs_end_dio_bio to record the write location for zone devices is incorrect for subsequent bios. CC: [email protected] # 5.16+ Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Naohiro Aota <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Sweet Tea Dorminy <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 00d8252 commit 0fdf977

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/btrfs/inode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7865,6 +7865,7 @@ static blk_status_t btrfs_submit_bio_start_direct_io(struct inode *inode,
78657865
static void btrfs_end_dio_bio(struct bio *bio)
78667866
{
78677867
struct btrfs_dio_private *dip = bio->bi_private;
7868+
struct btrfs_bio *bbio = btrfs_bio(bio);
78687869
blk_status_t err = bio->bi_status;
78697870

78707871
if (err)
@@ -7875,12 +7876,12 @@ static void btrfs_end_dio_bio(struct bio *bio)
78757876
bio->bi_iter.bi_size, err);
78767877

78777878
if (bio_op(bio) == REQ_OP_READ)
7878-
err = btrfs_check_read_dio_bio(dip, btrfs_bio(bio), !err);
7879+
err = btrfs_check_read_dio_bio(dip, bbio, !err);
78797880

78807881
if (err)
78817882
dip->dio_bio->bi_status = err;
78827883

7883-
btrfs_record_physical_zoned(dip->inode, dip->file_offset, bio);
7884+
btrfs_record_physical_zoned(dip->inode, bbio->file_offset, bio);
78847885

78857886
bio_put(bio);
78867887
btrfs_dio_private_put(dip);

0 commit comments

Comments
 (0)