From: Nirjhar Roy <nirjhar@linux.ibm.com>
To: fstests@vger.kernel.org
Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,
ritesh.list@gmail.com, ojaswin@linux.ibm.com, djwong@kernel.org,
zlang@kernel.org, nirjhar@linux.ibm.com
Subject: [PATCH v4 1/3] common/rc,xfs/207: Add a common helper function to check xflag bits
Date: Tue, 26 Nov 2024 11:24:06 +0530 [thread overview]
Message-ID: <31b0c72649ec4308aa4e8981ac416addae4e1fdb.1732599868.git.nirjhar@linux.ibm.com> (raw)
In-Reply-To: <cover.1732599868.git.nirjhar@linux.ibm.com>
This patch defines a common helper function to test whether any of
fsxattr xflags field is set or not. We will use this helper in
an upcoming patch for checking extsize (e) flag.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Signed-off-by: Nirjhar Roy <nirjhar@linux.ibm.com>
---
common/rc | 7 +++++++
tests/xfs/207 | 15 ++++-----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/common/rc b/common/rc
index 2ee46e51..f94bee5e 100644
--- a/common/rc
+++ b/common/rc
@@ -41,6 +41,13 @@ _md5_checksum()
md5sum $1 | cut -d ' ' -f1
}
+# Check whether a fsxattr xflags name ($2) field is set on a given file ($1).
+# e.g, fsxattr.xflags = 0x80000800 [extsize, has-xattr]
+_test_fsxattr_xflag()
+{
+ grep -q "fsxattr.xflags.*\[.*$2.*\]" <($XFS_IO_PROG -c "stat -v" "$1")
+}
+
# Write a byte into a range of a file
_pwrite_byte() {
local pattern="$1"
diff --git a/tests/xfs/207 b/tests/xfs/207
index bbe21307..394e7e55 100755
--- a/tests/xfs/207
+++ b/tests/xfs/207
@@ -21,15 +21,6 @@ _require_cp_reflink
_require_xfs_io_command "fiemap"
_require_xfs_io_command "cowextsize"
-# Takes the fsxattr.xflags line,
-# i.e. fsxattr.xflags = 0x0 [--------------C-]
-# and tests whether a flag character is set
-test_xflag()
-{
- local flg=$1
- grep -q "\[.*${flg}.*\]" && echo "$flg flag set" || echo "$flg flag unset"
-}
-
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
_scratch_mount >> $seqres.full 2>&1
@@ -65,14 +56,16 @@ echo "Set cowextsize and check flag"
$XFS_IO_PROG -c "cowextsize 1048576" $testdir/file3 | _filter_scratch
_scratch_cycle_mount
-$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
+_test_fsxattr_xflag "$testdir/file3" "cowextsize" && echo "C flag set" || \
+ echo "C flag unset"
$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
echo "Unset cowextsize and check flag"
$XFS_IO_PROG -c "cowextsize 0" $testdir/file3 | _filter_scratch
_scratch_cycle_mount
-$XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags' | test_xflag "C"
+_test_fsxattr_xflag "$testdir/file3" "cowextsize" && echo "C flag set" || \
+ echo "C flag unset"
$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
status=0
--
2.43.5
next prev parent reply other threads:[~2024-11-26 5:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-26 5:54 [PATCH v4 0/3] Addition of new tests for extsize hints Nirjhar Roy
2024-11-26 5:54 ` Nirjhar Roy [this message]
2024-11-26 6:27 ` [PATCH v4 1/3] common/rc,xfs/207: Add a common helper function to check xflag bits Christoph Hellwig
2024-11-27 4:09 ` Nirjhar Roy
2024-11-26 5:54 ` [PATCH v4 2/3] common/rc: Add a new _require_scratch_extsize helper function Nirjhar Roy
2024-11-26 6:27 ` Christoph Hellwig
2024-11-27 4:10 ` Nirjhar Roy
2024-11-27 0:54 ` Darrick J. Wong
2024-11-27 4:10 ` Nirjhar Roy
2024-11-26 5:54 ` [PATCH v4 3/3] generic: Addition of new tests for extsize hints Nirjhar Roy
2024-11-26 6:28 ` Christoph Hellwig
2024-11-27 4:10 ` Nirjhar Roy
2024-11-27 0:55 ` Darrick J. Wong
2024-11-27 4:11 ` Nirjhar Roy
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=31b0c72649ec4308aa4e8981ac416addae4e1fdb.1732599868.git.nirjhar@linux.ibm.com \
--to=nirjhar@linux.ibm.com \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=zlang@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