From: Zorro Lang Date: Mon, 21 Sep 2015 03:06:17 +0000 (+1000) Subject: xfs/201: use min_dio_alignment size to replace 512b X-Git-Tag: v2022.05.01~2806 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=40390963c91c85e9b23a7972571dfae584628bb2;p=xfstests-dev.git xfs/201: use min_dio_alignment size to replace 512b This case use hard-code 512, but in 4k sector size device, it will fail. So I call _min_dio_alignment() to get the sector size, then replace `512`. Signed-off-by: Zorro Lang Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/tests/xfs/201 b/tests/xfs/201 index 88829d34..921d2a3f 100755 --- a/tests/xfs/201 +++ b/tests/xfs/201 @@ -32,15 +32,6 @@ here=`pwd` tmp=/tmp/$$ status=1 # failure is the default! -do_pwrite() -{ - offset=`expr $1 \* 512` - end=`expr $2 \* 512` - length=`expr $end - $offset` - - xfs_io -d -f $file -c "pwrite $offset $length" >/dev/null -} - _cleanup() { umount $SCRATCH_MNT @@ -57,6 +48,17 @@ _supported_os Linux file=$SCRATCH_MNT/f +min_align=`_min_dio_alignment $SCRATCH_DEV` + +do_pwrite() +{ + offset=`expr $1 \* $min_align` + end=`expr $2 \* $min_align` + length=`expr $end - $offset` + + xfs_io -d -f $file -c "pwrite $offset $length" >/dev/null +} + _require_scratch _scratch_mkfs_xfs >/dev/null 2>&1