Skip to content

RFC btrfs-progs: balance --bg invocation

Petr Janecek linux-btrfs 1 version New

Get series with b4
b4 am 20200408131457.GA19101@jkm

Versions newest first

  1. v1 RFC Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs-progs: move '--background' fork()s to do_balance()cmds/balance.c+40 -380 replies
2/3btrfs_progs: _PROGRESS ioctl for error output in do_balance()cmds/balance.c+18 -00 replies
3/3btrfs-progs: add '--background' option for '--full-balance'cmds/balance.c+28 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] btrfs-progs: balance --bg invocation

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(-)
Signature · 1 line
2.26.0