summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-12-12 08:37:18 +0100
committerDavid Sterba <dsterba@suse.com>2023-02-15 19:38:55 +0100
commit72fcf1a47b8daba82ffdeddd630688df5ac1bddb (patch)
tree87c4386bf98745d0ef31571312884b2bf11b8da8 /fs/btrfs
parenta724f313f84beb5b63b8844d9ec42a547e4a3c18 (diff)
downloadlinux-72fcf1a47b8daba82ffdeddd630688df5ac1bddb.tar.gz
btrfs: use file_offset to limit bios size in calc_bio_boundaries
btrfs_ordered_extent->disk_bytenr can be rewritten by the zoned I/O completion handler, and thus in general is not a good idea to limit I/O size. But the maximum bio size calculation can easily be done using the file_offset fields in the btrfs_ordered_extent and btrfs_bio structures, so switch to that instead. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 287e25edb3ef..d823994cf62a 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -964,8 +964,8 @@ static void calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
ordered = btrfs_lookup_ordered_extent(inode, file_offset);
if (ordered) {
bio_ctrl->len_to_oe_boundary = min_t(u32, U32_MAX,
- ordered->disk_bytenr +
- ordered->disk_num_bytes - logical);
+ ordered->file_offset +
+ ordered->disk_num_bytes - file_offset);
btrfs_put_ordered_extent(ordered);
return;
}