* [PATCH v4 0/3] fstests: basic smoke test on zoned loop device
@ 2025-10-14 8:46 Johannes Thumshirn
2025-10-14 8:46 ` [PATCH v4 1/3] common/zoned: add _require_zloop Johannes Thumshirn
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Johannes Thumshirn @ 2025-10-14 8:46 UTC (permalink / raw)
To: Zorro Lang
Cc: Christoph Hellwig, Naohiro Aota, linux-btrfs, Hans Holmberg,
fstests, linux-xfs, Carlos Maiolino, Darrick J . Wong,
Johannes Thumshirn
Add a very basic smoke test on a zoned loopback device to check that noone is
accidentially breaking support for zoned block devices in filesystems that
support these.
Currently this includes btrfs, f2fs and xfs.
Changes to v3:
- Don't mkdir zloop_base in test but in _create_zloop
- Add Christoph's Reviewed-by in 1/3
Changes to v2:
- Add Carlos' Reviewed-bys
- Add a _find_last_zloop() helper
Johannes Thumshirn (3):
common/zoned: add _require_zloop
common/zoned: add _create_zloop
generic: basic smoke for filesystems on zoned block devices
common/zoned | 43 ++++++++++++++++++++++++++++++++++++++++
tests/generic/772 | 46 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/772.out | 2 ++
3 files changed, 91 insertions(+)
create mode 100755 tests/generic/772
create mode 100644 tests/generic/772.out
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 1/3] common/zoned: add _require_zloop
2025-10-14 8:46 [PATCH v4 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
@ 2025-10-14 8:46 ` Johannes Thumshirn
2025-10-14 20:53 ` Darrick J. Wong
2025-10-14 8:46 ` [PATCH v4 2/3] common/zoned: add _create_zloop Johannes Thumshirn
2025-10-14 8:46 ` [PATCH v4 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
2 siblings, 1 reply; 9+ messages in thread
From: Johannes Thumshirn @ 2025-10-14 8:46 UTC (permalink / raw)
To: Zorro Lang
Cc: Christoph Hellwig, Naohiro Aota, linux-btrfs, Hans Holmberg,
fstests, linux-xfs, Carlos Maiolino, Darrick J . Wong,
Johannes Thumshirn, Carlos Maiolino
Add _require_zloop() function used by tests that require support for the
zoned loopback block device.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
common/zoned | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/common/zoned b/common/zoned
index eed0082a..41697b08 100644
--- a/common/zoned
+++ b/common/zoned
@@ -37,3 +37,11 @@ _zone_capacity() {
grep -Po "cap 0x[[:xdigit:]]+" | cut -d ' ' -f 2)
echo $((size << 9))
}
+
+_require_zloop()
+{
+ modprobe zloop >/dev/null 2>&1
+ if [ ! -c "/dev/zloop-control" ]; then
+ _notrun "This test requires zoned loopback device support"
+ fi
+}
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 2/3] common/zoned: add _create_zloop
2025-10-14 8:46 [PATCH v4 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
2025-10-14 8:46 ` [PATCH v4 1/3] common/zoned: add _require_zloop Johannes Thumshirn
@ 2025-10-14 8:46 ` Johannes Thumshirn
2025-10-14 20:59 ` Darrick J. Wong
2025-10-14 8:46 ` [PATCH v4 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
2 siblings, 1 reply; 9+ messages in thread
From: Johannes Thumshirn @ 2025-10-14 8:46 UTC (permalink / raw)
To: Zorro Lang
Cc: Christoph Hellwig, Naohiro Aota, linux-btrfs, Hans Holmberg,
fstests, linux-xfs, Carlos Maiolino, Darrick J . Wong,
Johannes Thumshirn
Add _create_zloop a helper function for creating a zloop device.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
common/zoned | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/common/zoned b/common/zoned
index 41697b08..55acf120 100644
--- a/common/zoned
+++ b/common/zoned
@@ -45,3 +45,38 @@ _require_zloop()
_notrun "This test requires zoned loopback device support"
fi
}
+
+_find_next_zloop()
+{
+ local last_id=$(ls /dev/zloop* 2> /dev/null | grep -E "zloop[0-9]+" | wc -l)
+ echo $last_id
+}
+
+# Create a zloop device
+# useage: _create_zloop <base_dir> <zone_size> <nr_conv_zones>
+_create_zloop()
+{
+ local id="$(_find_next_zloop)"
+
+ if [ -n "$1" ]; then
+ local zloop_base="$1"
+ else
+ local zloop_base="/var/local/zloop"
+ fi
+
+ if [ -n "$2" ]; then
+ local zone_size=",zone_size_mb=$2"
+ fi
+
+ if [ -n "$3" ]; then
+ local conv_zones=",conv_zones=$3"
+ fi
+
+ mkdir -p "$zloop_base/$id"
+
+ local zloop_args="add id=$id,base_dir=$zloop_base$zone_size$conv_zones"
+
+ echo "$zloop_args" > /dev/zloop-control
+
+ echo "/dev/zloop$id"
+}
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v4 3/3] generic: basic smoke for filesystems on zoned block devices
2025-10-14 8:46 [PATCH v4 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
2025-10-14 8:46 ` [PATCH v4 1/3] common/zoned: add _require_zloop Johannes Thumshirn
2025-10-14 8:46 ` [PATCH v4 2/3] common/zoned: add _create_zloop Johannes Thumshirn
@ 2025-10-14 8:46 ` Johannes Thumshirn
2025-10-14 21:02 ` Darrick J. Wong
2 siblings, 1 reply; 9+ messages in thread
From: Johannes Thumshirn @ 2025-10-14 8:46 UTC (permalink / raw)
To: Zorro Lang
Cc: Christoph Hellwig, Naohiro Aota, linux-btrfs, Hans Holmberg,
fstests, linux-xfs, Carlos Maiolino, Darrick J . Wong,
Johannes Thumshirn, Carlos Maiolino
Add a basic smoke test for filesystems that support running on zoned
block devices.
It creates a zloop device with 2 conventional and 62 sequential zones,
mounts it and then runs fsx on it.
Currently this tests supports BTRFS, F2FS and XFS.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
tests/generic/772 | 46 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/772.out | 2 ++
2 files changed, 48 insertions(+)
create mode 100755 tests/generic/772
create mode 100644 tests/generic/772.out
diff --git a/tests/generic/772 b/tests/generic/772
new file mode 100755
index 00000000..d2c982c8
--- /dev/null
+++ b/tests/generic/772
@@ -0,0 +1,46 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2025 Wesgtern Digital Corporation. All Rights Reserved.
+#
+# FS QA Test 772
+#
+# Smoke test for FSes with ZBD support on zloop
+#
+. ./common/preamble
+_begin_fstest auto zone quick
+
+_cleanup()
+{
+ if test -b "$zloop"; then
+ ID=$(echo $zloop | grep -oE '[0-9]+$')
+ echo "remove id=$ID" > /dev/zloop-control
+ fi
+}
+
+. ./common/zoned
+
+# Modify as appropriate.
+_require_scratch
+_require_scratch_size $((16 * 1024 * 1024)) #kB
+_require_zloop
+
+_scratch_mkfs > /dev/null 2>&1
+_scratch_mount
+
+mnt="$SCRATCH_MNT/mnt"
+zloopdir="$SCRATCH_MNT/zloop"
+
+mkdir -p $mnt
+zloop=$(_create_zloop $zloopdir 256 2)
+
+_try_mkfs_dev $zloop 2>&1 >> $seqres.full ||\
+ _notrun "cannot mkfs zoned filesystem"
+_mount $zloop $mnt
+
+$FSX_PROG -q -N 20000 $FSX_AVOID "$mnt/fsx" >> $seqres.full
+
+umount $mnt
+
+echo Silence is golden
+# success, all done
+_exit 0
diff --git a/tests/generic/772.out b/tests/generic/772.out
new file mode 100644
index 00000000..98c13968
--- /dev/null
+++ b/tests/generic/772.out
@@ -0,0 +1,2 @@
+QA output created by 772
+Silence is golden
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/3] common/zoned: add _require_zloop
2025-10-14 8:46 ` [PATCH v4 1/3] common/zoned: add _require_zloop Johannes Thumshirn
@ 2025-10-14 20:53 ` Darrick J. Wong
0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2025-10-14 20:53 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Zorro Lang, Christoph Hellwig, Naohiro Aota, linux-btrfs,
Hans Holmberg, fstests, linux-xfs, Carlos Maiolino,
Carlos Maiolino
On Tue, Oct 14, 2025 at 10:46:23AM +0200, Johannes Thumshirn wrote:
> Add _require_zloop() function used by tests that require support for the
> zoned loopback block device.
>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Looks good to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> common/zoned | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/common/zoned b/common/zoned
> index eed0082a..41697b08 100644
> --- a/common/zoned
> +++ b/common/zoned
> @@ -37,3 +37,11 @@ _zone_capacity() {
> grep -Po "cap 0x[[:xdigit:]]+" | cut -d ' ' -f 2)
> echo $((size << 9))
> }
> +
> +_require_zloop()
> +{
> + modprobe zloop >/dev/null 2>&1
> + if [ ! -c "/dev/zloop-control" ]; then
> + _notrun "This test requires zoned loopback device support"
> + fi
> +}
> --
> 2.51.0
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/3] common/zoned: add _create_zloop
2025-10-14 8:46 ` [PATCH v4 2/3] common/zoned: add _create_zloop Johannes Thumshirn
@ 2025-10-14 20:59 ` Darrick J. Wong
2025-10-15 8:45 ` Johannes Thumshirn
0 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2025-10-14 20:59 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Zorro Lang, Christoph Hellwig, Naohiro Aota, linux-btrfs,
Hans Holmberg, fstests, linux-xfs, Carlos Maiolino
On Tue, Oct 14, 2025 at 10:46:24AM +0200, Johannes Thumshirn wrote:
> Add _create_zloop a helper function for creating a zloop device.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> common/zoned | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/common/zoned b/common/zoned
> index 41697b08..55acf120 100644
> --- a/common/zoned
> +++ b/common/zoned
> @@ -45,3 +45,38 @@ _require_zloop()
> _notrun "This test requires zoned loopback device support"
> fi
> }
> +
> +_find_next_zloop()
> +{
> + local last_id=$(ls /dev/zloop* 2> /dev/null | grep -E "zloop[0-9]+" | wc -l)
> + echo $last_id
Er... what happens if there are discontiguities in the active zloop
devices?
Let's say you have
# ls /dev/zloop*
/dev/zloop1000
/dev/zloop1000000
/dev/zloop3
That will produce last_id=3, which I don't think is what we want.
> +}
> +
> +# Create a zloop device
> +# useage: _create_zloop <base_dir> <zone_size> <nr_conv_zones>
> +_create_zloop()
> +{
> + local id="$(_find_next_zloop)"
> +
> + if [ -n "$1" ]; then
> + local zloop_base="$1"
> + else
> + local zloop_base="/var/local/zloop"
Maybe the default zloop_base should be under $tmp somewhere?
> + fi
> +
> + if [ -n "$2" ]; then
> + local zone_size=",zone_size_mb=$2"
> + fi
> +
> + if [ -n "$3" ]; then
> + local conv_zones=",conv_zones=$3"
> + fi
> +
> + mkdir -p "$zloop_base/$id"
> +
> + local zloop_args="add id=$id,base_dir=$zloop_base$zone_size$conv_zones"
> +
> + echo "$zloop_args" > /dev/zloop-control
I wonder, if /dev/zloop3 already exists, shouldn't we respect the failed
write? e.g.
echo "$zloop_args" > /dev/zloop-control && echo "/dev/zloop$id"
--D
> +
> + echo "/dev/zloop$id"
> +}
> --
> 2.51.0
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/3] generic: basic smoke for filesystems on zoned block devices
2025-10-14 8:46 ` [PATCH v4 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
@ 2025-10-14 21:02 ` Darrick J. Wong
2025-10-15 4:10 ` Christoph Hellwig
0 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2025-10-14 21:02 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Zorro Lang, Christoph Hellwig, Naohiro Aota, linux-btrfs,
Hans Holmberg, fstests, linux-xfs, Carlos Maiolino,
Carlos Maiolino
On Tue, Oct 14, 2025 at 10:46:25AM +0200, Johannes Thumshirn wrote:
> Add a basic smoke test for filesystems that support running on zoned
> block devices.
>
> It creates a zloop device with 2 conventional and 62 sequential zones,
> mounts it and then runs fsx on it.
>
> Currently this tests supports BTRFS, F2FS and XFS.
>
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> tests/generic/772 | 46 +++++++++++++++++++++++++++++++++++++++++++
> tests/generic/772.out | 2 ++
> 2 files changed, 48 insertions(+)
> create mode 100755 tests/generic/772
> create mode 100644 tests/generic/772.out
>
> diff --git a/tests/generic/772 b/tests/generic/772
> new file mode 100755
> index 00000000..d2c982c8
> --- /dev/null
> +++ b/tests/generic/772
> @@ -0,0 +1,46 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2025 Wesgtern Digital Corporation. All Rights Reserved.
> +#
> +# FS QA Test 772
> +#
> +# Smoke test for FSes with ZBD support on zloop
> +#
> +. ./common/preamble
> +_begin_fstest auto zone quick
> +
> +_cleanup()
> +{
> + if test -b "$zloop"; then
> + ID=$(echo $zloop | grep -oE '[0-9]+$')
> + echo "remove id=$ID" > /dev/zloop-control
Probably ought to be a teardown helper ^^
_destroy_zloop() {
local zloop="$1"
test -b "$zloop" || return
local id=$(echo $zloop | grep -oE '[0-9]+$')
echo "remove id=$id" > /dev/zloop-control
}
Then everyone's cleanups can become:
_cleanup()
{
_destroy_zloop "$zloop"
}
The test itself looks good though.
--D
> + fi
> +}
> +
> +. ./common/zoned
> +
> +# Modify as appropriate.
> +_require_scratch
> +_require_scratch_size $((16 * 1024 * 1024)) #kB
> +_require_zloop
> +
> +_scratch_mkfs > /dev/null 2>&1
> +_scratch_mount
> +
> +mnt="$SCRATCH_MNT/mnt"
> +zloopdir="$SCRATCH_MNT/zloop"
> +
> +mkdir -p $mnt
> +zloop=$(_create_zloop $zloopdir 256 2)
> +
> +_try_mkfs_dev $zloop 2>&1 >> $seqres.full ||\
> + _notrun "cannot mkfs zoned filesystem"
> +_mount $zloop $mnt
> +
> +$FSX_PROG -q -N 20000 $FSX_AVOID "$mnt/fsx" >> $seqres.full
> +
> +umount $mnt
> +
> +echo Silence is golden
> +# success, all done
> +_exit 0
> diff --git a/tests/generic/772.out b/tests/generic/772.out
> new file mode 100644
> index 00000000..98c13968
> --- /dev/null
> +++ b/tests/generic/772.out
> @@ -0,0 +1,2 @@
> +QA output created by 772
> +Silence is golden
> --
> 2.51.0
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/3] generic: basic smoke for filesystems on zoned block devices
2025-10-14 21:02 ` Darrick J. Wong
@ 2025-10-15 4:10 ` Christoph Hellwig
0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2025-10-15 4:10 UTC (permalink / raw)
To: Darrick J. Wong
Cc: Johannes Thumshirn, Zorro Lang, Christoph Hellwig, Naohiro Aota,
linux-btrfs, Hans Holmberg, fstests, linux-xfs, Carlos Maiolino,
Carlos Maiolino
On Tue, Oct 14, 2025 at 02:02:53PM -0700, Darrick J. Wong wrote:
> > +_cleanup()
> > +{
> > + if test -b "$zloop"; then
> > + ID=$(echo $zloop | grep -oE '[0-9]+$')
> > + echo "remove id=$ID" > /dev/zloop-control
>
> Probably ought to be a teardown helper ^^
>
> _destroy_zloop() {
> local zloop="$1"
>
> test -b "$zloop" || return
> local id=$(echo $zloop | grep -oE '[0-9]+$')
>
> echo "remove id=$id" > /dev/zloop-control
> }
>
> Then everyone's cleanups can become:
Yes, that's actually something I asked for in the review for the last
version.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/3] common/zoned: add _create_zloop
2025-10-14 20:59 ` Darrick J. Wong
@ 2025-10-15 8:45 ` Johannes Thumshirn
0 siblings, 0 replies; 9+ messages in thread
From: Johannes Thumshirn @ 2025-10-15 8:45 UTC (permalink / raw)
To: Darrick J. Wong
Cc: Zorro Lang, hch, Naohiro Aota, linux-btrfs@vger.kernel.org,
Hans Holmberg, fstests@vger.kernel.org, linux-xfs@vger.kernel.org,
Carlos Maiolino
On 10/14/25 10:59 PM, Darrick J. Wong wrote:
> On Tue, Oct 14, 2025 at 10:46:24AM +0200, Johannes Thumshirn wrote:
>> Add _create_zloop a helper function for creating a zloop device.
>>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>> ---
>> common/zoned | 35 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>>
>> diff --git a/common/zoned b/common/zoned
>> index 41697b08..55acf120 100644
>> --- a/common/zoned
>> +++ b/common/zoned
>> @@ -45,3 +45,38 @@ _require_zloop()
>> _notrun "This test requires zoned loopback device support"
>> fi
>> }
>> +
>> +_find_next_zloop()
>> +{
>> + local last_id=$(ls /dev/zloop* 2> /dev/null | grep -E "zloop[0-9]+" | wc -l)
>> + echo $last_id
> Er... what happens if there are discontiguities in the active zloop
> devices?
>
> Let's say you have
>
> # ls /dev/zloop*
> /dev/zloop1000
> /dev/zloop1000000
> /dev/zloop3
>
> That will produce last_id=3, which I don't think is what we want.
Yes I've changed that to:
_find_next_zloop()
{
id=0
while true; do
if [[ ! -b "/dev/zloop$id" ]]; then
break
fi
id=$((id + 1))
done
echo "$id"
}
>> +}
>> +
>> +# Create a zloop device
>> +# useage: _create_zloop <base_dir> <zone_size> <nr_conv_zones>
>> +_create_zloop()
>> +{
>> + local id="$(_find_next_zloop)"
>> +
>> + if [ -n "$1" ]; then
>> + local zloop_base="$1"
>> + else
>> + local zloop_base="/var/local/zloop"
> Maybe the default zloop_base should be under $tmp somewhere?
This is the kernel's default, so I opted for that
>
>> + fi
>> +
>> + if [ -n "$2" ]; then
>> + local zone_size=",zone_size_mb=$2"
>> + fi
>> +
>> + if [ -n "$3" ]; then
>> + local conv_zones=",conv_zones=$3"
>> + fi
>> +
>> + mkdir -p "$zloop_base/$id"
>> +
>> + local zloop_args="add id=$id,base_dir=$zloop_base$zone_size$conv_zones"
>> +
>> + echo "$zloop_args" > /dev/zloop-control
> I wonder, if /dev/zloop3 already exists, shouldn't we respect the failed
> write? e.g.
>
> echo "$zloop_args" > /dev/zloop-control && echo "/dev/zloop$id"
>
> --D
ok
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-10-15 8:45 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14 8:46 [PATCH v4 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
2025-10-14 8:46 ` [PATCH v4 1/3] common/zoned: add _require_zloop Johannes Thumshirn
2025-10-14 20:53 ` Darrick J. Wong
2025-10-14 8:46 ` [PATCH v4 2/3] common/zoned: add _create_zloop Johannes Thumshirn
2025-10-14 20:59 ` Darrick J. Wong
2025-10-15 8:45 ` Johannes Thumshirn
2025-10-14 8:46 ` [PATCH v4 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
2025-10-14 21:02 ` Darrick J. Wong
2025-10-15 4:10 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox