mbox series

[RFC,0/3] btrfs-progs: balance --bg invocation

Message ID 20200408131457.GA19101@jkm (mailing list archive)
Headers show
Series btrfs-progs: balance --bg invocation | expand

Message

Petr Janecek April 8, 2020, 1:14 p.m. UTC
Hi,

Whenever 'btrfs balance...' is used with '--background', there is
no error output at all, everything goes to /dev/null after fork().
This is an attempt to get some output for this type of invocation.

First patch just moves the forking after opening the directory,
so that nonexistent path type errors are shown.

Second patch adds BTRFS_IOC_BALANCE_PROGRESS ioctl to the
'--background' invocation to check that the path is a btrfs mount,
that we have the permission and that there is no balance running.
It's a racy hack, but good enough in normal situations like
forgotten sudo etc.

Third one adds the '--background' option to the
'btrfs balance --full-balance <path>' type of invocation (without
the 'start').  It's easy to do with forks moved to do_balance()
by the first patch.

Adding '--background' to the "old 'btrfs filesystem balance
<path>' syntax" would be a bit more work.  As it does not support
filters or any other option and does not display the full balance
warning, I wonder if it would be worth it at all?


Petr Janecek (3):
  btrfs-progs: move '--background' fork()s to do_balance()
  btrfs_progs: _PROGRESS ioctl for error output in do_balance()
  btrfs-progs: add '--background' option for '--full-balance'

 cmds/balance.c | 125 ++++++++++++++++++++++++++++++++++---------------
 1 file changed, 86 insertions(+), 39 deletions(-)