Skip to contentSkip to conversation

Remove fpos tests without linking

PATCH Applied Dylan Yudaken 2 participants 2 messages Feb 24, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove fpos tests without linking

There are still more discussions ([1]) to see how to have consistent r/w results without link, so do not test these cases.

[1] https://lore.kernel.org/io-uring/[email protected]

---
 test/fpos.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
test/fpos.c +12 -16
index 385db63..78a6152 100644
@@ -40,8 +40,7 @@ static void create_file(const char *file, size_t size)
 	assert(ret == size);
 }
 
-static int test_read(struct io_uring *ring, bool async, bool link,
-		     int blocksize)
+static int test_read(struct io_uring *ring, bool async, int blocksize)
 {
 	int ret, fd, i;
 	bool done = false;
@@ -71,7 +70,7 @@ static int test_read(struct io_uring *ring, bool async, bool link,
 			sqe->user_data = i;
 			if (async)
 				sqe->flags |= IOSQE_ASYNC;
-			if (link && i != QUEUE_SIZE - 1)
+			if (i != QUEUE_SIZE - 1)
 				sqe->flags |= IOSQE_IO_LINK;
 		}
 		ret = io_uring_submit_and_wait(ring, QUEUE_SIZE);
@@ -124,8 +123,7 @@ static int test_read(struct io_uring *ring, bool async, bool link,
 			ret = -1;
 		}
 		current = lseek(fd, 0, SEEK_CUR);
-		if (current < expected || (current != expected && link)) {
-			/* accept that with !link current may be > expected */
+		if (current != expected) {
 			fprintf(stderr, "f_pos incorrect, expected %ld have %ld\n",
 					(long) expected, (long) current);
 			ret = -1;
@@ -137,8 +135,7 @@ static int test_read(struct io_uring *ring, bool async, bool link,
 }
 
 
-static int test_write(struct io_uring *ring, bool async,
-		      bool link, int blocksize)
+static int test_write(struct io_uring *ring, bool async, int blocksize)
 {
 	int ret, fd, i;
 	struct io_uring_sqe *sqe;
@@ -167,7 +164,7 @@ static int test_write(struct io_uring *ring, bool async,
 		sqe->user_data = 1;
 		if (async)
 			sqe->flags |= IOSQE_ASYNC;
-		if (link && i != QUEUE_SIZE - 1)
+		if (i != QUEUE_SIZE - 1)
 			sqe->flags |= IOSQE_IO_LINK;
 	}
 	ret = io_uring_submit_and_wait(ring, QUEUE_SIZE);
@@ -236,19 +233,18 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
-	for (int test = 0; test < 16; test++) {
+	for (int test = 0; test < 8; test++) {
 		int async = test & 0x01;
-		int link = test & 0x02;
-		int write = test & 0x04;
-		int blocksize = test & 0x08 ? 1 : 7;
+		int write = test & 0x02;
+		int blocksize = test & 0x04 ? 1 : 7;
 
 		ret = write
-			? test_write(&ring, !!async, !!link, blocksize)
-			: test_read(&ring, !!async, !!link, blocksize);
+			? test_write(&ring, !!async, blocksize)
+			: test_read(&ring, !!async, blocksize);
 		if (ret) {
-			fprintf(stderr, "failed %s async=%d link=%d blocksize=%d\n",
+			fprintf(stderr, "failed %s async=%d blocksize=%d\n",
 					write ? "write" : "read",
-					async, link, blocksize);
+					async, blocksize);
 			return -1;
 		}
 	}

base-commit: 8a2e43dad6475cfcecf91d79e3c4ed58bb5298e1

Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 6 lines · Dylan Yudaken

There are still more discussions ([1]) to see how to have consistent r/w results without link, so do not test these cases.

[1] https://lore.kernel.org/io-uring/[email protected]

Applied, thanks!

[1/1] Remove fpos tests without linking

      commit: 896a1d3ab14a8777a45db6e7b67cf557a44923fb

Best regards,

Signature · 1 line
Jens Axboe