Skip to contentSkip to conversation

common: cleanup scratch_mkfs_sized

PATCH In review Christoph Hellwig 2 participants 2 messages Dec 10, 2024 – Dec 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: cleanup scratch_mkfs_sized

Move the XFS RT specific code into the file system type switch statement.

---
 common/rc | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
common/rc +10 -7
index 1b2e4508d767..906905daa92d 100644
@@ -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
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Christoph Hellwig

Move the XFS RT specific code into the file system type switch statement.

Looks good to me,

--D

Quoted 44 lines
---
 common/rc | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
common/rc +10 -7
index 1b2e4508d767..906905daa92d 100644
@@ -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
Signature · 1 line
2.45.2