Skip to content

Commit 97740f6

Browse files
adam900710kdave
authored andcommitted
btrfs-progs: convert: add feature dependency checks for bgt
Block group tree requires no-holes and free-space-tree features, add such check just like mkfs. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 5051962 commit 97740f6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

convert/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,12 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
12121212

12131213
if (btrfs_check_nodesize(nodesize, blocksize, features))
12141214
goto fail;
1215+
if ((features->compat_ro_flags & BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE) &&
1216+
(!(features->incompat_flags & BTRFS_FEATURE_INCOMPAT_NO_HOLES) ||
1217+
!(features->compat_ro_flags & BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE))) {
1218+
error("block group tree requires no-holes and free-space-tree features");
1219+
goto fail;
1220+
}
12151221
fd = open(devname, O_RDWR);
12161222
if (fd < 0) {
12171223
error("unable to open %s: %m", devname);

0 commit comments

Comments
 (0)