From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3] syscalls/sync_file_range: add partial file sync test-cases
Date: Wed, 27 Mar 2019 15:48:26 +0100 [thread overview]
Message-ID: <20190327144826.GA30619@rei> (raw)
In-Reply-To: <1551962651-22261-1-git-send-email-sumit.garg@linaro.org>
Hi!
Sorry for the long delay.
This is altmost perfect, the only problem is that the third test fails
on vfat. As far as I can tell the reason is that vfat does not support
sparse files, hence seeking to the middle of file and writing there also
schedulles I/O to write zeros from the start of the file to the offset
we started writing to.
Following ugly patch solves the problem:
diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
index 334ea5e88..774524c2f 100644
--- a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
+++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c
@@ -45,6 +45,12 @@ static void verify_sync_file_range(struct testcase *tc)
fd = SAFE_OPEN(tc->fname, O_RDWR|O_CREAT, MODE);
+ if (!strcmp(tst_device->fs_type, "vfat")) {
+ tst_res(TINFO, "Pre-filling file");
+ tst_fill_fd(fd, 0, tc->write_off, 1);
+ fsync(fd);
+ }
+
lseek(fd, tc->write_off, SEEK_SET);
So either we limit the tests so that the sync region does not overlap with the
possible hole at the start of the file and loose some test coverage.
Or we can add a function to the test library that would return true/false if
sparse files are supported for a given FS.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2019-03-27 14:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 12:44 [LTP] [PATCH v3] syscalls/sync_file_range: add partial file sync test-cases Sumit Garg
2019-03-27 14:48 ` Cyril Hrubis [this message]
2019-03-28 4:57 ` Sumit Garg
2019-06-10 3:33 ` Li Wang
2019-06-10 7:11 ` Sumit Garg
2019-04-01 6:54 ` Li Wang
2019-04-03 11:17 ` Sumit Garg
2019-04-18 7:47 ` Li Wang
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=20190327144826.GA30619@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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