All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, josef@toxicpanda.com
Subject: [PATCH 1/3] common/btrfs: add _require_btrfs_sysfs_fsid helper
Date: Wed, 20 Oct 2021 15:16:42 +0800	[thread overview]
Message-ID: <a256725f520c555f3b6295e09f70ceabddd69288.1634713680.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1634713680.git.anand.jain@oracle.com>

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 <anand.jain@oracle.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.27.0


  reply	other threads:[~2021-10-20  7:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20  7:16 [PATCH 0/3] fstests: btrfs validate sysfs fsid and usage Anand Jain
2021-10-20  7:16 ` Anand Jain [this message]
2021-10-20  7:16 ` [PATCH 2/3] btrfs/248: validate sysfs fsid Anand Jain
2021-10-20  7:16 ` [PATCH 3/3] btrfs/249: test btrfs filesystem usage command on missing seed device Anand Jain
2021-10-20 13:53   ` Josef Bacik
2021-10-20 14:58     ` Anand Jain
2021-10-20 18:44       ` Josef Bacik
2021-10-20 18:45 ` [PATCH 0/3] fstests: btrfs validate sysfs fsid and usage Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a256725f520c555f3b6295e09f70ceabddd69288.1634713680.git.anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.