代码拉取完成,页面将自动刷新
From 49425e0b44cf7b46f022ddabee73a0630cb1f9bc Mon Sep 17 00:00:00 2001
From: Kanchan Joshi <joshi.k@samsung.com>
Date: Tue, 6 Dec 2022 17:48:30 +0530
Subject: [PATCH 2/4] test/io_uring_passthrough: fix iopoll test
iopoll test is broken as it does not initialize the command/sqe properly
before submission.
Add the necessary initialization to set this right.
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Link: https://lore.kernel.org/r/20221206121831.5528-2-joshi.k@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
---
test/io_uring_passthrough.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index 2f24364..933c137 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -352,6 +352,8 @@ static int test_io_uring_submit_enters(const char *file)
int fd, i, ret, ring_flags, open_flags;
unsigned head;
struct io_uring_cqe *cqe;
+ struct nvme_uring_cmd *cmd;
+ struct io_uring_sqe *sqe;
ring_flags = IORING_SETUP_IOPOLL;
ring_flags |= IORING_SETUP_SQE128;
@@ -371,12 +373,28 @@ static int test_io_uring_submit_enters(const char *file)
}
for (i = 0; i < BUFFERS; i++) {
- struct io_uring_sqe *sqe;
off_t offset = BS * (rand() % BUFFERS);
+ __u64 slba;
+ __u32 nlb;
sqe = io_uring_get_sqe(&ring);
- io_uring_prep_writev(sqe, fd, &vecs[i], 1, offset);
- sqe->user_data = 1;
+ io_uring_prep_readv(sqe, fd, &vecs[i], 1, offset);
+ sqe->user_data = i;
+ sqe->opcode = IORING_OP_URING_CMD;
+ sqe->cmd_op = NVME_URING_CMD_IO;
+ cmd = (struct nvme_uring_cmd *)sqe->cmd;
+ memset(cmd, 0, sizeof(struct nvme_uring_cmd));
+
+ slba = offset >> lba_shift;
+ nlb = (BS >> lba_shift) - 1;
+
+ cmd->opcode = nvme_cmd_read;
+ cmd->cdw10 = slba & 0xffffffff;
+ cmd->cdw11 = slba >> 32;
+ cmd->cdw12 = nlb;
+ cmd->addr = (__u64)(uintptr_t)&vecs[i];
+ cmd->data_len = 1;
+ cmd->nsid = nsid;
}
/* submit manually to avoid adding IORING_ENTER_GETEVENTS */
--
2.24.4
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。