[PATCH 10/17] xfs: add helpers to require zoned/non-zoned file systems

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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@xxxxxx>
---
 common/xfs | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/common/xfs b/common/xfs
index 807454d3e03b..86953b7310d9 100644
--- a/common/xfs
+++ b/common/xfs
@@ -2076,6 +2076,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"
-- 
2.45.2





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux