linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfstests: fix seek_sanity_test for fs w/o fallocate
@ 2013-05-31 15:45 Eric Sandeen
  2013-05-31 17:24 ` Zheng Liu
  2013-06-03 12:42 ` Rich Johnston
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Sandeen @ 2013-05-31 15:45 UTC (permalink / raw)
  To: xfs-oss, ext4 development

currently the seek_sanity_test (generic/285) fails on ext3
or ext2 due to fallocate() failures.  Just ignore that test
if the fs doesn't support fallocate.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
index cd3b1ee..fbf5a8c 100644
--- a/src/seek_sanity_test.c
+++ b/src/seek_sanity_test.c
@@ -96,9 +96,13 @@ static int do_fallocate(int fd, off_t offset, off_t length, int mode)
 	int ret;
 
 	ret = fallocate(fd, mode, offset, length);
-	if (ret)
+	if (ret) {
+		/* Don't warn about a filesystem w/o fallocate support */
+		if (errno == EOPNOTSUPP)
+			return ret;
 		fprintf(stderr, "  ERROR %d: Failed to preallocate "
 			"space to %ld bytes\n", errno, (long) length);
+	}
 
 	return ret;
 }
@@ -290,8 +294,14 @@ static int test09(int fd, int testnum)
 
 	/* preallocate 8M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (!ret) {
@@ -336,8 +346,14 @@ static int test08(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)
@@ -379,8 +395,14 @@ static int test07(int fd, int testnum)
 
 	/* preallocate 4M space to file */
 	ret = do_fallocate(fd, 0, filsz, 0);
-	if (ret < 0)
+	if (ret < 0) {
+		/* Report success if fs doesn't support fallocate */
+		if (errno == EOPNOTSUPP) {
+			fprintf(stdout, "Test skipped as fs doesn't support fallocate.\n");
+			ret = 0;
+		}
 		goto out;
+	}
 
 	ret = do_pwrite(fd, buf, bufsz, bufsz * 10);
 	if (ret)

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-03 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31 15:45 [PATCH] xfstests: fix seek_sanity_test for fs w/o fallocate Eric Sandeen
2013-05-31 17:24 ` Zheng Liu
2013-05-31 17:15   ` Eric Sandeen
2013-05-31 19:02     ` Rich Johnston
2013-06-01  4:51       ` Eric Sandeen
2013-06-01 15:51       ` gnehzuil.liu
2013-06-03 12:42 ` Rich Johnston

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).