* [PATCH] xfstests: generic/285: fix seek_sanity_test for generic SEEK_HOLE/DATA
@ 2014-04-21 16:43 Konstantin Khlebnikov
2014-04-22 3:56 ` Jeff Liu
0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Khlebnikov @ 2014-04-21 16:43 UTC (permalink / raw)
To: xfs
Generic implementation of SEEK_HOLE/DATA reports whole file as data chunk with
virtual hole at the end (generic_file_llseek, used by ext2/ext3/reiserfs/nfs).
Currently test prepares file smaller than expected for "huge file" testcases
(testcases 10-12). This patch fixes test file layout, now second data chunk
ends right at the expected end of file.
Plus it fixes type of 'filesz' argument, it should be off_t.
Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
---
src/seek_sanity_test.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
index fbf5a8c..7cf45c0 100644
--- a/src/seek_sanity_test.c
+++ b/src/seek_sanity_test.c
@@ -157,7 +157,7 @@ static int do_create(const char *filename)
return fd;
}
-static int do_lseek(int testnum, int subtest, int fd, int filsz, int origin,
+static int do_lseek(int testnum, int subtest, int fd, off_t filsz, int origin,
off_t set, off_t exp)
{
off_t pos, exp2;
@@ -203,7 +203,7 @@ static int huge_file_test(int fd, int testnum, off_t filsz)
{
char *buf = NULL;
int bufsz = alloc_size * 16; /* XFS seems to round allocated size */
- off_t off = filsz - 2*bufsz;
+ off_t off = filsz - bufsz;
int ret = -1;
buf = do_malloc(bufsz);
@@ -211,6 +211,7 @@ static int huge_file_test(int fd, int testnum, off_t filsz)
goto out;
memset(buf, 'a', bufsz);
+ /* |- DATA -|- HUGE HOLE -|- DATA -| */
ret = do_pwrite(fd, buf, bufsz, 0);
if (ret)
goto out;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-22 3:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-21 16:43 [PATCH] xfstests: generic/285: fix seek_sanity_test for generic SEEK_HOLE/DATA Konstantin Khlebnikov
2014-04-22 3:56 ` Jeff Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).