diff mbox series

[v3,5/5] btrfs-progs: mkfs: add artificial dependency for block group tree

Message ID 4b9cfb7fefd88b1943a8d630e2e34e0f439695b2.1660024949.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: separate BLOCK_GROUP_TREE feature from extent-tree-v2 | expand

Commit Message

Qu Wenruo Aug. 9, 2022, 6:03 a.m. UTC
To reduce the test matrix and to follow the kernel behavior, make sure
for block-group-tree feature, we have no-holes and free-space-tree
features enabled.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 mkfs/main.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/mkfs/main.c b/mkfs/main.c
index 518ce0fd7523..54cd47a0cdc0 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1303,6 +1303,13 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 		}
 	}
 
+	/* Block group tree feature requires no-holes and frree space tree. */
+	if (runtime_features & BTRFS_RUNTIME_FEATURE_BLOCK_GROUP_TREE &&
+	    (!(features & BTRFS_FEATURE_INCOMPAT_NO_HOLES) ||
+	     !(runtime_features & BTRFS_RUNTIME_FEATURE_FREE_SPACE_TREE))) {
+		error("block group tree feature requires no-holes and free-space-tree features");
+		exit(1);
+	}
 	if (zoned) {
 		if (source_dir_set) {
 			error("the option -r and zoned mode are incompatible");