All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: dump-tree: add degraded option
@ 2018-02-22 14:00 Anand Jain
  2018-03-09 16:23 ` David Sterba
  0 siblings, 1 reply; 6+ messages in thread
From: Anand Jain @ 2018-02-22 14:00 UTC (permalink / raw)
  To: linux-btrfs

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.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds-inspect-dump-tree.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c
index df44bb635c9c..587b6081df0c 100644
--- a/cmds-inspect-dump-tree.c
+++ b/cmds-inspect-dump-tree.c
@@ -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);
 		}
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs-progs: dump-tree: add degraded option
  2018-02-22 14:00 [PATCH] btrfs-progs: dump-tree: add degraded option Anand Jain
@ 2018-03-09 16:23 ` David Sterba
  2018-03-10  0:13   ` Anand Jain
  2018-03-10 13:54   ` [PATCH v2] " Anand Jain
  0 siblings, 2 replies; 6+ messages in thread
From: David Sterba @ 2018-03-09 16:23 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Thu, Feb 22, 2018 at 10:00:11PM +0800, Anand Jain wrote:
> 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.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  cmds-inspect-dump-tree.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c
> index df44bb635c9c..587b6081df0c 100644
> --- a/cmds-inspect-dump-tree.c
> +++ b/cmds-inspect-dump-tree.c
> @@ -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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs-progs: dump-tree: add degraded option
  2018-03-09 16:23 ` David Sterba
@ 2018-03-10  0:13   ` Anand Jain
  2018-03-10 13:54   ` [PATCH v2] " Anand Jain
  1 sibling, 0 replies; 6+ messages in thread
From: Anand Jain @ 2018-03-10  0:13 UTC (permalink / raw)
  To: dsterba, linux-btrfs



On 03/10/2018 12:23 AM, David Sterba wrote:
> On Thu, Feb 22, 2018 at 10:00:11PM +0800, Anand Jain wrote:
>> 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.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   cmds-inspect-dump-tree.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c
>> index df44bb635c9c..587b6081df0c 100644
>> --- a/cmds-inspect-dump-tree.c
>> +++ b/cmds-inspect-dump-tree.c
>> @@ -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.

> 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


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] btrfs-progs: dump-tree: add degraded option
@ 2018-03-10 13:54   ` Anand Jain
  2018-03-12  0:23     ` Qu Wenruo
  0 siblings, 1 reply; 6+ messages in thread
From: Anand Jain @ 2018-03-10 13:54 UTC (permalink / raw)
  To: linux-btrfs

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.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v1->v2: rename --degraded to --noscan

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

diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c
index df44bb635c9c..d2676ce55af7 100644
--- a/cmds-inspect-dump-tree.c
+++ b/cmds-inspect-dump-tree.c
@@ -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);
 		}
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] btrfs-progs: dump-tree: add degraded option
  2018-03-10 13:54   ` [PATCH v2] " Anand Jain
@ 2018-03-12  0:23     ` Qu Wenruo
  2018-04-12  8:58       ` Anand Jain
  0 siblings, 1 reply; 6+ messages in thread
From: Qu Wenruo @ 2018-03-12  0:23 UTC (permalink / raw)
  To: Anand Jain, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 2026 bytes --]



On 2018年03月10日 21:54, Anand Jain wrote:
> 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.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> v1->v2: rename --degraded to --noscan
> 
>  cmds-inspect-dump-tree.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c
> index df44bb635c9c..d2676ce55af7 100644
> --- a/cmds-inspect-dump-tree.c
> +++ b/cmds-inspect-dump-tree.c
> @@ -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

>  	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);
>  		}
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] btrfs-progs: dump-tree: add degraded option
  2018-03-12  0:23     ` Qu Wenruo
@ 2018-04-12  8:58       ` Anand Jain
  0 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2018-04-12  8:58 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs



>> diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c
>> index df44bb635c9c..d2676ce55af7 100644
>> --- a/cmds-inspect-dump-tree.c
>> +++ b/cmds-inspect-dump-tree.c
>> @@ -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?

  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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-12  8:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 14:00 [PATCH] btrfs-progs: dump-tree: add degraded option Anand Jain
2018-03-09 16:23 ` David Sterba
2018-03-10  0:13   ` Anand Jain
2018-03-10 13:54   ` [PATCH v2] " Anand Jain
2018-03-12  0:23     ` Qu Wenruo
2018-04-12  8:58       ` Anand Jain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.