Re: [PATCH 2/2] xfs: Add test for mkfs with smaller zone capacity

Carlos Maiolino
2025-11-24T16:04:58Z

On Sat, Nov 22, 2025 at 04:36:46PM +0800, Zorro Lang wrote:
> On Thu, Nov 20, 2025 at 05:08:30PM +0100, cem@kernel.org wrote:
> > From: Carlos Maiolino <cem@kernel.org>
> >
> > Add a regression test for initializing zoned block devices with
> > sequential zones with a capacity smaller than the conventional
> > zones capacity.
> >
> > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> > ---
> > tests/xfs/333 | 37 +++++++++++++++++++++++++++++++++++++
> > tests/xfs/333.out | 2 ++
> > 2 files changed, 39 insertions(+)
> > create mode 100755 tests/xfs/333
> > create mode 100644 tests/xfs/333.out
> >
> > diff --git a/tests/xfs/333 b/tests/xfs/333
> > new file mode 100755
> > index 000000000000..f045b13c73ee
> > --- /dev/null
> > +++ b/tests/xfs/333
> > @@ -0,0 +1,37 @@
> > +#! /bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright (c) 2025 Red Hat, Inc. All Rights Reserved.
> > +#
> > +# FS QA Test 333
> > +#
> > +# Test that mkfs can properly initialize zoned devices
> > +# with a sequential zone capacity smaller than the conventional zone.
> > +#
> > +. ./common/preamble
> > +. ./common/zoned
> > +
> > +_begin_fstest auto zone mkfs quick
> > +_cleanup()
> > +{
> > + _destroy_zloop $zloop
>
> cd /
> rm -r -f $tmp.*
>
> > +}
> > +
> > +_require_scratch
>
> _require_block_device $SCRATCH_DEV

I'll add to the V2.

>
> > +_require_zloop
>
> g/781 checks if current $FSTYP supports zoned filesystem, and _notrun if it's
> not supported:
>
> _try_mkfs_dev $zloop >> $seqres.full 2>&1 ||\
> _notrun "cannot mkfs zoned filesystem"
>
> I'm wondering if we could have a common helper for that, then this case can be
> a generic test case too.
>
> For example:
>
> _require_zloop_filesystem()
> {
> _require_zloop
>
> local zloopdir="$TEST_DIR/zloop_test"
> local zloop=$(_create_zloop $zloopdir 64 2)
>
> _try_mkfs_dev $zloop >/dev/null 2>&1 || \
> _notrun "cannot make $FSTYP on zloop"
> _destroy_zloop $zloop
> }
>
> But this method takes too much time to run, does anyone have a better idea to help it
> to be finished in several seconds?
>
>
> > +
> > +_scratch_mkfs > /dev/null 2>&1
> > +_scratch_mount >> $seqres.full
> > +
> > +zloopdir="$SCRATCH_MNT/zloop"
> > +zone_size=64
> > +conv_zones=2
> > +zone_capacity=63
>
> Better to add a comment to explain what are these numbers for.

Hmm, why? The variable names are very self-descriptive. I could add a
comment, but it's just redundant IMHO, ex:

zone_size=64 # Set zloop zone size to 64MiB

I added the variables instead of passing the numbers directly to
_create_zloop to avoid needing to go back and forth to _create_zloop
definition and make the meaning clear.
I'm fine adding the comments, I just don't see the point.

>
> > +
> > +zloop=$(_create_zloop $zloopdir $zone_size $conv_zones $zone_capacity)
> > +
> > +_try_mkfs_dev $zloop >> $seqres.full 2>&1 || \
> > + _fail "Cannot mkfs zoned filesystem"
> > +
> > +echo Silence is golden
>
> Is this done? If such zloop device can be created, should we expect it works as usual?

Yes, the whole point is to ensure mkfs can initialize the filesystem on
top of the zoned block device.

Cheers,
Carlos