Skip to content

Commit 3c12a89

Browse files
isilenceChristoph Hellwig
authored andcommitted
nvme: enable vectored registered bufs for passthrough cmds
nvme already supports registered buffers for non-vectored io_uring passthrough commands, enable it for the vectored mode as well. It takes an iovec, each entry of which should contain a range within the same registered buffer specificied in sqe->buf_index. Signed-off-by: Pavel Begunkov <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Reviewed-by: Anuj Gupta <[email protected]> Reviewed-by: Kanchan Joshi <[email protected]> Reviewed-by: Caleb Sander Mateos <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent c4b680a commit 3c12a89

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/nvme/host/ioctl.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,15 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
493493
d.timeout_ms = READ_ONCE(cmd->timeout_ms);
494494

495495
if (d.data_len && (ioucmd->flags & IORING_URING_CMD_FIXED)) {
496-
/* fixedbufs is only for non-vectored io */
497-
if (vec)
498-
return -EINVAL;
496+
int ddir = nvme_is_write(&c) ? WRITE : READ;
499497

500-
ret = io_uring_cmd_import_fixed(d.addr, d.data_len,
501-
nvme_is_write(&c) ? WRITE : READ, &iter, ioucmd,
502-
issue_flags);
498+
if (vec)
499+
ret = io_uring_cmd_import_fixed_vec(ioucmd,
500+
u64_to_user_ptr(d.addr), d.data_len,
501+
ddir, &iter, issue_flags);
502+
else
503+
ret = io_uring_cmd_import_fixed(d.addr, d.data_len,
504+
ddir, &iter, ioucmd, issue_flags);
503505
if (ret < 0)
504506
return ret;
505507

0 commit comments

Comments
 (0)