public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Eryu Guan <eguan@redhat.com>
Cc: fstests@vger.kernel.org, neilb@suse.com
Subject: [PATCH] fsync-err: write to different offset on each fd
Date: Wed, 13 Sep 2017 09:06:24 -0400	[thread overview]
Message-ID: <20170913130624.24028-1-jlayton@kernel.org> (raw)

From: Jeff Layton <jlayton@redhat.com>

NFS currently has slightly different semantics from other fs' and
fails this test due to the fact that the same range is overwritten
via each fd.

Change it so that each fd overwrites a different region, which is
more representative of a real workload anyway.

Reported-by: Neil Brown <neilb@suse.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 src/fsync-err.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/fsync-err.c b/src/fsync-err.c
index 4b0205cf2fd4..146688ddb01e 100644
--- a/src/fsync-err.c
+++ b/src/fsync-err.c
@@ -106,7 +106,7 @@ int main(int argc, char **argv)
 	memset(buf, 0x7c, bufsize);
 
 	for (i = 0; i < numfds; ++i) {
-		ret = write(fd[i], buf, bufsize);
+		ret = pwrite(fd[i], buf, bufsize, i * bufsize);
 		if (ret < 0) {
 			printf("First write on fd[%d] failed: %m\n", i);
 			return 1;
@@ -149,7 +149,7 @@ int main(int argc, char **argv)
 	}
 
 	for (i = 0; i < numfds; ++i) {
-		ret = write(fd[i], buf, bufsize);
+		ret = pwrite(fd[i], buf, bufsize, i * bufsize);
 		if (ret < 0) {
 			printf("Second write on fd[%d] failed: %m\n", i);
 			return 1;
-- 
2.13.5


             reply	other threads:[~2017-09-13 13:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 13:06 Jeff Layton [this message]
2017-09-14  6:24 ` [PATCH] fsync-err: write to different offset on each fd Eryu Guan

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=20170913130624.24028-1-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=neilb@suse.com \
    /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