@@ -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
@@ -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
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(-)