btrfs-progs: convert: make sure the length of data chunks are also stripe aligned

Although kernel scrub code has been updated to handle the unaligned
chunk length, there is also no harm if we can allocate data chunk with
both start and length aligned.

This patch handles this by rounding up the end bytenr when allocating
data chunks for the conversion.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2024-01-16 14:01:24 +10:30 committed by David Sterba
parent 1d37d3ef91
commit 136c58617c
1 changed files with 2 additions and 1 deletions

View File

@ -984,7 +984,8 @@ static int make_convert_data_block_groups(struct btrfs_trans_handle *trans,
u64 cur_backup = cur;
len = min(max_chunk_size,
cache->start + cache->size - cur);
round_up(cache->start + cache->size,
BTRFS_STRIPE_LEN) - cur);
ret = btrfs_alloc_data_chunk(trans, fs_info, &cur_backup, len);
if (ret < 0)
break;