On 7/8/25 7:36 AM, John Garry wrote:
Just a small comment, but regardless of that.
Reviewed-by: John Garry <john.g.garry@xxxxxxxxxx>
+
+ 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
sysfs_atomic_unit_max_bytes <= chunk size "
+ if [ "$md_chunk_size" -le
"$md_sysfs_atomic_unit_max_bytes" ]
you should also test that md_sysfs_atomic_unit_max_bytes is evenly
divisible into md_chunk_size
We could do:
diff --git a/tests/md/002 b/tests/md/002
index e586daf..215d672 100755
--- a/tests/md/002
+++ b/tests/md/002
@@ -226,8 +226,10 @@ 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)
- test_desc="TEST 12 RAID $raid_level - Verify
sysfs_atomic_unit_max_bytes <= chunk size "
- if [ "$md_chunk_size" -le
"$md_sysfs_atomic_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
diff --git a/tests/md/002.out b/tests/md/002.out
index 61fb265..6b0a431 100644
--- a/tests/md/002.out
+++ b/tests/md/002.out
@@ -12,7 +12,7 @@ TEST 9 RAID 0 - perform a pwritev2 with size of
sysfs_atomic_unit_max_bytes + 51
TEST 10 RAID 0 - perform a pwritev2 with size of
sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should be
succesful - pass
pwrite: Invalid argument
TEST 11 RAID 0 - perform a pwritev2 with a size of
sysfs_atomic_unit_min_bytes - 512 bytes with RWF_ATOMIC flag - pwritev2
should fail - pass
-TEST 12 RAID 0 - Verify sysfs_atomic_unit_max_bytes <= chunk size - pass
+TEST 12 RAID 0 - Verify chunk size - pass
TEST 1 RAID 1 - Verify md sysfs atomic attributes matches scsi - pass
TEST 2 RAID 1 - Verify sysfs atomic attributes - pass
TEST 3 RAID 1 - Verify md sysfs_atomic_max_bytes is less than or equal
scsi sysfs_atomic_max_bytes - pass
@@ -39,5 +39,5 @@ TEST 9 RAID 10 - perform a pwritev2 with size of
sysfs_atomic_unit_max_bytes + 5
TEST 10 RAID 10 - perform a pwritev2 with size of
sysfs_atomic_unit_min_bytes with RWF_ATOMIC flag - pwritev2 should be
succesful - pass
pwrite: Invalid argument
TEST 11 RAID 10 - perform a pwritev2 with a size of
sysfs_atomic_unit_min_bytes - 512 bytes with RWF_ATOMIC flag - pwritev2
should fail - pass
-TEST 12 RAID 10 - Verify sysfs_atomic_unit_max_bytes <= chunk size - pass
+TEST 12 RAID 10 - Verify chunk size - pass
Test complete
Alan