summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>2021-02-04 11:22:01 +0100
committerDavid Sterba <dsterba@suse.com>2021-02-09 02:46:05 +0100
commitcacb2cea46382aacf0365dbe231bd1ac3349478e (patch)
tree2df7b16cd23bbdc4b902c0f8457f7ba80e810e0a /fs/btrfs/extent_io.c
parentbtrfs: zoned: split ordered extent when bio is sent (diff)
downloadlinux-cacb2cea46382aacf0365dbe231bd1ac3349478e.tar.xz
linux-cacb2cea46382aacf0365dbe231bd1ac3349478e.zip
btrfs: zoned: check if bio spans across an ordered extent
To ensure that an ordered extent maps to a contiguous region on disk, we need to maintain a "one bio == one ordered extent" rule. Ensure that constructing bio does not span more than an ordered extent. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 6b26777efb92..f64e2be5749e 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3124,10 +3124,15 @@ static bool btrfs_bio_add_page(struct bio *bio, struct page *page,
if (btrfs_bio_fits_in_stripe(page, size, bio, bio_flags))
return false;
- if (bio_op(bio) == REQ_OP_ZONE_APPEND)
+ if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
+ struct page *first_page = bio_first_bvec_all(bio)->bv_page;
+
+ if (!btrfs_bio_fits_in_ordered_extent(first_page, bio, size))
+ return false;
ret = bio_add_zone_append_page(bio, page, size, pg_offset);
- else
+ } else {
ret = bio_add_page(bio, page, size, pg_offset);
+ }
return ret == size;
}