1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-11 09:18:25 +03:00

Fix topology test.

Kernel version is misparsed in Fedora rawhide, just test sysfs file.

SCSI_DEBUG_DEV is no longer exported, use provided file instead.
This commit is contained in:
Milan Broz 2011-06-09 14:26:47 +00:00
parent fab0de8998
commit 81594343d3

View File

@ -10,22 +10,16 @@
which mkfs.ext3 || exit 200
# Get linux minor version
linux_minor=$(echo `uname -r` | cut -d'.' -f3 | cut -d'-' -f1)
test $linux_minor -ge 31 || exit 200
. lib/test
check_logical_block_size()
{
local DEV_=$1
local LOGICAL_BS=$2
local DEV_=$(cat SCSI_DEBUG_DEV)
# Verify logical_block_size - requires Linux >= 2.6.31
SYSFS_LOGICAL_BLOCK_SIZE=`echo /sys/block/$(basename $DEV_)/queue/logical_block_size`
if [ -f "$SYSFS_LOGICAL_BLOCK_SIZE" ] ; then
ACTUAL_LOGICAL_BLOCK_SIZE=`cat $SYSFS_LOGICAL_BLOCK_SIZE`
test $ACTUAL_LOGICAL_BLOCK_SIZE = $LOGICAL_BS
test $ACTUAL_LOGICAL_BLOCK_SIZE = $1
fi
}
@ -60,13 +54,21 @@ NUM_DEVS=1
PER_DEV_SIZE=34
DEV_SIZE=$(($NUM_DEVS*$PER_DEV_SIZE))
# Test that kernel supports topology
aux prepare_scsi_debug_dev $DEV_SIZE
if [ ! -e /sys/block/$(basename $(cat SCSI_DEBUG_DEV))/alignment_offset ] ; then
aux cleanup_scsi_debug_dev
exit 200
fi
aux cleanup_scsi_debug_dev
# ---------------------------------------------
# Create "desktop-class" 4K drive
# (logical_block_size=512, physical_block_size=4096, alignment_offset=0):
LOGICAL_BLOCK_SIZE=512
aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE physblk_exp=3
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
check_logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate -c n $vg $(cat DEVICES)
@ -81,7 +83,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_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
check_logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate -c n $vg $(cat DEVICES)
@ -96,7 +98,7 @@ aux cleanup_scsi_debug_dev
LOGICAL_BLOCK_SIZE=4096
aux prepare_scsi_debug_dev $DEV_SIZE \
sector_size=$LOGICAL_BLOCK_SIZE
check_logical_block_size $SCSI_DEBUG_DEV $LOGICAL_BLOCK_SIZE
check_logical_block_size $LOGICAL_BLOCK_SIZE
aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate -c n $vg $(cat DEVICES)