Re: [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add

Anand Jain
2024-02-26T17:16:49Z

On 2/15/24 17:17, Johannes Thumshirn wrote:
> Add a filter for the output of btrfs device add.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> common/filter.btrfs | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/common/filter.btrfs b/common/filter.btrfs
> index ea76e7291108..a1c3013ecb5d 100644
> --- a/common/filter.btrfs
> +++ b/common/filter.btrfs
> @@ -147,5 +147,14 @@ _filter_balance_convert()
> _filter_scratch | \
> sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g"
> }
> +
> +# filter output of "btrfs device add"
> +_filter_device_add()
> +{
> + _filter_scratch | _filter_scratch_pool | \
> + sed -e "s/Resetting device zones SCRATCH_DEV ([0-9]\+/Resetting device zones SCRATCH_DEV (XXX/g"
> +
> +}
> +
> # make sure this script returns success
> /bin/true
>

Works well with all zone devices.

When only the first device is a zone and the rest aren't,
you are seeing.

-----------
btrfs/310 1s ... - output mismatch (see /fstests/results//btrfs/310.out.bad)
--- tests/btrfs/310.out 2024-02-26 19:17:51.092325188 +0800
+++ /fstests/results//btrfs/310.out.bad 2024-02-27
01:07:13.097603491 +0800
@@ -2,11 +2,8 @@
Done, had to relocate X out of X chunks
ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
There may be more info in syslog - try dmesg | tail
-Resetting device zones SCRATCH_DEV (XXX zones) ...
ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
-Resetting device zones SCRATCH_DEV (XXX zones) ...
...
(Run 'diff -u /fstests/tests/btrfs/310.out
/fstests/results//btrfs/310.out.bad' to see the entire diff)

HINT: You _MAY_ be missing kernel fix:
XXXXXXXXXX btrfs: zoned: don't skip block group profile checks on
conv zones
-------------

I have the kernel with fixes.

Thanks.