From: Luis Henriques <lhenriques@suse.com>
To: fstests@vger.kernel.org
Cc: Eryu Guan <eguan@redhat.com>, Jan Kara <jack@suse.cz>,
Luis Henriques <lhenriques@suse.com>
Subject: [PATCH v2] src/seek_sanity_test: fix test15 SEEK_HOLE expected results
Date: Tue, 23 May 2017 17:19:55 +0100 [thread overview]
Message-ID: <20170523161955.28394-1-lhenriques@suse.com> (raw)
In-Reply-To: <20170523155654.GG7250@eguan.usersys.redhat.com>
Filesystesm with the "default behaviour" will always return the offset of
the end of the file when lseek'ing with SEEK_HOLE. This test does the
following:
- fallocate 4 << 20 bytes
- write PAGE_SIZE bytes at offset 0
- writes PAGE_SIZE bytes at offset 4 << 20
Thus, using lseek in an FS with the "default behaviour" will set the
position at 4 << 20 + PAGE_SIZE.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Henriques <lhenriques@suse.com>
---
- Changes since v1
Updated with Eryu suggestions (thanks for reviewing!): update filsz
after the last write and set the expected result for the 5th test to
'filsz - bufsz'.
src/seek_sanity_test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
index d52e2b6dab79..064a8fa5822f 100644
--- a/src/seek_sanity_test.c
+++ b/src/seek_sanity_test.c
@@ -334,12 +334,15 @@ static int test15(int fd, int testnum)
if (ret)
goto out;
+ /* update file size */
+ filsz += bufsz;
+
/* offset at the beginning */
ret += do_lseek(testnum, 1, fd, filsz, SEEK_HOLE, 0, bufsz);
ret += do_lseek(testnum, 2, fd, filsz, SEEK_HOLE, 1, bufsz);
ret += do_lseek(testnum, 3, fd, filsz, SEEK_DATA, 0, 0);
ret += do_lseek(testnum, 4, fd, filsz, SEEK_DATA, 1, 1);
- ret += do_lseek(testnum, 5, fd, filsz, SEEK_DATA, bufsz, filsz);
+ ret += do_lseek(testnum, 5, fd, filsz, SEEK_DATA, bufsz, filsz - bufsz);
out:
do_free(buf);
prev parent reply other threads:[~2017-05-23 16:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 14:06 [PATCH] src/seek_sanity_test: fix test15 SEEK_HOLE expected results Luis Henriques
2017-05-23 14:21 ` Jan Kara
2017-05-23 15:56 ` Eryu Guan
2017-05-23 16:19 ` Luis Henriques [this message]
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=20170523161955.28394-1-lhenriques@suse.com \
--to=lhenriques@suse.com \
--cc=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=jack@suse.cz \
/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