Skip to content

Commit 0f6f3cf

Browse files
Ming Leigregkh
authored andcommitted
ublk: add parameter struct io_uring_cmd * to ublk_prep_auto_buf_reg()
[ Upstream commit 3035b9b ] 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> Stable-dep-of: c258f5c ("ublk: fix deadlock when reading partition table") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a4315e4 commit 0f6f3cf

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/block/ublk_drv.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,11 +1242,12 @@ ublk_auto_buf_reg_fallback(const struct ublk_queue *ubq, struct ublk_io *io)
12421242
}
12431243

12441244
static bool ublk_auto_buf_reg(const struct ublk_queue *ubq, struct request *req,
1245-
struct ublk_io *io, unsigned int issue_flags)
1245+
struct ublk_io *io, struct io_uring_cmd *cmd,
1246+
unsigned int issue_flags)
12461247
{
12471248
int ret;
12481249

1249-
ret = io_buffer_register_bvec(io->cmd, req, ublk_io_release,
1250+
ret = io_buffer_register_bvec(cmd, req, ublk_io_release,
12501251
io->buf.index, issue_flags);
12511252
if (ret) {
12521253
if (io->buf.flags & UBLK_AUTO_BUF_REG_FALLBACK) {
@@ -1258,18 +1259,19 @@ static bool ublk_auto_buf_reg(const struct ublk_queue *ubq, struct request *req,
12581259
}
12591260

12601261
io->task_registered_buffers = 1;
1261-
io->buf_ctx_handle = io_uring_cmd_ctx_handle(io->cmd);
1262+
io->buf_ctx_handle = io_uring_cmd_ctx_handle(cmd);
12621263
io->flags |= UBLK_IO_FLAG_AUTO_BUF_REG;
12631264
return true;
12641265
}
12651266

12661267
static bool ublk_prep_auto_buf_reg(struct ublk_queue *ubq,
12671268
struct request *req, struct ublk_io *io,
1269+
struct io_uring_cmd *cmd,
12681270
unsigned int issue_flags)
12691271
{
12701272
ublk_init_req_ref(ubq, io);
12711273
if (ublk_support_auto_buf_reg(ubq) && ublk_rq_has_data(req))
1272-
return ublk_auto_buf_reg(ubq, req, io, issue_flags);
1274+
return ublk_auto_buf_reg(ubq, req, io, cmd, issue_flags);
12731275

12741276
return true;
12751277
}
@@ -1344,7 +1346,7 @@ static void ublk_dispatch_req(struct ublk_queue *ubq,
13441346
if (!ublk_start_io(ubq, req, io))
13451347
return;
13461348

1347-
if (ublk_prep_auto_buf_reg(ubq, req, io, issue_flags))
1349+
if (ublk_prep_auto_buf_reg(ubq, req, io, io->cmd, issue_flags))
13481350
ublk_complete_io_cmd(io, req, UBLK_IO_RES_OK, issue_flags);
13491351
}
13501352

0 commit comments

Comments
 (0)