[PATCH] fsync-err: write to different offset on each fd

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Jeff Layton <jlayton@xxxxxxxxxx>

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@xxxxxxxx>
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux