diff mbox series

[1/5] common/dmdelay: remove DELAY_X enums

Message ID 20231207072056.14588-2-ddiss@suse.de (mailing list archive)
State New, archived
Headers show
Series btrfs/282: resolve intermittent failures | expand

Commit Message

David Disseldorp Dec. 7, 2023, 7:20 a.m. UTC
The DELAY_NONE and DELAY_READ enums map directly to DELAY_TABLE globals,
so remove the indirection and use the DELAY_TABLE variables instead.
Rename DELAY_TABLE to DELAY_TABLE_NODELAY to better reflect that the
table doesn't specify any IO delays.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 common/dmdelay | 13 ++++---------
 tests/xfs/311  |  2 +-
 2 files changed, 5 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/common/dmdelay b/common/dmdelay
index 66cac1a7..e85d8d62 100644
--- a/common/dmdelay
+++ b/common/dmdelay
@@ -4,16 +4,13 @@ 
 #
 # common functions for setting up and tearing down a dmdelay device
 
-DELAY_NONE=0
-DELAY_READ=1
-
 _init_delay()
 {
 	local BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
 	DELAY_DEV=/dev/mapper/delay-test
-	DELAY_TABLE="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 0"
+	DELAY_TABLE_NODELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 0"
 	DELAY_TABLE_RDELAY="0 $BLK_DEV_SIZE delay $SCRATCH_DEV 0 10000 $SCRATCH_DEV 0 0"
-	_dmsetup_create delay-test --table "$DELAY_TABLE" || \
+	_dmsetup_create delay-test --table "$DELAY_TABLE_NODELAY" || \
 		_fatal "failed to create delay device"
 }
 
@@ -44,10 +41,8 @@  _cleanup_delay()
 # table
 _load_delay_table()
 {
-	table="$DELAY_TABLE"
-	[ $1 -eq $DELAY_READ ] && table="$DELAY_TABLE_RDELAY"
-
-	suspend_opt="--nolockfs"
+	local table="$1"
+	local suspend_opt="--nolockfs"
 	[ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt=""
 
 	# run a suspend/resume cycle to avoid excessive resume delays once a
diff --git a/tests/xfs/311 b/tests/xfs/311
index d5e3afbf..04161750 100755
--- a/tests/xfs/311
+++ b/tests/xfs/311
@@ -50,7 +50,7 @@  _unmount_delay
 _mount_delay
 
 # introduce a read I/O delay
-_load_delay_table $DELAY_READ
+_load_delay_table "$DELAY_TABLE_RDELAY"
 
 # Map the directory and immediately unmount. This should invoke an asynchronous
 # readahead on the first block of the directory. The readahead is delayed by