Skip to contentSkip to conversation

tests: _fail on _scratch_mkfs_sized failure

PATCH In review David Disseldorp 3 participants 4 messages Apr 29, 2024 – Apr 30, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 tests: _fail on _scratch_mkfs_sized failure

If _scratch_mkfs_sized() fails, e.g. due to an FS not supporting the provided size, tests may subsequently mount and run atop a previously created (e.g. non-size-bound) filesystem.
This can lead to difficult to debug failures, or for some -ENOSPC exercising tests, near infinite runtimes. Avoid this by renaming the current function to _try_scratch_mkfs_sized() and _fail in the parent _scratch_mkfs_sized() wrapper.

---
Changes since v2:
- drop existing test-specific _scratch_mkfs_sized() error handlers Changes since v1:
- call _fail in a wrapper function, instead of adding failure handlers to individual test _scratch_mkfs_sized() callers.

 common/rc         | 9 +++++++--
 tests/btrfs/004   | 3 +--
 tests/btrfs/007   | 3 +--
 tests/ext4/021    | 2 +-
 tests/ext4/059    | 2 +-
 tests/generic/015 | 3 +--
 tests/generic/077 | 2 +-
 tests/generic/083 | 3 +--
 tests/generic/171 | 2 +-
 tests/generic/172 | 2 +-
 tests/generic/173 | 2 +-
 tests/generic/174 | 2 +-
 tests/generic/735 | 2 +-
 tests/xfs/015     | 2 +-
 tests/xfs/057     | 3 +--
 15 files changed, 21 insertions(+), 21 deletions(-)
common/rc +7 -2
index 56f1afb6..c3def066 100644
@@ -968,8 +968,8 @@ _small_fs_size_mb()
 }
 
 # Create fs of certain size on scratch device
-# _scratch_mkfs_sized <size in bytes> [optional blocksize]
-_scratch_mkfs_sized()
+# _try_scratch_mkfs_sized <size in bytes> [optional blocksize]
+_try_scratch_mkfs_sized()
 {
 	local fssize=$1
 	local blocksize=$2
@@ -1111,6 +1111,11 @@ _scratch_mkfs_sized()
 	esac
 }
 
+_scratch_mkfs_sized()
+{
+	_try_scratch_mkfs_sized $* || _fail "_scratch_mkfs_sized (size=${1}) failed"
+}
+
 # Emulate an N-data-disk stripe w/ various stripe units
 # _scratch_mkfs_geom <sunit bytes> <swidth multiplier> [optional blocksize]
 _scratch_mkfs_geom()
tests/btrfs/004 +1 -2
index 00a516c3..684f5fdf 100755
@@ -157,8 +157,7 @@ workout()
 	_scratch_unmount >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz"    >>$seqres.full
 	echo ""                                     >>$seqres.full
-	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-		|| _fail "size=$fsz mkfs failed"
+	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	_scratch_mount
 	# -w ensures that the only ops are ones which cause write I/O
 	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \
tests/btrfs/007 +1 -2
index 333524e2..a3a5b185 100755
@@ -43,8 +43,7 @@ workout()
 	_scratch_unmount >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz"    >>$seqres.full
 	echo ""                                     >>$seqres.full
-	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-		|| _fail "size=$fsz mkfs failed"
+	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	_scratch_mount "-o noatime"
 
 	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
tests/ext4/021 +1 -1
index a9277abf..62768c60 100755
@@ -24,7 +24,7 @@ _scratch_unmount
 
 # With 4k block size, this amounts to 10M FS instance.
 fssize=$((2560 * $blocksize))
-_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fssize >> $seqres.full 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 
 offset=0
tests/ext4/059 +1 -1
index 4230bde9..f4864ffc 100755
@@ -23,7 +23,7 @@ _require_scratch_size_nocheck $((1024 * 1024))
 # Initalize a 512M ext4 fs with resize_inode feature disabled
 dev_size=$((512 * 1024 * 1024))
 MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \
