]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: add helpers to require zoned/non-zoned file systems
authorChristoph Hellwig <hch@lst.de>
Fri, 21 Mar 2025 07:21:35 +0000 (08:21 +0100)
committerZorro Lang <zlang@kernel.org>
Fri, 28 Mar 2025 01:05:05 +0000 (09:05 +0800)
Looking at the max_open_zones sysfs attribute to see if a file system is
zoned or not, as various tests depend on that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/xfs

index 93260fdb4599e2e0f7aae6273f3e00adabc0d216..3663e4cf03bd37e11427ae7745e75a1b09d6ef95 100644 (file)
@@ -2071,6 +2071,33 @@ _scratch_xfs_force_no_metadir()
        fi
 }
 
+# do not run on zoned file systems
+_require_xfs_scratch_non_zoned()
+{
+       if _has_fs_sysfs_attr $SCRATCH_DEV "zoned/max_open_zones"; then
+               _notrun "Not supported on zoned file systems"
+       fi
+}
+
+# only run on zoned file systems
+_require_xfs_scratch_zoned()
+{
+       local attr="zoned/max_open_zones"
+       local min_open_zones=$1
+
+       if ! _has_fs_sysfs_attr $SCRATCH_DEV $attr; then
+               _notrun "Requires zoned file system"
+       fi
+
+       if [ -n "${min_open_zones}" ]; then
+               local has_open_zones=`_get_fs_sysfs_attr $SCRATCH_DEV $attr`
+
+               if [ "${min_open_zones}" -gt "${has_open_zones}" ]; then
+                       _notrun "Requires at least ${min_open_zones} open zones"
+               fi
+       fi
+}
+
 # Decide if a mount filesystem has metadata directory trees.
 _xfs_mount_has_metadir() {
        local mount="$1"