From e6166e4498d1c278746f3a8811b47806ac3e1e27 Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Sat, 21 Aug 2010 15:43:45 +0000 Subject: [PATCH] Verify that pvcreate --dataalignment really does override the topology detected alignment. NOTE: lvm2 doesn't detect MD 1.2 metadata (now the default on RHEL6) so for now I'm forcing 1.0 metadata. This was needed to be able to reuse the existing loop devices but recreate the md device with different raid0 striping. --- test/t-pvcreate-operation-md.sh | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/test/t-pvcreate-operation-md.sh b/test/t-pvcreate-operation-md.sh index 41e353473..cab63a0a7 100644 --- a/test/t-pvcreate-operation-md.sh +++ b/test/t-pvcreate-operation-md.sh @@ -41,13 +41,17 @@ cleanup_md() { sleep 2 rm -f $mddev fi +} + +cleanup_md_and_teardown() { + cleanup_md teardown } # create 2 disk MD raid0 array (stripe_width=128K) test -b "$mddev" && exit 200 -mdadm --create $mddev --auto=md --level 0 --raid-devices=2 --chunk 64 $dev1 $dev2 -trap 'aux cleanup_md' EXIT # cleanup this MD device at the end of the test +mdadm --create --metadata=1.0 $mddev --auto=md --level 0 --raid-devices=2 --chunk 64 $dev1 $dev2 +trap 'aux cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test test -b "$mddev" || exit 200 # Test alignment of PV on MD without any MD-aware or topology-aware detection @@ -113,3 +117,27 @@ EOF pvremove $mddev_p fi fi + +# Test newer topology-aware alignment detection w/ --dataalignment override +if [ $linux_minor -ge 33 ]; then + cleanup_md + pvcreate -f $dev1 + pvcreate -f $dev2 + + # create 2 disk MD raid0 array (stripe_width=2M) + test -b "$mddev" && exit 200 + mdadm --create --metadata=1.0 $mddev --auto=md --level 0 --raid-devices=2 --chunk 1024 $dev1 $dev2 + test -b "$mddev" || exit 200 + + # optimal_io_size=2097152, minimum_io_size=1048576 + pv_align="2.00m" + pvcreate --metadatasize 128k \ + --config 'devices { md_chunk_alignment=0 }' $mddev + check_pv_field_ $mddev pe_start $pv_align + + # now verify pe_start alignment override using --dataalignment + pv_align="192.00k" + pvcreate --dataalignment 64k --metadatasize 128k \ + --config 'devices { md_chunk_alignment=0 }' $mddev + check_pv_field_ $mddev pe_start $pv_align +fi