Skip to content

Commit 97b14d3

Browse files
committed
Revert "btrfs-progs: convert: make sure the length of data chunks are also stripe aligned"
This reverts commit 136c586. [BUG] There is a bug report that kernel is rejecting a converted btrfs that has dev extents beyond device boundary. The involved device extent is at 999627694980, length is 30924800, meanwhile the device is 999658557440. The device is size not aligned to 64K, meanwhile the dev extent is aligned to 64K. [CAUSE] For converted btrfs, the source fs has all its freedom to choose its size, as long as it's aligned to the fs block size. So when adding new converted data block groups we need to do extra alignment, but in make_convert_data_block_groups() we are rounding up the end, which can exceed the device size. [FIX] The original commit 136c586 ("btrfs-progs: convert: make sure the length of data chunks are also stripe aligned") is only a workaround to address a kernel bug. But since the kernel bug is long fixed, there isn't really much need to do the workaround, just revert it to avoid the dev extent to go beyond device size. Reported-by: Andieqqq <[email protected]> Signed-off-by: Qu Wenruo <[email protected]>
1 parent 8a179ae commit 97b14d3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

convert/main.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,7 @@ static int make_convert_data_block_groups(struct btrfs_trans_handle *trans,
948948
u64 cur_backup = cur;
949949

950950
len = min(max_chunk_size,
951-
round_up(cache->start + cache->size,
952-
BTRFS_STRIPE_LEN) - cur);
951+
cache->start + cache->size - cur);
953952
ret = btrfs_alloc_data_chunk(trans, fs_info, &cur_backup, len);
954953
if (ret < 0)
955954
break;

0 commit comments

Comments
 (0)