Skip to contentSkip to conversation

btrfs-progs: dump-tree: add degraded option

PATCH Superseded Anand Jain 3 participants 6 messages Feb 22, 2018 – Apr 12, 2018 Btrfs file system

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Anand Jain

author
#0 lore raw

PATCH 1/1 btrfs-progs: dump-tree: add degraded option

btrfs inspect dump-tree cli picks the disk with the largest generation to read the root tree, even when all the devices were not provided in the cli. But in 2 disks RAID1 you may need to know what's in the disks individually, so this option -x | --degraded indicates to use only the given disk to dump.

---
 cmds-inspect-dump-tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
cmds-inspect-dump-tree.c +6 -1
index df44bb635c9c..587b6081df0c 100644
@@ -198,6 +198,7 @@ const char * const cmd_inspect_dump_tree_usage[] = {
 	"-u|--uuid              print only the uuid tree",
 	"-b|--block <block_num> print info from the specified block only",
 	"-t|--tree <tree_id>    print only tree with the given id (string or number)",
+	"-x|--degraded          For RAID1, use the disk in the arg, do not scan for disks",
 	NULL
 };
 
@@ -234,10 +235,11 @@ int cmd_inspect_dump_tree(int argc, char **argv)
 			{ "uuid", no_argument, NULL, 'u'},
 			{ "block", required_argument, NULL, 'b'},
 			{ "tree", required_argument, NULL, 't'},
+			{ "degraded", no_argument, NULL, 'x'},
 			{ NULL, 0, NULL, 0 }
 		};
 
-		c = getopt_long(argc, argv, "deb:rRut:", long_options, NULL);
+		c = getopt_long(argc, argv, "deb:rRut:x", long_options, NULL);
 		if (c < 0)
 			break;
 		switch (c) {
@@ -286,6 +288,9 @@ int cmd_inspect_dump_tree(int argc, char **argv)
 			}
 			break;
 			}
+		case 'x':
+			open_ctree_flags |= OPEN_CTREE_NO_DEVICES;
+			break;
 		default:
 			usage(cmd_inspect_dump_tree_usage);
 		}
Signature · 1 line
2.15.0
#1 lore raw
Quoted 16 lines · Anand Jain

btrfs inspect dump-tree cli picks the disk with the largest generation to read the root tree, even when all the devices were not provided in the cli. But in 2 disks RAID1 you may need to know what's in the disks individually, so this option -x | --degraded indicates to use only the given disk to dump.

---
 cmds-inspect-dump-tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
cmds-inspect-dump-tree.c +0 -0
index df44bb635c9c..587b6081df0c 100644

