btrfs-progs: balance: most filters can only be specified once
Subsystems (2)
PATCH 1/1 btrfs-progs: balance: most filters can only be specified once
Clarify in the documentation that only one occurrence of most filters is actually processed. Add a warning when more than one filter of the same type is specified.
It would be better to show an error when the same filter is specified more than once. The first filter is ignore in this case, and this is not an expected behavior - nor from the existing documentation, nor from a "naive" understand of the filter syntax. But as there could be existing scripts that may be specifying the same filter more than once, it is probably safer to show a warning and turn this into an error at a later point in time. Giving everyone time to update their scripts.
--- Documentation/ch-balance-filters.rst | 18 ++++++ cmds/balance.c | 96 +++++++++++++++++----------- 2 files changed, 75 insertions(+), 39 deletions(-)
Documentation/ch-balance-filters.rst +18 -0
@@ -15,6 +15,8 @@ right after the option without a space (this is mandatory getopt syntax), like A filter has the following structure: ``filter[=params][,filter=...]`` To combine multiple filters use ``,``, without spaces. Example: ``-dconvert=raid1,soft`` +Note that most filters can only be specified once per block group profile +(data/metadata/system block groups). BTRFS can have different profiles on a single device or the same profile on multiple device.
@@ -56,25 +58,35 @@ usage=<percent>, usage=<range> accept only the single value format. The minimum range boundary is inclusive, maximum is exclusive. + This filter can only be specified once per block group profile. + devid=<id> Balances only block groups which have at least one chunk on the given device. To list devices with ids use :command:`btrfs filesystem show`. + This filter can only be specified once per block group profile. + drange=<range> Balance only block groups which overlap with the given byte range on any device. Use in conjunction with ``devid`` to filter on a specific device. The parameter is a range specified as ``start..end``. + This filter can only be specified once per block group profile. + vrange=<range> Balance only block groups which overlap with the given byte range in the filesystem's internal virtual address space. This is the address space that most reports from btrfs in the kernel log use. The parameter is a range specified as ``start..end``. + This filter can only be specified once per block group profile. + convert=<profile> Convert each selected block group to the given profile name identified by parameters. + This filter can only be specified once per block group profile. + .. note:: Starting with kernel 4.5, the ``data`` chunks can be converted to/from the ``DUP`` profile on a single device.
@@ -108,12 +120,16 @@ limit=<number>, limit=<range> most N chunks*, equivalent to ``..N`` range syntax. Kernels prior to 4.4 accept only the single value format. The range minimum and maximum are inclusive. + This filter can only be specified once per block group profile. + stripes=<range> Balance only block groups which have the given number of stripes. The parameter is a range specified as ``start..end``. Makes sense for block group profiles that utilize striping, i.e. RAID0/10/5/6. The range minimum and maximum are inclusive. + This filter can only be specified once per block group profile. + soft Takes no parameters. Only has meaning when converting between profiles, or When doing convert from one profile to another and soft mode is on,
@@ -125,6 +141,8 @@ soft For example, this means that we can convert metadata chunks the "hard" way while converting data chunks selectively with soft switch. + This filter can only be specified once per block group profile. + Profile names, used in ``profiles`` and ``convert`` are one of: * ``raid0``
cmds/balance.c +57 -39
184 lines not on this page · raw message
Signature · 1 line
2.51.0
Quoted 12 lines · Illia Bobyr
Clarify in the documentation that only one occurrence of most filters is actually processed. Add a warning when more than one filter of the same type is specified.
It would be better to show an error when the same filter is specified more than once. The first filter is ignore in this case, and this is not an expected behavior - nor from the existing documentation, nor from a "naive" understand of the filter syntax. But as there could be existing scripts that may be specifying the same filter more than once, it is probably safer to show a warning and turn this into an error at a later point in time. Giving everyone time to update their scripts.
Quoted 1 line
Signed-off-by Illia Bobyr <[email protected]>
Added to devel, thanks.