mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
tests: simplify check sysfs_queue
Pass just device name and let figure out sysfs path inside the function.
This commit is contained in:
parent
a701d337d4
commit
308f9bcc18
@ -366,11 +366,13 @@ dev_md5sum() {
|
||||
}
|
||||
|
||||
sysfs_queue() {
|
||||
# Verify optimal_io_size
|
||||
local P="/sys/block/$1/queue/$2"
|
||||
test -f "$P" || return 0
|
||||
test "$(< $P)" -eq "$3" || \
|
||||
die "$P = $(< $P) differs from expected value $3!"
|
||||
# read maj min and also convert hex to decimal
|
||||
local maj=$(($(stat -L --printf=0x%t "$1")))
|
||||
local min=$(($(stat -L --printf=0x%T "$1")))
|
||||
local P="/sys/dev/block/$maj:$min/queue/$2"
|
||||
local val=$(< "$P") || return 0 # no sysfs ?
|
||||
test "$val" -eq "$3" || \
|
||||
die "$1: $P = $val differs from expected value $3!"
|
||||
}
|
||||
|
||||
#set -x
|
||||
|
@ -25,13 +25,12 @@ aux prepare_profiles "thin-performance"
|
||||
# Create scsi debug dev with sector size of 4096B and 1MiB optimal_io_size
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE sector_size=4096 opt_blks=256 || skip
|
||||
EXPECT=1048576
|
||||
check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" optimal_io_size "$EXPECT"
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" optimal_io_size "$EXPECT"
|
||||
aux prepare_pvs 1 $DEV_SIZE
|
||||
|
||||
# Check we are not running on buggy kernel (broken lcm())
|
||||
# If so, turn chunk_size test into 'should'
|
||||
MINOR=$(stat -c %T "$dev1")
|
||||
check sysfs_queue "dm-$MINOR" optimal_io_size "$EXPECT" || SHOULD=should
|
||||
check sysfs_queue "$dev1" optimal_io_size "$EXPECT" || SHOULD=should
|
||||
|
||||
vgcreate $vg "$dev1"
|
||||
|
||||
|
@ -56,8 +56,7 @@ aux cleanup_scsi_debug_dev
|
||||
LOGICAL_BLOCK_SIZE=512
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
|
||||
check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
get_devs
|
||||
|
||||
@ -73,7 +72,7 @@ aux cleanup_scsi_debug_dev
|
||||
LOGICAL_BLOCK_SIZE=512
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3 lowest_aligned=7
|
||||
check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
vgcreate $vg "${DEVICES[@]}"
|
||||
@ -88,7 +87,7 @@ aux cleanup_scsi_debug_dev
|
||||
LOGICAL_BLOCK_SIZE=4096
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE
|
||||
check sysfs_queue "$(basename $(< SCSI_DEBUG_DEV))" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
|
||||
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
|
||||
vgcreate $vg "${DEVICES[@]}"
|
||||
@ -105,16 +104,14 @@ LOGICAL_BLOCK_SIZE=512
|
||||
aux prepare_scsi_debug_dev $DEV_SIZE \
|
||||
sector_size=$LOGICAL_BLOCK_SIZE opt_blks=1536
|
||||
|
||||
TDEV="$(basename $(< SCSI_DEBUG_DEV))"
|
||||
check sysfs_queue "$TDEV" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs_queue "$TDEV" optimal_io_size 786432
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" logical_block_size $LOGICAL_BLOCK_SIZE
|
||||
check sysfs_queue "$(< SCSI_DEBUG_DEV)" optimal_io_size 786432
|
||||
|
||||
aux prepare_pvs 1 $PER_DEV_SIZE
|
||||
|
||||
# Kernel (3.19) could provide wrong results - in this case skip
|
||||
# test with incorrect result - lvm2 can't figure out good values.
|
||||
MINOR=$(stat -c %T "$dev1")
|
||||
check sysfs_queue "dm-$MINOR" optimal_io_size 786432 || SHOULD=should
|
||||
check sysfs_queue "$dev1" optimal_io_size 786432 || SHOULD=should
|
||||
$SHOULD check pv_field "${DEVICES[@]}" pe_start 768.00k
|
||||
|
||||
aux cleanup_scsi_debug_dev
|
||||
|
Loading…
Reference in New Issue
Block a user