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 <zlang@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
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
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