mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
ublk: add parameter struct io_uring_cmd * to ublk_prep_auto_buf_reg()
Add parameter `struct io_uring_cmd *` to ublk_prep_auto_buf_reg() and prepare for reusing this helper for the coming UBLK_BATCH_IO feature, which can fetch & commit one batch of io commands via single uring_cmd. Reviewed-by: Caleb Sander Mateos <csander@purestorage.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -1176,11 +1176,12 @@ ublk_auto_buf_reg_fallback(const struct ublk_queue *ubq, struct ublk_io *io)
|
||||
}
|
||||
|
||||
static bool ublk_auto_buf_reg(const struct ublk_queue *ubq, struct request *req,
|
||||
struct ublk_io *io, unsigned int issue_flags)
|
||||
struct ublk_io *io, struct io_uring_cmd *cmd,
|
||||
unsigned int issue_flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = io_buffer_register_bvec(io->cmd, req, ublk_io_release,
|
||||
ret = io_buffer_register_bvec(cmd, req, ublk_io_release,
|
||||
io->buf.index, issue_flags);
|
||||
if (ret) {
|
||||
if (io->buf.flags & UBLK_AUTO_BUF_REG_FALLBACK) {
|
||||
@@ -1192,18 +1193,19 @@ static bool ublk_auto_buf_reg(const struct ublk_queue *ubq, struct request *req,
|
||||
}
|
||||
|
||||
io->task_registered_buffers = 1;
|
||||
io->buf_ctx_handle = io_uring_cmd_ctx_handle(io->cmd);
|
||||
io->buf_ctx_handle = io_uring_cmd_ctx_handle(cmd);
|
||||
io->flags |= UBLK_IO_FLAG_AUTO_BUF_REG;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ublk_prep_auto_buf_reg(struct ublk_queue *ubq,
|
||||
struct request *req, struct ublk_io *io,
|
||||
struct io_uring_cmd *cmd,
|
||||
unsigned int issue_flags)
|
||||
{
|
||||
ublk_init_req_ref(ubq, io);
|
||||
if (ublk_support_auto_buf_reg(ubq) && ublk_rq_has_data(req))
|
||||
return ublk_auto_buf_reg(ubq, req, io, issue_flags);
|
||||
return ublk_auto_buf_reg(ubq, req, io, cmd, issue_flags);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1278,7 +1280,7 @@ static void ublk_dispatch_req(struct ublk_queue *ubq,
|
||||
if (!ublk_start_io(ubq, req, io))
|
||||
return;
|
||||
|
||||
if (ublk_prep_auto_buf_reg(ubq, req, io, issue_flags))
|
||||
if (ublk_prep_auto_buf_reg(ubq, req, io, io->cmd, issue_flags))
|
||||
ublk_complete_io_cmd(io, req, UBLK_IO_RES_OK, issue_flags);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user