Thread (4 messages) 4 messages, 1 author, 2021-10-21
STALE1731d REVIEWED: 2 (2M)
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 1/3] common/btrfs: add _require_btrfs_sysfs_fsid helper

From: Anand Jain <hidden>
Date: 2021-10-21 09:17:36
Also in: fstests
Subsystem: the rest · Maintainer: Linus Torvalds

It checks if the kernel has the following patch
 btrfs: sysfs add devinfo/fsid to retrieve fsid from the device
that added sysfs interface to get fsid.

Signed-off-by: Anand Jain <redacted>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
---
 common/btrfs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/common/btrfs b/common/btrfs
index ac880bddf524..5d938c19b56a 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -445,3 +445,17 @@ _scratch_btrfs_is_zoned()
 	[ `_zone_type ${SCRATCH_DEV}` != "none" ] && return 0
 	return 1
 }
+
+_require_btrfs_sysfs_fsid()
+{
+	local fsid
+
+	fsid=$($BTRFS_UTIL_PROG filesystem show $TEST_DIR |grep uuid: |\
+	       awk '{print $NF}')
+
+	# Check if the kernel has sysfs fsid support.
+	# Following kernel patch adds it:
+	#   btrfs: sysfs add devinfo/fsid to retrieve fsid from the device
+	test -f /sys/fs/btrfs/$fsid/devinfo/1/fsid ||\
+		_notrun "Need btrfs sysfs fsid support"
+}
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help