public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Nitesh Shetty <nj.shetty@samsung.com>
To: io-uring@vger.kernel.org
Cc: gost.dev@samsung.com, nitheshshetty@gmail.com,
	Nitesh Shetty <nj.shetty@samsung.com>
Subject: [PATCH liburing 3/3] test/fixed-seg: Support non 512 LBA format devices.
Date: Wed, 23 Apr 2025 18:57:52 +0530	[thread overview]
Message-ID: <20250423132752.15622-4-nj.shetty@samsung.com> (raw)
In-Reply-To: <20250423132752.15622-1-nj.shetty@samsung.com>

At present test succeeds only for 512 LBA format device.
Now 4k LBA formatted device should also pass.

Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
---
 test/fixed-seg.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/fixed-seg.c b/test/fixed-seg.c
index ab1d359..63b1cee 100644
--- a/test/fixed-seg.c
+++ b/test/fixed-seg.c
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
+#include <sys/ioctl.h>
 #include "liburing.h"
 #include "helpers.h"
 
@@ -87,7 +88,7 @@ int main(int argc, char *argv[])
 	struct io_uring ring;
 	const char *fname;
 	char buf[256];
-	int fd, rnd_fd, ret;
+	int fd, rnd_fd, ret, vec_off = 512;
 
 	if (argc > 1) {
 		fname = argv[1];
@@ -104,6 +105,7 @@ int main(int argc, char *argv[])
 		perror("open");
 		return 1;
 	}
+	ioctl(fd, BLKSSZGET, &vec_off);
 
 	rnd_fd = open("/dev/urandom", O_RDONLY);
 	if (fd < 0) {
@@ -143,14 +145,13 @@ int main(int argc, char *argv[])
 		goto err;
 	}
 
-	ret = test(&ring, fd, 512);
+	ret = test(&ring, fd, vec_off);
 	if (ret) {
-		fprintf(stderr, "test 512 failed\n");
+		fprintf(stderr, "test %d failed\n", vec_off);
 		goto err;
 	}
 
-	ret = test(&ring, fd, 3584);
-	if (ret) {
+	if ((vec_off == 512) && test(&ring, fd, 3584)) {
 		fprintf(stderr, "test 3584 failed\n");
 		goto err;
 	}
-- 
2.43.0


  parent reply	other threads:[~2025-04-23 16:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250423133628epcas5p2b4752a672a64bd2f1392f663a284f9f2@epcas5p2.samsung.com>
2025-04-23 13:27 ` [PATCH liburing 0/3] test/fixed-seg: Add data verification and Nitesh Shetty
     [not found]   ` <CGME20250423133638epcas5p34a9cf20f13387f7f604d9c2e2bf6976a@epcas5p3.samsung.com>
2025-04-23 13:27     ` [PATCH liburing 1/3] test/fixed-seg: Prep patch, rename the vec to rvec Nitesh Shetty
     [not found]   ` <CGME20250423133642epcas5p1bef7e3af23bd8561f359ccc16fdaf980@epcas5p1.samsung.com>
2025-04-23 13:27     ` [PATCH liburing 2/3] test/fixed-seg: verify the data read Nitesh Shetty
     [not found]   ` <CGME20250423133646epcas5p2e67808b13c6c85444b8a9f28995fe70b@epcas5p2.samsung.com>
2025-04-23 13:27     ` Nitesh Shetty [this message]
2025-04-23 19:05       ` [PATCH liburing 3/3] test/fixed-seg: Support non 512 LBA format devices Anuj gupta
2025-04-23 20:02         ` Jens Axboe
2025-04-23 20:04   ` [PATCH liburing 0/3] test/fixed-seg: Add data verification and Jens Axboe

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=20250423132752.15622-4-nj.shetty@samsung.com \
    --to=nj.shetty@samsung.com \
    --cc=gost.dev@samsung.com \
    --cc=io-uring@vger.kernel.org \
    --cc=nitheshshetty@gmail.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