[PATCH v2 1/2] xfs/647: turn rt dev block device lookup into a common helper

Hans Holmberg <[email protected]>
Newsgroups org.kernel.vger.fstests,org.kernel.vger.linux-xfs
Message-ID <[email protected]>
Turn the logic figuring out on which block device the rt data is stored on
into a common helper.

Signed-off-by: Hans Holmberg <[email protected]>
---
 common/xfs    | 11 +++++++++++
 tests/xfs/647 | 10 +---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/common/xfs b/common/xfs
index 7fa0db2e26b4..c81f939e68d2 100644
--- a/common/xfs
+++ b/common/xfs
@@ -737,6 +737,17 @@ _xfs_metadump_supports_rt()
 	$XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-r rtdev'
 }
 
+# What block device is rt data located on for scratch?
+_xfs_get_scratch_rtdev_bdev()
+{
+	# Is the rt dev internal or not?
+	if [ -z "$SCRATCH_RTDEV" ]; then
+		echo "$SCRATCH_DEV"
+	else
+		echo "$SCRATCH_RTDEV"
+	fi
+}
+
 # Snapshot the metadata on the scratch device
 _scratch_xfs_metadump()
 {
diff --git a/tests/xfs/647 b/tests/xfs/647
index 76959b28c779..0ef340a14b07 100755
--- a/tests/xfs/647
+++ b/tests/xfs/647
@@ -17,15 +17,7 @@ _begin_fstest auto quick zone
 _require_scratch
 _require_realtime
 
-#
-# Figure out if the rt section is internal or not
-#
-if [ -z "$SCRATCH_RTDEV" ]; then
-	zdev=$SCRATCH_DEV
-else
-	zdev=$SCRATCH_RTDEV
-fi
-
+zdev="$(_xfs_get_scratch_rtdev_bdev)"
 _require_zoned_device $zdev
 _require_command "$BLKZONE_PROG" blkzone
 
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.