Update tests and add linear-add

Update the testing scripts to allow for new space calculations
for space for bitmaps.
Add a test script for adding devices to linear arrays.
This commit is contained in:
Neil Brown 2007-05-21 14:25:40 +10:00
parent f752781f81
commit 69646c1483
7 changed files with 36 additions and 9 deletions

View File

@ -809,6 +809,7 @@ static unsigned long choose_bm_space(unsigned long devsize)
/* if the device is bigger than 8Gig, save 64k for bitmap usage,
* if bigger than 200Gig, save 128k
*/
if (devsize < 64*2) return 0;
if (devsize - 64*2 >= 200*1024*1024*2)
return 128*2;
if (devsize - 4*2 > 8*1024*1024*2)

8
test
View File

@ -26,10 +26,14 @@ md0=/dev/md0 md1=/dev/md1 md2=/dev/md2
# dir for storing files should be settable by command line maybe
targetdir=/var/tmp
size=20000
# super0, round down to multiple of 64 and substract 64
mdsize0=19904
# super1.0 round down to multiple of 2, subtract 8
mdsize1=19992
mdsize11=19996
mdsize12=19992
# subtract another 4 for bitmaps
mdsize1b=19988
mdsize11=19992
mdsize12=19988
cleanup() {
$mdadm -Ss

View File

@ -13,7 +13,7 @@ mdadm -S $md0
mdadm -CR $md0 -e1 --level=raid1 -n3 -x2 $dev0 missing missing $dev1 $dev2
check recovery
check raid1
testdev $md0 1 $mdsize1 1
testdev $md0 1 $mdsize1b 1
mdadm -S $md0
# now with no superblock

View File

@ -0,0 +1,22 @@
# create a liner array, and add more drives to to.
for e in 0.90 1 1.1 1.2
do
case $e in
0.90 ) sz=$mdsize0 ;;
1 ) sz=$mdsize1 ;;
1.1 ) sz=$mdsize11 ;;
1.2 ) sz=$mdsize12 ;;
esac
mdadm -CRf $md0 --level linear -e $e --raid-disks=1 $dev1
testdev $md0 1 $sz 64
mdadm --grow $md0 --add $dev2
testdev $md0 2 $sz 64
mdadm --grow $md0 --add $dev3
testdev $md0 3 $sz 64
mdadm -S $md0
done

View File

@ -27,7 +27,7 @@ testdev $md0 1 $[size/2] 1
mdadm --grow $md0 --size max
check resync
check wait
testdev $md0 1 $[size-4] 1
testdev $md0 1 $mdsize11 1
mdadm --grow $md0 --size $[size/2]
check nosync

View File

@ -4,7 +4,7 @@
#
mdadm --create --run $md0 -e1 -l 1 -n 2 $dev1 $dev2
check wait
testdev $md0 1 $mdsize1 1
testdev $md0 1 $mdsize1b 1
#mdadm -E $dev1
mdadm --grow $md0 --bitmap=internal --delay=1
@ -12,7 +12,7 @@ dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
testdev $md0 1 $mdsize1 1
testdev $md0 1 $mdsize1b 1
dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
dirty4=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`

View File

@ -5,11 +5,11 @@
mdadm --create --run $md0 --metadata=1.0 --level=1 -n2 --delay=1 --bitmap internal $dev1 $dev2
check wait
check bitmap
testdev $md0 1 $mdsize1 1
testdev $md0 1 $mdsize1b 1
mdadm -S $md0
mdadm --assemble $md0 $dev1 $dev2
testdev $md0 1 $mdsize1 1
testdev $md0 1 $mdsize1b 1
dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
sleep 4
dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
@ -19,7 +19,7 @@ then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2"
exit 1
fi
mdadm $md0 -f $dev1
testdev $md0 1 $mdsize1 1
testdev $md0 1 $mdsize1b 1
sleep 4
dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty3 -lt 400 ]