@@ -143,6 +143,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
bool to_extent_tree = false;
bool to_bg_tree = false;
bool to_fst = false;
+ bool noscan = false;
int csum_type = -1;
char *new_fsid_str = NULL;
int ret;
@@ -155,7 +156,8 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
enum { GETOPT_VAL_CSUM = GETOPT_VAL_FIRST,
GETOPT_VAL_ENABLE_BLOCK_GROUP_TREE,
GETOPT_VAL_DISABLE_BLOCK_GROUP_TREE,
- GETOPT_VAL_ENABLE_FREE_SPACE_TREE };
+ GETOPT_VAL_ENABLE_FREE_SPACE_TREE,
+ GETOPT_VAL_NOSCAN };
static const struct option long_options[] = {
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
{ "convert-to-block-group-tree", no_argument, NULL,
@@ -167,6 +169,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
#if EXPERIMENTAL
{ "csum", required_argument, NULL, GETOPT_VAL_CSUM },
#endif
+ { "noscan", no_argument, NULL, GETOPT_VAL_NOSCAN },
{ NULL, 0, NULL, 0 }
};
int c = getopt_long(argc, argv, "S:rxfuU:nmM:", long_options, NULL);
@@ -224,6 +227,10 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
csum_type = parse_csum_type(optarg);
break;
#endif
+ case GETOPT_VAL_NOSCAN:
+ ctree_flags |= OPEN_CTREE_NO_DEVICES;
+ noscan = true;
+ break;
case GETOPT_VAL_HELP:
default:
usage(&tune_cmd, c != GETOPT_VAL_HELP);
@@ -268,7 +275,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
}
ret = check_mounted_where(fd, device, NULL, 0, NULL,
- SBREAD_IGNORE_FSID_MISMATCH, false);
+ SBREAD_IGNORE_FSID_MISMATCH, noscan);
if (ret < 0) {
errno = -ret;
error("could not check mount status of %s: %m", device);
@@ -289,7 +296,6 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
return 1;
root = open_ctree_fd(fd, device, 0, ctree_flags);
-
if (!root) {
error("open ctree failed");
return 1;
Signed-off-by: Anand Jain <anand.jain@oracle.com> --- tune/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)