Zone append write command cannot exceed the max zone append size. This commit limits the page merging into a bio. Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx> --- fs/btrfs/extent_io.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 53bac37bc4ac..63cdf67e6885 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -3041,6 +3041,7 @@ static int submit_extent_page(unsigned int opf, size_t page_size = min_t(size_t, size, PAGE_SIZE); sector_t sector = offset >> 9; struct extent_io_tree *tree = &BTRFS_I(page->mapping->host)->io_tree; + struct btrfs_fs_info *fs_info = tree->fs_info; ASSERT(bio_ret); @@ -3058,6 +3059,11 @@ static int submit_extent_page(unsigned int opf, if (btrfs_bio_fits_in_stripe(page, page_size, bio, bio_flags)) can_merge = false; + if (fs_info->max_zone_append_size && + bio_op(bio) == REQ_OP_WRITE && + bio->bi_iter.bi_size + size > fs_info->max_zone_append_size) + can_merge = false; + if (prev_bio_flags != bio_flags || !contig || !can_merge || force_bio_submit || bio_add_page(bio, page, page_size, pg_offset) < page_size) { -- 2.27.0