public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 0/3] fstests: basic smoke test on zoned loop device
@ 2025-10-22  9:27 Johannes Thumshirn
  2025-10-22  9:27 ` [PATCH v7 1/3] common/zoned: add _require_zloop Johannes Thumshirn
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Johannes Thumshirn @ 2025-10-22  9:27 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Christoph Hellwig, fstests, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino, 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 v6:
- Make 'id' local in _find_next_zloop
- Add _require_block_device in generic/772

Changes to v5:
- _fail in case zloop device creation fails
- Collect Reviewed-bys on 3/3

Changes to v4:
- Find next free id in _create_zloop
- Add _destroy_zloop
- Fix typo in _create_zloop documentation
- Redirect mkfs error to seqres.full

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 helpers for creation and teardown of zloop devices
  generic: basic smoke for filesystems on zoned block devices

 common/zoned          | 61 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/772     | 43 ++++++++++++++++++++++++++++++
 tests/generic/772.out |  2 ++
 3 files changed, 106 insertions(+)
 create mode 100755 tests/generic/772
 create mode 100644 tests/generic/772.out

--
2.51.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v7 1/3] common/zoned: add _require_zloop
  2025-10-22  9:27 [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
@ 2025-10-22  9:27 ` Johannes Thumshirn
  2025-10-28 11:50   ` Anand Jain
  2025-10-22  9:27 ` [PATCH v7 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Johannes Thumshirn @ 2025-10-22  9:27 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Christoph Hellwig, fstests, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino, 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>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
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] 8+ messages in thread

* [PATCH v7 2/3] common/zoned: add helpers for creation and teardown of zloop devices
  2025-10-22  9:27 [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
  2025-10-22  9:27 ` [PATCH v7 1/3] common/zoned: add _require_zloop Johannes Thumshirn
@ 2025-10-22  9:27 ` Johannes Thumshirn
  2025-10-28 11:52   ` Anand Jain
  2025-10-22  9:27 ` [PATCH v7 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
  2025-10-28 10:29 ` [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
  3 siblings, 1 reply; 8+ messages in thread
From: Johannes Thumshirn @ 2025-10-22  9:27 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Christoph Hellwig, fstests, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino, Johannes Thumshirn

Add _create_zloop, _destroy_zloop and _find_next_zloop helper functions
for creating destroying and finding the next free zloop device.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 common/zoned | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/common/zoned b/common/zoned
index 41697b08..88b81de5 100644
--- a/common/zoned
+++ b/common/zoned
@@ -45,3 +45,56 @@ _require_zloop()
 	    _notrun "This test requires zoned loopback device support"
     fi
 }
+
+_find_next_zloop()
+{
+    local id=0
+
+    while true; do
+        if [[ ! -b "/dev/zloop$id" ]]; then
+            break
+        fi
+        id=$((id + 1))
+    done
+
+    echo "$id"
+}
+
+# Create a zloop device
+# usage: _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 || \
+        _fail "cannot create zloop device"
+
+    echo "/dev/zloop$id"
+}
+
+_destroy_zloop() {
+    local zloop="$1"
+
+    test -b "$zloop" || return
+    local id=$(echo $zloop | grep -oE '[0-9]+$')
+
+    echo "remove id=$id" > /dev/zloop-control
+}
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v7 3/3] generic: basic smoke for filesystems on zoned block devices
  2025-10-22  9:27 [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
  2025-10-22  9:27 ` [PATCH v7 1/3] common/zoned: add _require_zloop Johannes Thumshirn
  2025-10-22  9:27 ` [PATCH v7 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
@ 2025-10-22  9:27 ` Johannes Thumshirn
  2025-11-01 11:00   ` Zorro Lang
  2025-10-28 10:29 ` [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
  3 siblings, 1 reply; 8+ messages in thread
From: Johannes Thumshirn @ 2025-10-22  9:27 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Christoph Hellwig, fstests, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino, Johannes Thumshirn,
	Carlos Maiolino, Anand Jain

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>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anand Jain <asj@kernel.org>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 tests/generic/772     | 43 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/772.out |  2 ++
 2 files changed, 45 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..f9840cba
--- /dev/null
+++ b/tests/generic/772
@@ -0,0 +1,43 @@
+#! /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
+. ./common/zoned
+
+_begin_fstest auto zone quick
+
+_cleanup()
+{
+	_destroy_zloop $zloop
+}
+
+# Modify as appropriate.
+_require_scratch_size $((16 * 1024 * 1024)) #kB
+_require_block_device $SCRATCH_DEV
+_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 >> $seqres.full 2>&1 ||\
+	_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] 8+ messages in thread

* Re: [PATCH v7 0/3] fstests: basic smoke test on zoned loop device
  2025-10-22  9:27 [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
                   ` (2 preceding siblings ...)
  2025-10-22  9:27 ` [PATCH v7 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
@ 2025-10-28 10:29 ` Johannes Thumshirn
  3 siblings, 0 replies; 8+ messages in thread
From: Johannes Thumshirn @ 2025-10-28 10:29 UTC (permalink / raw)
  To: Zorro Lang
  Cc: hch, fstests@vger.kernel.org, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs@vger.kernel.org, Hans Holmberg,
	linux-xfs@vger.kernel.org, Darrick J . Wong, Carlos Maiolino

On 10/22/25 11:27 AM, Johannes Thumshirn wrote:
> 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 v6:
> - Make 'id' local in _find_next_zloop
> - Add _require_block_device in generic/772
>
> Changes to v5:
> - _fail in case zloop device creation fails
> - Collect Reviewed-bys on 3/3
>
> Changes to v4:
> - Find next free id in _create_zloop
> - Add _destroy_zloop
> - Fix typo in _create_zloop documentation
> - Redirect mkfs error to seqres.full
>
> 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 helpers for creation and teardown of zloop devices
>    generic: basic smoke for filesystems on zoned block devices
>
>   common/zoned          | 61 +++++++++++++++++++++++++++++++++++++++++++
>   tests/generic/772     | 43 ++++++++++++++++++++++++++++++
>   tests/generic/772.out |  2 ++
>   3 files changed, 106 insertions(+)
>   create mode 100755 tests/generic/772
>   create mode 100644 tests/generic/772.out
>
> --
> 2.51.0
>
>
Zorro ping?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v7 1/3] common/zoned: add _require_zloop
  2025-10-22  9:27 ` [PATCH v7 1/3] common/zoned: add _require_zloop Johannes Thumshirn
@ 2025-10-28 11:50   ` Anand Jain
  0 siblings, 0 replies; 8+ messages in thread
From: Anand Jain @ 2025-10-28 11:50 UTC (permalink / raw)
  To: Johannes Thumshirn, Zorro Lang
  Cc: Christoph Hellwig, fstests, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino, Carlos Maiolino


Reviewed-by: Anand Jain <asj@kernel.org>


Thanks

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v7 2/3] common/zoned: add helpers for creation and teardown of zloop devices
  2025-10-22  9:27 ` [PATCH v7 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
@ 2025-10-28 11:52   ` Anand Jain
  0 siblings, 0 replies; 8+ messages in thread
From: Anand Jain @ 2025-10-28 11:52 UTC (permalink / raw)
  To: Johannes Thumshirn, Zorro Lang
  Cc: Christoph Hellwig, fstests, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino



v6->v7 is missing. I guess ...

> +
> +_find_next_zloop()
> +{
> +    local id=0
> +

added local in v7.

Reviewed-by: Anand Jain <asj@kernel.org>



Thanks, Anand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v7 3/3] generic: basic smoke for filesystems on zoned block devices
  2025-10-22  9:27 ` [PATCH v7 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
@ 2025-11-01 11:00   ` Zorro Lang
  0 siblings, 0 replies; 8+ messages in thread
From: Zorro Lang @ 2025-11-01 11:00 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Christoph Hellwig, fstests, Damien Le Moal, Naohiro Aota,
	Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino, Carlos Maiolino, Anand Jain

On Wed, Oct 22, 2025 at 11:27:07AM +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>
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Anand Jain <asj@kernel.org>
> Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  tests/generic/772     | 43 +++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/772.out |  2 ++
>  2 files changed, 45 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..f9840cba
> --- /dev/null
> +++ b/tests/generic/772
> @@ -0,0 +1,43 @@
> +#! /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
> +. ./common/zoned
> +
> +_begin_fstest auto zone quick
> +
> +_cleanup()
> +{
> +	_destroy_zloop $zloop
> +}
> +
> +# Modify as appropriate.
> +_require_scratch_size $((16 * 1024 * 1024)) #kB
> +_require_block_device $SCRATCH_DEV
> +_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 >> $seqres.full 2>&1 ||\
> +	_notrun "cannot mkfs zoned filesystem"
> +_mount $zloop $mnt
> +
> +$FSX_PROG -q -N 20000 $FSX_AVOID "$mnt/fsx" >> $seqres.full
> +
> +umount $mnt

This version looks good to me. Just this unmount should be in _cleanup to make
sure we always can umount and destroy zloop device at the end of the test. If
no more review points, I'll change this case as below [1] when I merge it.

Reviewed-by: Zorro Lang <zlang@redhat.com>

[1]
diff --git a/tests/generic/772 b/tests/generic/772
index f9840cba..eaeb0c18 100755
--- a/tests/generic/772
+++ b/tests/generic/772
@@ -13,7 +13,10 @@ _begin_fstest auto zone quick
 
 _cleanup()
 {
+       [ -n "$mnt" ] && _unmount $mnt 2>/dev/null
        _destroy_zloop $zloop
+       cd /
+       rm -r -f $tmp.*
 }
 
 # Modify as appropriate.
@@ -36,8 +39,6 @@ _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


> +
> +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] 8+ messages in thread

end of thread, other threads:[~2025-11-01 11:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22  9:27 [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
2025-10-22  9:27 ` [PATCH v7 1/3] common/zoned: add _require_zloop Johannes Thumshirn
2025-10-28 11:50   ` Anand Jain
2025-10-22  9:27 ` [PATCH v7 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
2025-10-28 11:52   ` Anand Jain
2025-10-22  9:27 ` [PATCH v7 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
2025-11-01 11:00   ` Zorro Lang
2025-10-28 10:29 ` [PATCH v7 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox