Linux block layer
 help / color / mirror / Atom feed
From: alan.adamson@oracle.com
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	linux-block@vger.kernel.org
Cc: John Garry <john.g.garry@oracle.com>
Subject: Re: [PATCH blktests v3] md/002: add atomic write tests for md/stacked devices
Date: Thu, 10 Jul 2025 10:38:58 -0700	[thread overview]
Message-ID: <1c2ce026-2ba7-417e-bafc-f6bebfd79ad3@oracle.com> (raw)
In-Reply-To: <20250710045537.70498-1-shinichiro.kawasaki@wdc.com>

> +		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



  reply	other threads:[~2025-07-10 17:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10  4:55 [PATCH blktests v3] md/002: add atomic write tests for md/stacked devices Shin'ichiro Kawasaki
2025-07-10 17:38 ` alan.adamson [this message]
2025-07-11  9:57   ` Shinichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c2ce026-2ba7-417e-bafc-f6bebfd79ad3@oracle.com \
    --to=alan.adamson@oracle.com \
    --cc=john.g.garry@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox