Skip to content

Commit 72fcf1a

Browse files
Christoph Hellwigkdave
authored andcommitted
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 <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent a724f31 commit 72fcf1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/btrfs/extent_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,8 @@ static void calc_bio_boundaries(struct btrfs_bio_ctrl *bio_ctrl,
964964
ordered = btrfs_lookup_ordered_extent(inode, file_offset);
965965
if (ordered) {
966966
bio_ctrl->len_to_oe_boundary = min_t(u32, U32_MAX,
967-
ordered->disk_bytenr +
968-
ordered->disk_num_bytes - logical);
967+
ordered->file_offset +
968+
ordered->disk_num_bytes - file_offset);
969969
btrfs_put_ordered_extent(ordered);
970970
return;
971971
}

0 commit comments

Comments
 (0)