* [PATCH blktests] dm/002: do not assume 512 byte block size
@ 2024-06-25 2:51 Shin'ichiro Kawasaki
2024-06-25 5:02 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-06-25 2:51 UTC (permalink / raw)
To: linux-block; +Cc: Bryan Gurney, Christoph Hellwig, Shin'ichiro Kawasaki
The test case assumes that TEST_DEV would have 512 byte block size
always. However, TEST_DEV may have non 512 byte, 4k block size. In that
case, the test case fails with I/O errors.
To avoid the errors, refer to the block size of TEST_DEV. Also record
dd command output to the FULL file to help debug work in the future.
Reported-by: Christoph Hellwig <hch@lst.de>
Fixes: 7308e11c595a ("tests/dm: add dm-dust general functionality test")
Link: https://lore.kernel.org/linux-block/ZmqrzUyLcUORPdOe@infradead.org/
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
tests/dm/002 | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tests/dm/002 b/tests/dm/002
index 6635c43..fae3986 100755
--- a/tests/dm/002
+++ b/tests/dm/002
@@ -14,10 +14,12 @@ requires() {
test_device() {
+ local sz bsz
echo "Running ${TEST_NAME}"
- TEST_DEV_SZ=$(blockdev --getsz "$TEST_DEV")
- dmsetup create dust1 --table "0 $TEST_DEV_SZ dust $TEST_DEV 0 512"
+ sz=$(blockdev --getsz "$TEST_DEV")
+ bsz=$(blockdev --getbsz "$TEST_DEV")
+ dmsetup create dust1 --table "0 $sz dust $TEST_DEV 0 $bsz"
dmsetup message dust1 0 addbadblock 60
dmsetup message dust1 0 addbadblock 67
dmsetup message dust1 0 addbadblock 72
@@ -30,7 +32,8 @@ test_device() {
dmsetup message dust1 0 addbadblock 72
dmsetup message dust1 0 countbadblocks
dmsetup message dust1 0 enable
- dd if=/dev/zero of=/dev/mapper/dust1 bs=512 count=128 oflag=direct >/dev/null 2>&1 || return $?
+ dd if=/dev/zero of=/dev/mapper/dust1 bs="$bsz" count=128 oflag=direct \
+ >"$FULL" 2>&1 || return $?
sync
dmsetup message dust1 0 countbadblocks
sync
--
2.45.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH blktests] dm/002: do not assume 512 byte block size
2024-06-25 2:51 [PATCH blktests] dm/002: do not assume 512 byte block size Shin'ichiro Kawasaki
@ 2024-06-25 5:02 ` Christoph Hellwig
2024-06-25 6:01 ` Chaitanya Kulkarni
2024-06-28 10:10 ` Shinichiro Kawasaki
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-06-25 5:02 UTC (permalink / raw)
To: Shin'ichiro Kawasaki; +Cc: linux-block, Bryan Gurney, Christoph Hellwig
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH blktests] dm/002: do not assume 512 byte block size
2024-06-25 2:51 [PATCH blktests] dm/002: do not assume 512 byte block size Shin'ichiro Kawasaki
2024-06-25 5:02 ` Christoph Hellwig
@ 2024-06-25 6:01 ` Chaitanya Kulkarni
2024-06-28 10:10 ` Shinichiro Kawasaki
2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2024-06-25 6:01 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-block@vger.kernel.org
Cc: Bryan Gurney, Christoph Hellwig
On 6/24/24 19:51, Shin'ichiro Kawasaki wrote:
> The test case assumes that TEST_DEV would have 512 byte block size
> always. However, TEST_DEV may have non 512 byte, 4k block size. In that
> case, the test case fails with I/O errors.
>
> To avoid the errors, refer to the block size of TEST_DEV. Also record
> dd command output to the FULL file to help debug work in the future.
>
> Reported-by: Christoph Hellwig <hch@lst.de>
> Fixes: 7308e11c595a ("tests/dm: add dm-dust general functionality test")
> Link: https://lore.kernel.org/linux-block/ZmqrzUyLcUORPdOe@infradead.org/
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>
this patch follows the discussion on the other thread to replace the
hardcoded 512 block size with device's block size with the help of
blockdev --getsz.
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH blktests] dm/002: do not assume 512 byte block size
2024-06-25 2:51 [PATCH blktests] dm/002: do not assume 512 byte block size Shin'ichiro Kawasaki
2024-06-25 5:02 ` Christoph Hellwig
2024-06-25 6:01 ` Chaitanya Kulkarni
@ 2024-06-28 10:10 ` Shinichiro Kawasaki
2 siblings, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2024-06-28 10:10 UTC (permalink / raw)
To: linux-block@vger.kernel.org; +Cc: Bryan Gurney, hch
On Jun 25, 2024 / 11:51, Shin'ichiro Kawasaki wrote:
> The test case assumes that TEST_DEV would have 512 byte block size
> always. However, TEST_DEV may have non 512 byte, 4k block size. In that
> case, the test case fails with I/O errors.
>
> To avoid the errors, refer to the block size of TEST_DEV. Also record
> dd command output to the FULL file to help debug work in the future.
>
> Reported-by: Christoph Hellwig <hch@lst.de>
> Fixes: 7308e11c595a ("tests/dm: add dm-dust general functionality test")
> Link: https://lore.kernel.org/linux-block/ZmqrzUyLcUORPdOe@infradead.org/
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
FYI, this fix has got applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-28 10:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 2:51 [PATCH blktests] dm/002: do not assume 512 byte block size Shin'ichiro Kawasaki
2024-06-25 5:02 ` Christoph Hellwig
2024-06-25 6:01 ` Chaitanya Kulkarni
2024-06-28 10:10 ` Shinichiro Kawasaki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox