+ if [ "$raid_level" = 0 ] || [ "$raid_level" = 10 ]
+ then
+ md_chunk_size=$(( "$scsi_sysfs_atomic_unit_max_bytes" / 2048))
+
+ if [ "$raid_level" = 0 ]
+ then
+ echo y | mdadm --create /dev/md/blktests_md --level=$raid_level \
+ --raid-devices=2 --chunk="${md_chunk_size}"K --force \
+ /dev/"${scsi_0}" /dev/"${scsi_1}" 2> /dev/null 1>&2
+ else
+ echo y | mdadm --create /dev/md/blktests_md --level=$raid_level \
+ --raid-devices=4 --chunk="${md_chunk_size}"K --force \
+ /dev/"${scsi_0}" /dev/"${scsi_1}" \
+ /dev/"${scsi_2}" /dev/"${scsi_3}" 2> /dev/null 1>&2
+ fi
+
+ md_dev=$(readlink /dev/md/blktests_md | sed 's|\.\./||')
+ md_dev_sysfs="/sys/devices/virtual/block/${md_dev}"
+ md_sysfs_atomic_unit_max_bytes=$(< "${md_dev_sysfs}"/queue/atomic_write_unit_max_bytes)
+ test_desc="TEST 12 RAID $raid_level - Verify chunk size "
+ if [ "$md_chunk_size" -le "$md_sysfs_atomic_unit_max_bytes" ] && \
+ (( md_sysfs_atomic_unit_max_bytes % md_chunk_size == 0 ))
+ then
+ echo "$test_desc - pass"
+ else
+ echo "$test_desc - fail $md_chunk_size - $md_sysfs_atomic_unit_max_bytes"
+ fi
+
Oops, md_chunk_size is in kbs. Should be in bytes.
diff --git a/tests/md/002 b/tests/md/002
index 79c0d15..79f260b 100755
--- a/tests/md/002
+++ b/tests/md/002
@@ -29,6 +29,7 @@ test() {
local md_sysfs_max_hw_sectors_kb
local md_max_hw_bytes
local md_chunk_size
+ local md_chunk_size_bytes
local md_sysfs_logical_block_size
local md_sysfs_atomic_max_bytes
local md_sysfs_atomic_unit_max_bytes
@@ -226,13 +227,14 @@ test() {
md_dev=$(readlink /dev/md/blktests_md | sed
's|\.\./||')
md_dev_sysfs="/sys/devices/virtual/block/${md_dev}"
md_sysfs_atomic_unit_max_bytes=$(<
"${md_dev_sysfs}"/queue/atomic_write_unit_max_bytes)
+ md_chunk_size_bytes=$(( "$md_chunk_size" * 1024))
test_desc="TEST 12 RAID $raid_level - Verify
chunk size "
- if [ "$md_chunk_size" -le
"$md_sysfs_atomic_unit_max_bytes" ] && \
- (( md_sysfs_atomic_unit_max_bytes %
md_chunk_size == 0 ))
+ if [ "$md_chunk_size_bytes" -le
"$md_sysfs_atomic_unit_max_bytes" ] && \
+ (( md_sysfs_atomic_unit_max_bytes %
md_chunk_size_bytes == 0 ))
then
echo "$test_desc - pass"
else
- echo "$test_desc - fail $md_chunk_size -
$md_sysfs_atomic_unit_max_bytes"
+ echo "$test_desc - fail
$md_chunk_size_bytes - $md_sysfs_atomic_unit_max_bytes"
fi
mdadm --quiet --stop /dev/md/blktests_md
Alan