btrfs-progs: warn when an experimental functionality is used

Print warning when one of the following is requested by some command
line option:

- btrfstune -b: conversion to block-group-tree
- mkfs.btrfs --num-global-roots: extent-tree-v2
- btrfs-image -d: dump image with data

Issue: #523
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2022-10-20 16:36:10 +02:00
parent 97ae14ee3d
commit f5e07cc60a
3 changed files with 5 additions and 2 deletions

View File

@ -966,7 +966,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
break; break;
switch(c) { switch(c) {
case 'b': case 'b':
btrfs_warn_experimental("Feature: block-group-tree"); btrfs_warn_experimental("Feature: conversion to block-group-tree");
to_bg_tree = true; to_bg_tree = true;
break; break;
case 'S': case 'S':
@ -1004,9 +1004,10 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
break; break;
#if EXPERIMENTAL #if EXPERIMENTAL
case GETOPT_VAL_CSUM: case GETOPT_VAL_CSUM:
btrfs_warn_experimental(
"Switching checksums is experimental, do not use for valuable data!");
ctree_flags |= OPEN_CTREE_SKIP_CSUM_CHECK; ctree_flags |= OPEN_CTREE_SKIP_CSUM_CHECK;
csum_type = parse_csum_type(optarg); csum_type = parse_csum_type(optarg);
warning("Switching checksums is experimental, do not use for valuable data!");
printf("Switch csum to %s\n", printf("Switch csum to %s\n",
btrfs_super_csum_name(csum_type)); btrfs_super_csum_name(csum_type));
break; break;

View File

@ -3109,6 +3109,7 @@ int BOX_MAIN(image)(int argc, char *argv[])
multi_devices = 1; multi_devices = 1;
break; break;
case 'd': case 'd':
btrfs_warn_experimental("Feature: dump image with data");
dump_data = true; dump_data = true;
break; break;
case GETOPT_VAL_HELP: case GETOPT_VAL_HELP:

View File

@ -1188,6 +1188,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
csum_type = parse_csum_type(optarg); csum_type = parse_csum_type(optarg);
break; break;
case GETOPT_VAL_GLOBAL_ROOTS: case GETOPT_VAL_GLOBAL_ROOTS:
btrfs_warn_experimental("Feature: num-global-roots is part of exten-tree-v2");
nr_global_roots = (int)arg_strtou64(optarg); nr_global_roots = (int)arg_strtou64(optarg);
break; break;
case GETOPT_VAL_HELP: case GETOPT_VAL_HELP: