diff mbox series

t/io_uring: fix max_blocks calculation in pt mode again

Message ID 20230416043802.46269-1-xiaoguang.wang@linux.alibaba.com (mailing list archive)
State New
Headers show
Series t/io_uring: fix max_blocks calculation in pt mode again | expand

Commit Message

Xiaoguang Wang April 16, 2023, 4:38 a.m. UTC
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 <xiaoguang.wang@linux.alibaba.com>
---
 t/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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;