On Tue, Oct 08, 2019 at 10:53:37AM +0800, Anand Jain wrote:
> On 10/8/19 1:41 AM, David Sterba wrote:
> > On Wed, Oct 02, 2019 at 12:11:52PM +0800, Anand Jain wrote:
> >> To help debug device scan issues, add verbose option to btrfs device scan.
> > 
> > The common options like --verbose are going to be added into the global
> > command so I'd rather avoid adding them to new subcommands as this would
> > become unnecessary compatibility issue.
> 
> > There's an pattern to follow, the output formats (--format). So add a
> > definition for global verbosity options, add new GETOPT_VAL global enum
> > values that do not clash with existing options, add relevant
> > HELPINFO_INSERT_ text string and use it in commands where needed.
> > 
> 
>   IMO a debug option should rather be at the top level command.
>   If verbose is the top level it would emit a lot of unwanted messages.
>   Here is how a user is using --verbose option in dev scan.
> 
>  
> https://lore.kernel.org/linux-btrfs/2daf15de-d1e7-b56a-be51-a6a3062ad...@oracle.com/T/#t
> 
> ------------
> useful to get the list of devices it finds.
> ------------
> 
>   OR I didn't get the whole idea here. Looks like you are suggesting
>   something like
> 
>    btrfs --verbose device scan
>    btrfs --verbose subvolume list <mnt>

Yes this is what I mean.

>    ::
> 
>   How does the user will know if a subcommand will have any verbose
>   or not?

The point is that the global option will work for all subcommands, so
the user does not have to know which support that or not. For
compatiblity reasons, what works now will continue to work. This means
that the verbosity option will be duplicated for some commands.

>   How would you not emit unwanted messages and keep the output clutter
>   free.

What unwanted messages? Though the verbosity option will be set as
global option, it will be up to the command itself what to print.

  $ btrfs -v device scan

would be equivalent to

  $ btrfs device scan -v

Reply via email to