Turn the logic figuring out on which block device the rt data is stored on
into a common helper.
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
$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()
{
_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