public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] t/io_uring: fix max_blocks calculation in pt mode again
@ 2023-04-16  4:38 Xiaoguang Wang
  0 siblings, 0 replies; only message in thread
From: Xiaoguang Wang @ 2023-04-16  4:38 UTC (permalink / raw)
  To: io-uring; +Cc: axboe

max_blocks indeed should be counted in the block size of bs, not
nvme's logical block size, otherwise we'll get "LBA Out of Range"
error while bs is greater than nvme's logical block size.

Fixes: e2a4a77e483e ("t/io_uring: fix max_blocks calculation in nvme passthrough mode")
Signed-off-by: Xiaoguang Wang <[email protected]>
---
 t/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/io_uring.c b/t/io_uring.c
index f9f4b840..9f014c4b 100644
--- a/t/io_uring.c
+++ b/t/io_uring.c
@@ -704,7 +704,7 @@ static int get_file_size(struct file *f)
 					bs, lbs);
 			return -1;
 		}
-		f->max_blocks = nlba;
+		f->max_blocks = nlba * lbs / bs;
 		f->max_size = nlba;
 		f->lba_shift = ilog2(lbs);
 		return 0;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-16  4:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-16  4:38 [PATCH] t/io_uring: fix max_blocks calculation in pt mode again Xiaoguang Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox