linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/3] fstests: basic smoke test on zoned loop device
@ 2025-10-17  5:50 Johannes Thumshirn
  2025-10-17  5:50 ` [PATCH v6 1/3] common/zoned: add _require_zloop Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Johannes Thumshirn @ 2025-10-17  5:50 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 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] 7+ messages in thread

* [PATCH v6 1/3] common/zoned: add _require_zloop
  2025-10-17  5:50 [PATCH v6 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
@ 2025-10-17  5:50 ` Johannes Thumshirn
  2025-10-17  5:50 ` [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
  2025-10-17  5:50 ` [PATCH v6 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Thumshirn @ 2025-10-17  5:50 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] 7+ messages in thread

* [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices
  2025-10-17  5:50 [PATCH v6 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
  2025-10-17  5:50 ` [PATCH v6 1/3] common/zoned: add _require_zloop Johannes Thumshirn
@ 2025-10-17  5:50 ` Johannes Thumshirn
  2025-10-17  6:04   ` Christoph Hellwig
                     ` (2 more replies)
  2025-10-17  5:50 ` [PATCH v6 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn
  2 siblings, 3 replies; 7+ messages in thread
From: Johannes Thumshirn @ 2025-10-17  5:50 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.

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..e2f5969c 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()
+{
+    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] 7+ messages in thread

* [PATCH v6 3/3] generic: basic smoke for filesystems on zoned block devices
  2025-10-17  5:50 [PATCH v6 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
  2025-10-17  5:50 ` [PATCH v6 1/3] common/zoned: add _require_zloop Johannes Thumshirn
  2025-10-17  5:50 ` [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
@ 2025-10-17  5:50 ` Johannes Thumshirn
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Thumshirn @ 2025-10-17  5:50 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..c2bb25ba
--- /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
+_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 >> $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] 7+ messages in thread

* Re: [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices
  2025-10-17  5:50 ` [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
@ 2025-10-17  6:04   ` Christoph Hellwig
  2025-10-20  5:15   ` Anand Jain
  2025-10-20 15:46   ` Darrick J. Wong
  2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2025-10-17  6:04 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Zorro Lang, Christoph Hellwig, fstests, Damien Le Moal,
	Naohiro Aota, Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Darrick J . Wong, Carlos Maiolino

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices
  2025-10-17  5:50 ` [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
  2025-10-17  6:04   ` Christoph Hellwig
@ 2025-10-20  5:15   ` Anand Jain
  2025-10-20 15:46   ` Darrick J. Wong
  2 siblings, 0 replies; 7+ messages in thread
From: Anand Jain @ 2025-10-20  5:15 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

On 17/10/25 13:50, Johannes Thumshirn wrote:
> Add _create_zloop, _destroy_zloop and _find_next_zloop helper functions
> for creating destroying and finding the next free zloop device.
> 
> 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..e2f5969c 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()
> +{
> +    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
> +}


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

Looks good.

Small nit: The function bracketing is inconsistent in this patch and in 
the file as well. We should fix this separately.





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

* Re: [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices
  2025-10-17  5:50 ` [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
  2025-10-17  6:04   ` Christoph Hellwig
  2025-10-20  5:15   ` Anand Jain
@ 2025-10-20 15:46   ` Darrick J. Wong
  2 siblings, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2025-10-20 15:46 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Zorro Lang, Christoph Hellwig, fstests, Damien Le Moal,
	Naohiro Aota, Anand Jain, linux-btrfs, Hans Holmberg, linux-xfs,
	Carlos Maiolino

On Fri, Oct 17, 2025 at 07:50:07AM +0200, Johannes Thumshirn wrote:
> Add _create_zloop, _destroy_zloop and _find_next_zloop helper functions
> for creating destroying and finding the next free zloop device.
> 
> 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..e2f5969c 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()
> +{
> +    id=0

local id=0

(so the helper won't reassign a variable in the caller's scope)

With that fixed,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> +
> +    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	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-10-20 15:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17  5:50 [PATCH v6 0/3] fstests: basic smoke test on zoned loop device Johannes Thumshirn
2025-10-17  5:50 ` [PATCH v6 1/3] common/zoned: add _require_zloop Johannes Thumshirn
2025-10-17  5:50 ` [PATCH v6 2/3] common/zoned: add helpers for creation and teardown of zloop devices Johannes Thumshirn
2025-10-17  6:04   ` Christoph Hellwig
2025-10-20  5:15   ` Anand Jain
2025-10-20 15:46   ` Darrick J. Wong
2025-10-17  5:50 ` [PATCH v6 3/3] generic: basic smoke for filesystems on zoned block devices Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).