11 Star 0 Fork 21

src-anolis-os/liburing

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1006-test-io_uring_passthrough-fix-iopoll-test.patch 2.04 KB
一键复制 编辑 原始数据 按行查看 历史
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/liburing.git
git@gitee.com:src-anolis-os/liburing.git
src-anolis-os
liburing
liburing
a8

搜索帮助