btrfs: align max_zone_append_size to the sector size
PATCH 1/1 btrfs: align max_zone_append_size to the sector size
max_zone_append_size and thus the maximum extent size needs to be aligned to the sector size, else a lot code becomes rather unhappy and various alignment asserts trigger.
--- fs/btrfs/zoned.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/zoned.c +2 -1
@@ -739,7 +739,8 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) } fs_info->zone_size = zone_size; - fs_info->max_zone_append_size = max_zone_append_size; + fs_info->max_zone_append_size = +ALIGN (max_zone_append_size, fs_info->sectorsize); fs_info->fs_devices->chunk_alloc_policy =BTRFS_CHUNK_ALLOC_ZONED ;if (fs_info->max_zone_append_size < fs_info->max_extent_size) fs_info->max_extent_size = fs_info->max_zone_append_size;
Signature · 1 line
2.30.2
Looks good,
Quoted 6 lines · Christoph Hellwig
max_zone_append_sizeand thus the maximum extent size needs to be aligned to the sector size, else a lot code becomes rather unhappy and various alignment asserts trigger.Fixes 385ea2aea011 ("btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size")Signed-off-by Christoph Hellwig <[email protected]>
Folded to the patch, thanks.
Quoted 4 lines · David Sterba
Quoted 2 lines
Fixes 385ea2aea011 ("btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size")Signed-off-by Christoph Hellwig <[email protected]>Folded to the patch, thanks.
Turns out this is still broken as I was misled by the fancy ALIGN macro. We need the incremental change below. Do you want to fold this in again or should I sent it as a separate patch:
fs/btrfs/zoned.c +1 -1
@@ -740,7 +740,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) fs_info->zone_size = zone_size; fs_info->max_zone_append_size = -ALIGN (max_zone_append_size, fs_info->sectorsize); +ALIGN_DOWN (max_zone_append_size, fs_info->sectorsize); fs_info->fs_devices->chunk_alloc_policy =BTRFS_CHUNK_ALLOC_ZONED ;if (fs_info->max_zone_append_size < fs_info->max_extent_size) fs_info->max_extent_size = fs_info->max_zone_append_size;
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · David Sterba
Quoted 2 lines
Fixes 385ea2aea011 ("btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size")Signed-off-by Christoph Hellwig <[email protected]>Folded to the patch, thanks.
Turns out this is still broken as I was misled by the fancy ALIGN macro. We need the incremental change below. Do you want to fold this in again or should I sent it as a separate patch:
Folding small fixups is easier for me, no need to resend, thanks.