btrfs: zoned: revive max_zone_append_bytes
authorNaohiro Aota <naohiro.aota@wdc.com>
Mon, 22 Aug 2022 06:07:02 +0000 (15:07 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Aug 2022 15:16:34 +0000 (17:16 +0200)
commitf675e3ae67e4d68dafca834c0cf5c8298dfb22b5
tree5020b92150029dd64d68a112d575ee85aca8ee46
parent1815305d81996c8f892669321ae23ab2ba3e0c4b
btrfs: zoned: revive max_zone_append_bytes

commit c2ae7b772ef4e86c5ddf3fd47bf59045ae96a414 upstream

This patch is basically a revert of commit 5a80d1c6a270 ("btrfs: zoned:
remove max_zone_append_size logic"), but without unnecessary ASSERT and
check. The max_zone_append_size will be used as a hint to estimate the
number of extents to cover delalloc/writeback region in the later commits.

The size of a ZONE APPEND bio is also limited by queue_max_segments(), so
this commit considers it to calculate max_zone_append_size. Technically, a
bio can be larger than queue_max_segments() * PAGE_SIZE if the pages are
contiguous. But, it is safe to consider "queue_max_segments() * PAGE_SIZE"
as an upper limit of an extent size to calculate the number of extents
needed to write data.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ctree.h
fs/btrfs/zoned.c
fs/btrfs/zoned.h