Skip to content

Commit 136c586

Browse files
adam900710kdave
authored andcommitted
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 <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 1d37d3e commit 136c586

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

convert/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,8 @@ static int make_convert_data_block_groups(struct btrfs_trans_handle *trans,
984984
u64 cur_backup = cur;
985985

986986
len = min(max_chunk_size,
987-
cache->start + cache->size - cur);
987+
round_up(cache->start + cache->size,
988+
BTRFS_STRIPE_LEN) - cur);
988989
ret = btrfs_alloc_data_chunk(trans, fs_info, &cur_backup, len);
989990
if (ret < 0)
990991
break;

0 commit comments

Comments
 (0)