From: Zorro Lang <zlang@redhat.com>
To: fstests@vger.kernel.org
Cc: hch@lst.de, Zorro Lang <zlang@redhat.com>
Subject: [PATCH] xfs/201: use min_dio_alignment size to replace 512b
Date: Wed, 19 Aug 2015 01:52:05 +0800 [thread overview]
Message-ID: <1439920325-9723-1-git-send-email-zlang@redhat.com> (raw)
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>
---
tests/xfs/201 | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/tests/xfs/201 b/tests/xfs/201
index 88829d3..921d2a3 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
--
1.9.3
reply other threads:[~2015-08-18 17:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1439920325-9723-1-git-send-email-zlang@redhat.com \
--to=zlang@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
/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