Skip to contentSkip to conversation

common: fix rt_ops setup in _scratch_mkfs_sized

PATCH In review [email protected] 2 participants 2 messages Sep 8, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: fix rt_ops setup in _scratch_mkfs_sized

From: Carlos Maiolino <[email protected]>

Tests using _scratch_mkfs_sized() will fail if SCRATCH_RTDEV is set, but, USE_EXTERNAL is not, this happens because the function pass "-r size=$fssize" to the _scratch_mkfs_xfs argument line, which in turn will not set rtdev because USE_EXTERNAL is not set.

Tests like xfs/015 will fail as:

xfs/015 6s ... [failed, exit status 1]- output mismatch .
.
+size specified for non-existent rt subvolume +Usage: mkfs.xfs
.
.

with this patch the test runs properly using the rtdev if USE_EXTERNAL is set.

---

Particularly I think SCRATCH_RTDEV should not depend on USE_EXTERNAL, as the latter is also linked to external logdevs, but I noticed tests specific for RT devices also set USE_EXTERNAL, so I opted to change it according to the current usage

 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index 1618ded5..20608fbe 100644
@@ -965,7 +965,7 @@ _scratch_mkfs_sized()
 		[ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
 	fi
 
-	if [ "$FSTYP" = "xfs" ] && [ -b "$SCRATCH_RTDEV" ]; then
+	if [ "$FSTYP" = "xfs" ] && [ "$USE_EXTERNAL" = yes -a -b "$SCRATCH_RTDEV" ]; then
 		local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
 		[ "$fssize" -gt "$rtdevsize" ] && _notrun "Scratch rt device too small"
 		rt_ops="-r size=$fssize"
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 20 lines · On Fri, Sep 08, 2023 at 02:12:34PM +0200, [email protected] wrote:

From: Carlos Maiolino <[email protected]>

Tests using _scratch_mkfs_sized() will fail if SCRATCH_RTDEV is set, but, USE_EXTERNAL is not, this happens because the function pass "-r size=$fssize" to the _scratch_mkfs_xfs argument line, which in turn will not set rtdev because USE_EXTERNAL is not set.

Tests like xfs/015 will fail as:

xfs/015 6s ... [failed, exit status 1]- output mismatch .
.
+size specified for non-existent rt subvolume +Usage: mkfs.xfs
.
.

with this patch the test runs properly using the rtdev if USE_EXTERNAL is set.

Quoted 7 lines

---

Particularly I think SCRATCH_RTDEV should not depend on USE_EXTERNAL, as the latter is also linked to external logdevs, but I noticed tests specific for RT devices also set USE_EXTERNAL, so I opted to change it according to the current usage

According to the fstests/README:

Extra SCRATCH device specifications:
- Set SCRATCH_LOGDEV to "device for scratch-fs external log"
- Set SCRATCH_RTDEV to "device for scratch-fs realtime data"
- If SCRATCH_LOGDEV and/or SCRATCH_RTDEV, the USE_EXTERNAL environment

So the USE_EXTERNAL should work with SCRATCH_RTDEV too. So this patch looks good to me,

Quoted 20 lines
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index 1618ded5..20608fbe 100644
@@ -965,7 +965,7 @@ _scratch_mkfs_sized()
 		[ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
 	fi
 
-	if [ "$FSTYP" = "xfs" ] && [ -b "$SCRATCH_RTDEV" ]; then
+	if [ "$FSTYP" = "xfs" ] && [ "$USE_EXTERNAL" = yes -a -b "$SCRATCH_RTDEV" ]; then
 		local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
 		[ "$fssize" -gt "$rtdevsize" ] && _notrun "Scratch rt device too small"
 		rt_ops="-r size=$fssize"
Signature · 1 line
2.39.2