cmds-inspect-dump-tree.c const char * const cmd_inspect_dump_tree_usage[] = { · line 201

Quoted 4 lines
cmds-inspect-dump-tree.c +1 -0
@@ -198,6 +198,7 @@ const char * const cmd_inspect_dump_tree_usage[] = {
 	"-u|--uuid              print only the uuid tree",
 	"-b|--block <block_num> print info from the specified block only",
 	"-t|--tree <tree_id>    print only tree with the given id (string or number)",
+	"-x|--degraded          For RAID1, use the disk in the arg, do not scan for disks",

I find this confusing, degraded for kernel means 'mount with anything you have' while here it means 'use exactly that disk'.

Something that would reflect the "don't scan" would be IMHO better, but otherwise the goal of the patch makes sense.

author
#2 lore raw
Quoted 12 lines · David Sterba
Quoted 11 lines · Anand Jain

btrfs inspect dump-tree cli picks the disk with the largest generation to read the root tree, even when all the devices were not provided in the cli. But in 2 disks RAID1 you may need to know what's in the disks individually, so this option -x | --degraded indicates to use only the given disk to dump.

---
  cmds-inspect-dump-tree.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 12 lines

cmds-inspect-dump-tree.c const char * const cmd_inspect_dump_tree_usage[] = { · line 201

Quoted 9 lines
cmds-inspect-dump-tree.c +1 -0
index df44bb635c9c..587b6081df0c 100644
@@ -198,6 +198,7 @@ const char * const cmd_inspect_dump_tree_usage[] = {
  	"-u|--uuid              print only the uuid tree",
  	"-b|--block <block_num> print info from the specified block only",
  	"-t|--tree <tree_id>    print only tree with the given id (string or number)",
+	"-x|--degraded          For RAID1, use the disk in the arg, do not scan for disks",

I find this confusing, degraded for kernel means 'mount with anything you have' while here it means 'use exactly that disk'.

Agreed.

Quoted 2 lines

Something that would reflect the "don't scan" would be IMHO better, but otherwise the goal of the patch makes sense.

Hope this is better.

-x|--noscan

Thanks, Anand

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#3 lore raw

PATCH v2 1/1 btrfs-progs: dump-tree: add degraded option

btrfs inspect dump-tree cli picks the disk with the largest generation to read the root tree, even when all the devices were not provided in the cli. But in 2 disks RAID1 you may need to know what's in the disks individually, so this option -x | --noscan indicates to use only the given disk to dump.

---
v1->v2: rename --degraded to --noscan

 cmds-inspect-dump-tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
cmds-inspect-dump-tree.c +6 -1
index df44bb635c9c..d2676ce55af7 100644
@@ -198,6 +198,7 @@ const char * const cmd_inspect_dump_tree_usage[] = {
 	"-u|--uuid              print only the uuid tree",
 	"-b|--block <block_num> print info from the specified block only",
 	"-t|--tree <tree_id>    print only tree with the given id (string or number)",
+	"-x|--noscan            use the disk in the arg, do not scan for the disks (for raid1)",
 	NULL
 };
 
@@ -234,10 +235,11 @@ int cmd_inspect_dump_tree(int argc, char **argv)
 			{ "uuid", no_argument, NULL, 'u'},
 			{ "block", required_argument, NULL, 'b'},
 			{ "tree", required_argument, NULL, 't'},
+			{ "noscan", no_argument, NULL, 'x'},
 			{ NULL, 0, NULL, 0 }
 		};
 
-		c = getopt_long(argc, argv, "deb:rRut:", long_options, NULL);
+		c = getopt_long(argc, argv, "deb:rRut:x", long_options, NULL);
 		if (c < 0)
 			break;
 		switch (c) {
@@ -286,6 +288,9 @@ int cmd_inspect_dump_tree(int argc, char **argv)
 			}
 			break;
 			}
+		case 'x':
+			open_ctree_flags |= OPEN_CTREE_NO_DEVICES;
+			break;
 		default:
 			usage(cmd_inspect_dump_tree_usage);
 		}
Signature · 1 line
2.15.0
#4 lore raw
Quoted 18 lines · Anand Jain

btrfs inspect dump-tree cli picks the disk with the largest generation to read the root tree, even when all the devices were not provided in the cli. But in 2 disks RAID1 you may need to know what's in the disks individually, so this option -x | --noscan indicates to use only the given disk to dump.

---
v1->v2: rename --degraded to --noscan

 cmds-inspect-dump-tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
cmds-inspect-dump-tree.c +0 -0
index df44bb635c9c..d2676ce55af7 100644

cmds-inspect-dump-tree.c const char * const cmd_inspect_dump_tree_usage[] = { · line 201

Quoted 4 lines
cmds-inspect-dump-tree.c +1 -0
@@ -198,6 +198,7 @@ const char * const cmd_inspect_dump_tree_usage[] = {
 	"-u|--uuid              print only the uuid tree",
 	"-b|--block <block_num> print info from the specified block only",
 	"-t|--tree <tree_id>    print only tree with the given id (string or number)",
+	"-x|--noscan            use the disk in the arg, do not scan for the disks (for raid1)",

Still it looks a little too restrict.

What about some equivalent just like kernel "device=" mount option?

Thanks,
Qu

Quoted 27 lines
cmds-inspect-dump-tree.c +5 -1
 	NULL
 };
 
@@ -234,10 +235,11 @@ int cmd_inspect_dump_tree(int argc, char **argv)
 			{ "uuid", no_argument, NULL, 'u'},
 			{ "block", required_argument, NULL, 'b'},
 			{ "tree", required_argument, NULL, 't'},
+			{ "noscan", no_argument, NULL, 'x'},
 			{ NULL, 0, NULL, 0 }
 		};
 
-		c = getopt_long(argc, argv, "deb:rRut:", long_options, NULL);
+		c = getopt_long(argc, argv, "deb:rRut:x", long_options, NULL);
 		if (c < 0)
 			break;
 		switch (c) {
@@ -286,6 +288,9 @@ int cmd_inspect_dump_tree(int argc, char **argv)
 			}
 			break;
 			}
+		case 'x':
+			open_ctree_flags |= OPEN_CTREE_NO_DEVICES;
+			break;
 		default:
 			usage(cmd_inspect_dump_tree_usage);
 		}
author
#5 lore raw
Quoted 14 lines

cmds-inspect-dump-tree.c const char * const cmd_inspect_dump_tree_usage[] = { · line 201

Quoted 11 lines
cmds-inspect-dump-tree.c +1 -0
index df44bb635c9c..d2676ce55af7 100644
@@ -198,6 +198,7 @@ const char * const cmd_inspect_dump_tree_usage[] = {
  	"-u|--uuid              print only the uuid tree",
  	"-b|--block <block_num> print info from the specified block only",
  	"-t|--tree <tree_id>    print only tree with the given id (string or number)",
+	"-x|--noscan            use the disk in the arg, do not scan for the disks (for raid1)",

Still it looks a little too restrict.

Quoted 1 line

What about some equivalent just like kernel "device=" mount option?

You mean something like..

"-o use the disk(s) in the arg, do not scan for additional disks",

btrfs in dump-tree [options] -o [device=<dev1>,device=<dev2>] <dev3> btrfs in dump-tree [options] -o <dev>
btrfs in dump-tree [options] -o <dev1> -o <dev2> <dev3>

I am ok.

Thanks, Anand