-	>>$seqres.full 2>&1 || _fail "mkfs failed"
+	>>$seqres.full 2>&1
 
 # Force some reserved GDT blocks to trigger the bug
 $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \
tests/generic/015 +1 -2
index 10423a29..716a7b1f 100755
@@ -31,8 +31,7 @@ _require_no_large_scratch_dev
 
 # btrfs needs at least 256MB (with upward round off) to create a non-mixed mode
 # fs. Ref: btrfs-progs: btrfs_min_dev_size()
-_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1 \
-    || _fail "mkfs failed"
+_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1
 _scratch_mount
 out=$SCRATCH_MNT/fillup.$$
 
tests/generic/077 +1 -1
index 94d89fae..2624e88f 100755
@@ -50,7 +50,7 @@ _scratch_unmount >/dev/null 2>&1
 echo "*** MKFS ***"                         >>$seqres.full
 echo ""                                     >>$seqres.full
 fs_size=$((256 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount
 mkdir $SCRATCH_MNT/subdir
 
tests/generic/083 +1 -2
index 2a5af3cc..4cd1c399 100755
@@ -50,8 +50,7 @@ workout()
 		_scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seqres.full 2>&1 \
 			|| _fail "size=$fsz,agcount=$ags mkfs failed"
 	else
-		_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-			|| _fail "size=$fsz mkfs failed"
+		_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	fi
 	_scratch_mount
 
tests/generic/171 +1 -1
index f823a454..fb2a6f14 100755
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/172 +1 -1
index 383824b9..ab5122fa 100755
@@ -40,7 +40,7 @@ umount $SCRATCH_MNT
 
 file_size=$((768 * 1024 * 1024))
 fs_size=$((1024 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/173 +1 -1
index e1493278..0eb313e2 100755
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/174 +1 -1
index c7a177b8..1505453e 100755
@@ -43,7 +43,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/735 +1 -1
index 0ba111a6..89107a61 100755
@@ -25,7 +25,7 @@ _require_xfs_io_command "falloc"
 _require_xfs_io_command "finsert"
 
 dev_size=$((80 * 1024 * 1024))
-_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1
 
 _scratch_mount
 _require_congruent_file_oplen $SCRATCH_MNT 1048576	# finsert at 1M
tests/xfs/015 +1 -1
index a7f4d243..3896ce1c 100755
@@ -43,7 +43,7 @@ _scratch_mount
 _require_fs_space $SCRATCH_MNT 196608
 _scratch_unmount
 
-_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw || _fail "mkfs failed"
+_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw
 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
 # get original data blocks number and agcount
 . $tmp.mkfs
tests/xfs/057 +1 -2
index 6af14c80..0cf16701 100755
@@ -51,8 +51,7 @@ echo "Silence is golden."
 sdev=$(_short_dev $SCRATCH_DEV)
 
 # use a small log fs
-_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1 ||
-		_fail "mkfs failed"
+_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1
 _scratch_mount
 
 # populate the fs with some data and cycle the mount to reset the log head/tail
Signature · 1 line
2.35.3
Reviewed-by on v3 1/1
#1 lore raw
Quoted 50 lines · David Disseldorp

If _scratch_mkfs_sized() fails, e.g. due to an FS not supporting the provided size, tests may subsequently mount and run atop a previously created (e.g. non-size-bound) filesystem.
This can lead to difficult to debug failures, or for some -ENOSPC exercising tests, near infinite runtimes. Avoid this by renaming the current function to _try_scratch_mkfs_sized() and _fail in the parent _scratch_mkfs_sized() wrapper.

---
Changes since v2:
- drop existing test-specific _scratch_mkfs_sized() error handlers Changes since v1:
- call _fail in a wrapper function, instead of adding failure handlers to individual test _scratch_mkfs_sized() callers.

 common/rc         | 9 +++++++--
 tests/btrfs/004   | 3 +--
 tests/btrfs/007   | 3 +--
 tests/ext4/021    | 2 +-
 tests/ext4/059    | 2 +-
 tests/generic/015 | 3 +--
 tests/generic/077 | 2 +-
 tests/generic/083 | 3 +--
 tests/generic/171 | 2 +-
 tests/generic/172 | 2 +-
 tests/generic/173 | 2 +-
 tests/generic/174 | 2 +-
 tests/generic/735 | 2 +-
 tests/xfs/015     | 2 +-
 tests/xfs/057     | 3 +--
 15 files changed, 21 insertions(+), 21 deletions(-)
common/rc +2 -2
index 56f1afb6..c3def066 100644
@@ -968,8 +968,8 @@ _small_fs_size_mb()
 }
 
 # Create fs of certain size on scratch device
-# _scratch_mkfs_sized <size in bytes> [optional blocksize]
-_scratch_mkfs_sized()
+# _try_scratch_mkfs_sized <size in bytes> [optional blocksize]
+_try_scratch_mkfs_sized()
 {
 	local fssize=$1
 	local blocksize=$2

common/rc _scratch_mkfs_sized() · line 1116

Quoted 6 lines
common/rc +3 -0
@@ -1111,6 +1111,11 @@ _scratch_mkfs_sized()
 	esac
 }
 
+_scratch_mkfs_sized()
+{
+	_try_scratch_mkfs_sized $* || _fail "_scratch_mkfs_sized (size=${1}) failed"

I wonder if you ought to dump all the arguments, but the maintainer did say to print the *size*. :)

Either way this looks decent to me so

--D

Quoted 196 lines
common/rc +2 -0
+}
+
 # Emulate an N-data-disk stripe w/ various stripe units
 # _scratch_mkfs_geom <sunit bytes> <swidth multiplier> [optional blocksize]
 _scratch_mkfs_geom()
tests/btrfs/004 +1 -2
index 00a516c3..684f5fdf 100755
@@ -157,8 +157,7 @@ workout()
 	_scratch_unmount >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz"    >>$seqres.full
 	echo ""                                     >>$seqres.full
-	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-		|| _fail "size=$fsz mkfs failed"
+	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	_scratch_mount
 	# -w ensures that the only ops are ones which cause write I/O
 	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \
tests/btrfs/007 +1 -2
index 333524e2..a3a5b185 100755
@@ -43,8 +43,7 @@ workout()
 	_scratch_unmount >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz"    >>$seqres.full
 	echo ""                                     >>$seqres.full
-	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-		|| _fail "size=$fsz mkfs failed"
+	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	_scratch_mount "-o noatime"
 
 	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
tests/ext4/021 +1 -1
index a9277abf..62768c60 100755
@@ -24,7 +24,7 @@ _scratch_unmount
 
 # With 4k block size, this amounts to 10M FS instance.
 fssize=$((2560 * $blocksize))
-_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fssize >> $seqres.full 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 
 offset=0
tests/ext4/059 +1 -1
index 4230bde9..f4864ffc 100755
@@ -23,7 +23,7 @@ _require_scratch_size_nocheck $((1024 * 1024))
 # Initalize a 512M ext4 fs with resize_inode feature disabled
 dev_size=$((512 * 1024 * 1024))
 MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \
-	>>$seqres.full 2>&1 || _fail "mkfs failed"
+	>>$seqres.full 2>&1
 
 # Force some reserved GDT blocks to trigger the bug
 $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \
tests/generic/015 +1 -2
index 10423a29..716a7b1f 100755
@@ -31,8 +31,7 @@ _require_no_large_scratch_dev
 
 # btrfs needs at least 256MB (with upward round off) to create a non-mixed mode
 # fs. Ref: btrfs-progs: btrfs_min_dev_size()
-_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1 \
-    || _fail "mkfs failed"
+_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1
 _scratch_mount
 out=$SCRATCH_MNT/fillup.$$
 
tests/generic/077 +1 -1
index 94d89fae..2624e88f 100755
@@ -50,7 +50,7 @@ _scratch_unmount >/dev/null 2>&1
 echo "*** MKFS ***"                         >>$seqres.full
 echo ""                                     >>$seqres.full
 fs_size=$((256 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount
 mkdir $SCRATCH_MNT/subdir
 
tests/generic/083 +1 -2
index 2a5af3cc..4cd1c399 100755
@@ -50,8 +50,7 @@ workout()
 		_scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seqres.full 2>&1 \
 			|| _fail "size=$fsz,agcount=$ags mkfs failed"
 	else
-		_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-			|| _fail "size=$fsz mkfs failed"
+		_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	fi
 	_scratch_mount
 
tests/generic/171 +1 -1
index f823a454..fb2a6f14 100755
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/172 +1 -1
index 383824b9..ab5122fa 100755
@@ -40,7 +40,7 @@ umount $SCRATCH_MNT
 
 file_size=$((768 * 1024 * 1024))
 fs_size=$((1024 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/173 +1 -1
index e1493278..0eb313e2 100755
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/174 +1 -1
index c7a177b8..1505453e 100755
@@ -43,7 +43,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/735 +1 -1
index 0ba111a6..89107a61 100755
@@ -25,7 +25,7 @@ _require_xfs_io_command "falloc"
 _require_xfs_io_command "finsert"
 
 dev_size=$((80 * 1024 * 1024))
-_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1
 
 _scratch_mount
 _require_congruent_file_oplen $SCRATCH_MNT 1048576	# finsert at 1M
tests/xfs/015 +1 -1
index a7f4d243..3896ce1c 100755
@@ -43,7 +43,7 @@ _scratch_mount
 _require_fs_space $SCRATCH_MNT 196608
 _scratch_unmount
 
-_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw || _fail "mkfs failed"
+_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw
 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
 # get original data blocks number and agcount
 . $tmp.mkfs
tests/xfs/057 +1 -2
index 6af14c80..0cf16701 100755
@@ -51,8 +51,7 @@ echo "Silence is golden."
 sdev=$(_short_dev $SCRATCH_DEV)
 
 # use a small log fs
-_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1 ||
-		_fail "mkfs failed"
+_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1
 _scratch_mount
 
 # populate the fs with some data and cycle the mount to reset the log head/tail
Signature · 1 line
2.35.3
#2 lore raw
Quoted 54 lines · Darrick J. Wong
Quoted 53 lines · David Disseldorp

If _scratch_mkfs_sized() fails, e.g. due to an FS not supporting the provided size, tests may subsequently mount and run atop a previously created (e.g. non-size-bound) filesystem.
This can lead to difficult to debug failures, or for some -ENOSPC exercising tests, near infinite runtimes. Avoid this by renaming the current function to _try_scratch_mkfs_sized() and _fail in the parent _scratch_mkfs_sized() wrapper.

---
Changes since v2:
- drop existing test-specific _scratch_mkfs_sized() error handlers Changes since v1:
- call _fail in a wrapper function, instead of adding failure handlers to individual test _scratch_mkfs_sized() callers.

 common/rc         | 9 +++++++--
 tests/btrfs/004   | 3 +--
 tests/btrfs/007   | 3 +--
 tests/ext4/021    | 2 +-
 tests/ext4/059    | 2 +-
 tests/generic/015 | 3 +--
 tests/generic/077 | 2 +-
 tests/generic/083 | 3 +--
 tests/generic/171 | 2 +-
 tests/generic/172 | 2 +-
 tests/generic/173 | 2 +-
 tests/generic/174 | 2 +-
 tests/generic/735 | 2 +-
 tests/xfs/015     | 2 +-
 tests/xfs/057     | 3 +--
 15 files changed, 21 insertions(+), 21 deletions(-)
common/rc +2 -2
index 56f1afb6..c3def066 100644
@@ -968,8 +968,8 @@ _small_fs_size_mb()
 }
 
 # Create fs of certain size on scratch device
-# _scratch_mkfs_sized <size in bytes> [optional blocksize]
-_scratch_mkfs_sized()
+# _try_scratch_mkfs_sized <size in bytes> [optional blocksize]
+_try_scratch_mkfs_sized()
 {
 	local fssize=$1
 	local blocksize=$2
@@ -1111,6 +1111,11 @@ _scratch_mkfs_sized()
 	esac
 }
 
Quoted 6 lines

common/rc _scratch_mkfs_sized() · line 1116

Quoted 3 lines
common/rc +3 -0
+_scratch_mkfs_sized()
+{
+	_try_scratch_mkfs_sized $* || _fail "_scratch_mkfs_sized (size=${1}) failed"

I wonder if you ought to dump all the arguments, but the maintainer did say to print the *size*. :)

Sorry I didn't say that clearly, I mean the arguments related with size :-D

If both of you don't have more suggestions, I can help to change this line to:

_try_scratch_mkfs_sized $* || \
_fail "_scratch_mkfs_sized failed with ($*)"

when I merge it.

Thanks,
Zorro

Quoted 203 lines

Either way this looks decent to me so

--D

Quoted 196 lines
common/rc +2 -0
+}
+
 # Emulate an N-data-disk stripe w/ various stripe units
 # _scratch_mkfs_geom <sunit bytes> <swidth multiplier> [optional blocksize]
 _scratch_mkfs_geom()
tests/btrfs/004 +1 -2
index 00a516c3..684f5fdf 100755
@@ -157,8 +157,7 @@ workout()
 	_scratch_unmount >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz"    >>$seqres.full
 	echo ""                                     >>$seqres.full
-	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-		|| _fail "size=$fsz mkfs failed"
+	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	_scratch_mount
 	# -w ensures that the only ops are ones which cause write I/O
 	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \
tests/btrfs/007 +1 -2
index 333524e2..a3a5b185 100755
@@ -43,8 +43,7 @@ workout()
 	_scratch_unmount >/dev/null 2>&1
 	echo "*** mkfs -dsize=$fsz"    >>$seqres.full
 	echo ""                                     >>$seqres.full
-	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-		|| _fail "size=$fsz mkfs failed"
+	_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	_scratch_mount "-o noatime"
 
 	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n $ops $FSSTRESS_AVOID -x \
tests/ext4/021 +1 -1
index a9277abf..62768c60 100755
@@ -24,7 +24,7 @@ _scratch_unmount
 
 # With 4k block size, this amounts to 10M FS instance.
 fssize=$((2560 * $blocksize))
-_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fssize >> $seqres.full 2>&1
 _require_metadata_journaling $SCRATCH_DEV
 
 offset=0
tests/ext4/059 +1 -1
index 4230bde9..f4864ffc 100755
@@ -23,7 +23,7 @@ _require_scratch_size_nocheck $((1024 * 1024))
 # Initalize a 512M ext4 fs with resize_inode feature disabled
 dev_size=$((512 * 1024 * 1024))
 MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \
-	>>$seqres.full 2>&1 || _fail "mkfs failed"
+	>>$seqres.full 2>&1
 
 # Force some reserved GDT blocks to trigger the bug
 $DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \
tests/generic/015 +1 -2
index 10423a29..716a7b1f 100755
@@ -31,8 +31,7 @@ _require_no_large_scratch_dev
 
 # btrfs needs at least 256MB (with upward round off) to create a non-mixed mode
 # fs. Ref: btrfs-progs: btrfs_min_dev_size()
-_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1 \
-    || _fail "mkfs failed"
+_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1
 _scratch_mount
 out=$SCRATCH_MNT/fillup.$$
 
tests/generic/077 +1 -1
index 94d89fae..2624e88f 100755
@@ -50,7 +50,7 @@ _scratch_unmount >/dev/null 2>&1
 echo "*** MKFS ***"                         >>$seqres.full
 echo ""                                     >>$seqres.full
 fs_size=$((256 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount
 mkdir $SCRATCH_MNT/subdir
 
tests/generic/083 +1 -2
index 2a5af3cc..4cd1c399 100755
@@ -50,8 +50,7 @@ workout()
 		_scratch_mkfs_xfs -dsize=$fsz,agcount=$ags  >>$seqres.full 2>&1 \
 			|| _fail "size=$fsz,agcount=$ags mkfs failed"
 	else
-		_scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \
-			|| _fail "size=$fsz mkfs failed"
+		_scratch_mkfs_sized $fsz >>$seqres.full 2>&1
 	fi
 	_scratch_mount
 
tests/generic/171 +1 -1
index f823a454..fb2a6f14 100755
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/172 +1 -1
index 383824b9..ab5122fa 100755
@@ -40,7 +40,7 @@ umount $SCRATCH_MNT
 
 file_size=$((768 * 1024 * 1024))
 fs_size=$((1024 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/173 +1 -1
index e1493278..0eb313e2 100755
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/174 +1 -1
index c7a177b8..1505453e 100755
@@ -43,7 +43,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
 if [ $sz_bytes -lt $((32 * 1048576)) ]; then
 	sz_bytes=$((32 * 1048576))
 fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
 _scratch_mount >> $seqres.full 2>&1
 rm -rf $testdir
 mkdir $testdir
tests/generic/735 +1 -1
index 0ba111a6..89107a61 100755
@@ -25,7 +25,7 @@ _require_xfs_io_command "falloc"
 _require_xfs_io_command "finsert"
 
 dev_size=$((80 * 1024 * 1024))
-_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mkfs_sized $dev_size >>$seqres.full 2>&1
 
 _scratch_mount
 _require_congruent_file_oplen $SCRATCH_MNT 1048576	# finsert at 1M
tests/xfs/015 +1 -1
index a7f4d243..3896ce1c 100755
@@ -43,7 +43,7 @@ _scratch_mount
 _require_fs_space $SCRATCH_MNT 196608
 _scratch_unmount
 
-_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw || _fail "mkfs failed"
+_scratch_mkfs_sized $((96 * 1024 * 1024)) > $tmp.mkfs.raw
 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
 # get original data blocks number and agcount
 . $tmp.mkfs
tests/xfs/057 +1 -2
index 6af14c80..0cf16701 100755
@@ -51,8 +51,7 @@ echo "Silence is golden."
 sdev=$(_short_dev $SCRATCH_DEV)
 
 # use a small log fs
-_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1 ||
-		_fail "mkfs failed"
+_scratch_mkfs_sized $((1024 * 1024 * 500)) >> $seqres.full 2>&1
 _scratch_mount
 
 # populate the fs with some data and cycle the mount to reset the log head/tail
Signature · 1 line
2.35.3
#3 lore raw
Quoted 1 line · Zorro Lang

On Mon, Apr 29, 2024 at 09:05:16AM -0700, Darrick J. Wong wrote:

...

Quoted 8 lines
Quoted 6 lines

common/rc _scratch_mkfs_sized() · line 1116

Quoted 3 lines
common/rc +3 -0
+_scratch_mkfs_sized()
+{
+	_try_scratch_mkfs_sized $* || _fail "_scratch_mkfs_sized (size=${1}) failed"  

I wonder if you ought to dump all the arguments, but the maintainer did say to print the *size*. :)

Sorry I didn't say that clearly, I mean the arguments related with size :-D

No worries :) I'm fine with it either way.

Quoted 7 lines

If both of you don't have more suggestions, I can help to change this line to:

_try_scratch_mkfs_sized $* || \
_fail "_scratch_mkfs_sized failed with ($*)"

when I merge it.

Sure, works for me.

Cheers, David