]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common: cleanup scratch_mkfs_sized
authorChristoph Hellwig <hch@lst.de>
Tue, 10 Dec 2024 06:54:35 +0000 (07:54 +0100)
committerZorro Lang <zlang@kernel.org>
Sun, 22 Dec 2024 14:09:46 +0000 (22:09 +0800)
Move the XFS RT specific code into the file system type switch
statement.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc

index 765b9b3f0a6798ce45a2534fb41fc59424eab38f..796d98e5cada6bbda789e158595adfc723886fd1 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1152,7 +1152,6 @@ _try_scratch_mkfs_sized()
        shift
        local def_blksz
        local blocksize_opt
-       local rt_ops
 
        case $FSTYP in
        xfs)
@@ -1202,14 +1201,18 @@ _try_scratch_mkfs_sized()
                [ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
        fi
 
-       if [ "$FSTYP" = "xfs" ] && [ -b "$SCRATCH_RTDEV" ]; then
-               local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
-               [ "$fssize" -gt "$rtdevsize" ] && _notrun "Scratch rt device too small"
-               rt_ops="-r size=$fssize"
-       fi
-
        case $FSTYP in
        xfs)
+               local rt_ops
+
+               if [ -b "$SCRATCH_RTDEV" ]; then
+                       local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
+                       if [ "$fssize" -gt "$rtdevsize" ]; then
+                               _notrun "Scratch rt device too small"
+                       fi
+                       rt_ops="-r size=$fssize"
+               fi
+
                # don't override MKFS_OPTIONS that set a block size.
                echo $MKFS_OPTIONS |grep -E -q "b\s*size="
                if [ $? -eq 0 ]; then