Skip to contentSkip to conversation

btrfs-progs confusing message

DISCUSSION Konstantin Svist 2 participants 3 messages Apr 20, 2016 – Apr 21, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Pretty much all commands print out the usage message when no device is specified:

[root@host ~]# btrfs scrub start
btrfs scrub start: too few arguments
usage: btrfs scrub start [-BdqrRf] [-c ioprio_class -n ioprio_classdata] <path>|<device>
...

However, balance doesn't

[root@host ~]# btrfs balance start
ERROR: can't access 'start': No such file or directory

#1 lore raw
Quoted 9 lines · Konstantin Svist

Pretty much all commands print out the usage message when no device is specified:

[root@host ~]# btrfs scrub start
btrfs scrub start: too few arguments
usage: btrfs scrub start [-BdqrRf] [-c ioprio_class -n ioprio_classdata] <path>|<device>
...

Quoted 4 lines

However, balance doesn't

[root@host ~]# btrfs balance start
ERROR: can't access 'start': No such file or directory

And this is an example of why backwards comparability can be a pain. The original balance command was 'btrfs filesystem balance', and had no start, stop, or similar sub-commands. This got changed to the current incarnation when the support for filters was added. For backwards compatibility reasons, we decided to still accept balance with no arguments other than the path as being the same as running 'btrfs balance start' on that path, and then made the old name an alias to the new one, with the restriction that you can't pass in filters through that interface. What is happening here is that balance is trying to interpret start as a path, not a command, hence the message about not being able to access 'start'.

#2 lore raw
Quoted 15 lines · Austin S. Hemmelgarn
Quoted 9 lines · Konstantin Svist

Pretty much all commands print out the usage message when no device is specified:

[root@host ~]# btrfs scrub start
btrfs scrub start: too few arguments
usage: btrfs scrub start [-BdqrRf] [-c ioprio_class -n ioprio_classdata] <path>|<device>
...

Quoted 4 lines

However, balance doesn't

[root@host ~]# btrfs balance start
ERROR: can't access 'start': No such file or directory

Quoted 12 lines

And this is an example of why backwards comparability can be a pain. The original balance command was 'btrfs filesystem balance', and had no start, stop, or similar sub-commands. This got changed to the current incarnation when the support for filters was added. For backwards compatibility reasons, we decided to still accept balance with no arguments other than the path as being the same as running 'btrfs balance start' on that path, and then made the old name an alias to the new one, with the restriction that you can't pass in filters through that interface. What is happening here is that balance is trying to interpret start as a path, not a command, hence the message about not being able to access 'start'.

So since this is still detected as an error, why not print usage info at this point?