From: Chandan Babu R <chandanrlinux@gmail.com>
To: fstests@vger.kernel.org
Cc: Chandan Babu R <chandanrlinux@gmail.com>,
guaneryu@gmail.com, linux-xfs@vger.kernel.org
Subject: [PATCH 2/3] common/xfs: Add helpers to obtain reflink/rmapbt status of a filesystem
Date: Mon, 26 Jul 2021 12:13:12 +0530 [thread overview]
Message-ID: <20210726064313.19153-2-chandanrlinux@gmail.com> (raw)
In-Reply-To: <20210726064313.19153-1-chandanrlinux@gmail.com>
This commit adds helpers to obtain status of reflink and rmapbt features of a
filesystem. The status of these features are obtained by invoking
$XFS_INFO_PROG program.
Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
---
common/xfs | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/common/xfs b/common/xfs
index c5e39427..e9f84b56 100644
--- a/common/xfs
+++ b/common/xfs
@@ -1099,6 +1099,40 @@ _xfs_mount_agcount()
$XFS_INFO_PROG "$1" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g'
}
+# Get reflink status of a filesystem
+_xfs_is_reflink_enabled()
+{
+ local status
+
+ $XFS_INFO_PROG "$1" | grep -q reflink >> $seqres.full
+ [[ $? != 0 ]] && return 1
+
+ status=$($XFS_INFO_PROG "$1" | grep reflink= | \
+ sed -e 's/^.*reflink=\([0-1]\).*$/\1/g')
+ if [[ $status == 1 ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+# Get rmapbt status of a filesystem
+_xfs_is_rmapbt_enabled()
+{
+ local status
+
+ $XFS_INFO_PROG "$1" | grep -q rmapbt >> $seqres.full
+ [[ $? != 0 ]] && return 1
+
+ status=$($XFS_INFO_PROG "$1" | grep rmapbt= | \
+ sed -e 's/^.*rmapbt=\([0-1]\).*$/\1/g')
+ if [[ $status == 1 ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
# Wipe the superblock of each XFS AGs
_try_wipe_scratch_xfs()
{
--
2.30.2
next prev parent reply other threads:[~2021-07-26 6:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 6:43 [PATCH 1/3] xfs/530: Do not pass block size argument to _scratch_mkfs Chandan Babu R
2021-07-26 6:43 ` Chandan Babu R [this message]
2021-07-26 6:43 ` [PATCH 3/3] xfs/530: Bail out if either of reflink or rmapbt is enabled Chandan Babu R
2021-07-26 17:19 ` Darrick J. Wong
2021-07-27 4:45 ` Chandan Babu R
2021-07-27 18:37 ` Darrick J. Wong
2021-07-28 2:35 ` Chandan Babu R
2021-08-01 11:41 ` Eryu Guan
2021-08-01 13:10 ` Eryu Guan
2021-07-26 17:08 ` [PATCH 1/3] xfs/530: Do not pass block size argument to _scratch_mkfs Darrick J. Wong
2021-08-01 11:18 ` Eryu Guan
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=20210726064313.19153-2-chandanrlinux@gmail.com \
--to=chandanrlinux@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=guaneryu@gmail.com \
--cc=linux-xfs@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 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).