Revert "block/io_uring: pass in issue_flags for uring_cmd task_work handling"
This reverts commit e5da11825e
.
It breaks the current Android kernel abi. It will be brought back at
the next KABI break update.
Bug: 161946584
Change-Id: Ifdde1037d7dd305c6165c44263ae4b20e11c0c02
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
bbf55140b7
commit
d608563925
@ -656,8 +656,7 @@ static void __ublk_fail_req(struct ublk_queue *ubq, struct ublk_io *io,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ubq_complete_io_cmd(struct ublk_io *io, int res,
|
static void ubq_complete_io_cmd(struct ublk_io *io, int res)
|
||||||
unsigned issue_flags)
|
|
||||||
{
|
{
|
||||||
/* mark this cmd owned by ublksrv */
|
/* mark this cmd owned by ublksrv */
|
||||||
io->flags |= UBLK_IO_FLAG_OWNED_BY_SRV;
|
io->flags |= UBLK_IO_FLAG_OWNED_BY_SRV;
|
||||||
@ -669,7 +668,7 @@ static void ubq_complete_io_cmd(struct ublk_io *io, int res,
|
|||||||
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
|
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
|
||||||
|
|
||||||
/* tell ublksrv one io request is coming */
|
/* tell ublksrv one io request is coming */
|
||||||
io_uring_cmd_done(io->cmd, res, 0, issue_flags);
|
io_uring_cmd_done(io->cmd, res, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UBLK_REQUEUE_DELAY_MS 3
|
#define UBLK_REQUEUE_DELAY_MS 3
|
||||||
@ -686,8 +685,7 @@ static inline void __ublk_abort_rq(struct ublk_queue *ubq,
|
|||||||
mod_delayed_work(system_wq, &ubq->dev->monitor_work, 0);
|
mod_delayed_work(system_wq, &ubq->dev->monitor_work, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void __ublk_rq_task_work(struct request *req,
|
static inline void __ublk_rq_task_work(struct request *req)
|
||||||
unsigned issue_flags)
|
|
||||||
{
|
{
|
||||||
struct ublk_queue *ubq = req->mq_hctx->driver_data;
|
struct ublk_queue *ubq = req->mq_hctx->driver_data;
|
||||||
int tag = req->tag;
|
int tag = req->tag;
|
||||||
@ -725,7 +723,7 @@ static inline void __ublk_rq_task_work(struct request *req,
|
|||||||
pr_devel("%s: need get data. op %d, qid %d tag %d io_flags %x\n",
|
pr_devel("%s: need get data. op %d, qid %d tag %d io_flags %x\n",
|
||||||
__func__, io->cmd->cmd_op, ubq->q_id,
|
__func__, io->cmd->cmd_op, ubq->q_id,
|
||||||
req->tag, io->flags);
|
req->tag, io->flags);
|
||||||
ubq_complete_io_cmd(io, UBLK_IO_RES_NEED_GET_DATA, issue_flags);
|
ubq_complete_io_cmd(io, UBLK_IO_RES_NEED_GET_DATA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -763,18 +761,17 @@ static inline void __ublk_rq_task_work(struct request *req,
|
|||||||
mapped_bytes >> 9;
|
mapped_bytes >> 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
ubq_complete_io_cmd(io, UBLK_IO_RES_OK, issue_flags);
|
ubq_complete_io_cmd(io, UBLK_IO_RES_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ublk_forward_io_cmds(struct ublk_queue *ubq,
|
static inline void ublk_forward_io_cmds(struct ublk_queue *ubq)
|
||||||
unsigned issue_flags)
|
|
||||||
{
|
{
|
||||||
struct llist_node *io_cmds = llist_del_all(&ubq->io_cmds);
|
struct llist_node *io_cmds = llist_del_all(&ubq->io_cmds);
|
||||||
struct ublk_rq_data *data, *tmp;
|
struct ublk_rq_data *data, *tmp;
|
||||||
|
|
||||||
io_cmds = llist_reverse_order(io_cmds);
|
io_cmds = llist_reverse_order(io_cmds);
|
||||||
llist_for_each_entry_safe(data, tmp, io_cmds, node)
|
llist_for_each_entry_safe(data, tmp, io_cmds, node)
|
||||||
__ublk_rq_task_work(blk_mq_rq_from_pdu(data), issue_flags);
|
__ublk_rq_task_work(blk_mq_rq_from_pdu(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ublk_abort_io_cmds(struct ublk_queue *ubq)
|
static inline void ublk_abort_io_cmds(struct ublk_queue *ubq)
|
||||||
@ -786,12 +783,12 @@ static inline void ublk_abort_io_cmds(struct ublk_queue *ubq)
|
|||||||
__ublk_abort_rq(ubq, blk_mq_rq_from_pdu(data));
|
__ublk_abort_rq(ubq, blk_mq_rq_from_pdu(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ublk_rq_task_work_cb(struct io_uring_cmd *cmd, unsigned issue_flags)
|
static void ublk_rq_task_work_cb(struct io_uring_cmd *cmd)
|
||||||
{
|
{
|
||||||
struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd);
|
struct ublk_uring_cmd_pdu *pdu = ublk_get_uring_cmd_pdu(cmd);
|
||||||
struct ublk_queue *ubq = pdu->ubq;
|
struct ublk_queue *ubq = pdu->ubq;
|
||||||
|
|
||||||
ublk_forward_io_cmds(ubq, issue_flags);
|
ublk_forward_io_cmds(ubq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ublk_rq_task_work_fn(struct callback_head *work)
|
static void ublk_rq_task_work_fn(struct callback_head *work)
|
||||||
@ -800,9 +797,8 @@ static void ublk_rq_task_work_fn(struct callback_head *work)
|
|||||||
struct ublk_rq_data, work);
|
struct ublk_rq_data, work);
|
||||||
struct request *req = blk_mq_rq_from_pdu(data);
|
struct request *req = blk_mq_rq_from_pdu(data);
|
||||||
struct ublk_queue *ubq = req->mq_hctx->driver_data;
|
struct ublk_queue *ubq = req->mq_hctx->driver_data;
|
||||||
unsigned issue_flags = IO_URING_F_UNLOCKED;
|
|
||||||
|
|
||||||
ublk_forward_io_cmds(ubq, issue_flags);
|
ublk_forward_io_cmds(ubq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq)
|
static void ublk_queue_cmd(struct ublk_queue *ubq, struct request *rq)
|
||||||
@ -1056,8 +1052,7 @@ static void ublk_cancel_queue(struct ublk_queue *ubq)
|
|||||||
struct ublk_io *io = &ubq->ios[i];
|
struct ublk_io *io = &ubq->ios[i];
|
||||||
|
|
||||||
if (io->flags & UBLK_IO_FLAG_ACTIVE)
|
if (io->flags & UBLK_IO_FLAG_ACTIVE)
|
||||||
io_uring_cmd_done(io->cmd, UBLK_IO_RES_ABORT, 0,
|
io_uring_cmd_done(io->cmd, UBLK_IO_RES_ABORT, 0);
|
||||||
IO_URING_F_UNLOCKED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all io commands are canceled */
|
/* all io commands are canceled */
|
||||||
@ -1300,7 +1295,7 @@ static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags)
|
|||||||
return -EIOCBQUEUED;
|
return -EIOCBQUEUED;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
io_uring_cmd_done(cmd, ret, 0, issue_flags);
|
io_uring_cmd_done(cmd, ret, 0);
|
||||||
pr_devel("%s: complete: cmd op %d, tag %d ret %x io_flags %x\n",
|
pr_devel("%s: complete: cmd op %d, tag %d ret %x io_flags %x\n",
|
||||||
__func__, cmd_op, tag, ret, io->flags);
|
__func__, cmd_op, tag, ret, io->flags);
|
||||||
return -EIOCBQUEUED;
|
return -EIOCBQUEUED;
|
||||||
@ -2058,7 +2053,7 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
io_uring_cmd_done(cmd, ret, 0, issue_flags);
|
io_uring_cmd_done(cmd, ret, 0);
|
||||||
pr_devel("%s: cmd done ret %d cmd_op %x, dev id %d qid %d\n",
|
pr_devel("%s: cmd done ret %d cmd_op %x, dev id %d qid %d\n",
|
||||||
__func__, ret, cmd->cmd_op, header->dev_id, header->queue_id);
|
__func__, ret, cmd->cmd_op, header->dev_id, header->queue_id);
|
||||||
return -EIOCBQUEUED;
|
return -EIOCBQUEUED;
|
||||||
|
@ -387,8 +387,7 @@ static inline struct nvme_uring_cmd_pdu *nvme_uring_cmd_pdu(
|
|||||||
return (struct nvme_uring_cmd_pdu *)&ioucmd->pdu;
|
return (struct nvme_uring_cmd_pdu *)&ioucmd->pdu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvme_uring_task_meta_cb(struct io_uring_cmd *ioucmd,
|
static void nvme_uring_task_meta_cb(struct io_uring_cmd *ioucmd)
|
||||||
unsigned issue_flags)
|
|
||||||
{
|
{
|
||||||
struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
|
struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
|
||||||
struct request *req = pdu->req;
|
struct request *req = pdu->req;
|
||||||
@ -409,18 +408,17 @@ static void nvme_uring_task_meta_cb(struct io_uring_cmd *ioucmd,
|
|||||||
blk_rq_unmap_user(req->bio);
|
blk_rq_unmap_user(req->bio);
|
||||||
blk_mq_free_request(req);
|
blk_mq_free_request(req);
|
||||||
|
|
||||||
io_uring_cmd_done(ioucmd, status, result, issue_flags);
|
io_uring_cmd_done(ioucmd, status, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvme_uring_task_cb(struct io_uring_cmd *ioucmd,
|
static void nvme_uring_task_cb(struct io_uring_cmd *ioucmd)
|
||||||
unsigned issue_flags)
|
|
||||||
{
|
{
|
||||||
struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
|
struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
|
||||||
|
|
||||||
if (pdu->bio)
|
if (pdu->bio)
|
||||||
blk_rq_unmap_user(pdu->bio);
|
blk_rq_unmap_user(pdu->bio);
|
||||||
|
|
||||||
io_uring_cmd_done(ioucmd, pdu->nvme_status, pdu->u.result, issue_flags);
|
io_uring_cmd_done(ioucmd, pdu->nvme_status, pdu->u.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
|
static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
|
||||||
@ -442,7 +440,7 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
|
|||||||
* Otherwise, move the completion to task work.
|
* Otherwise, move the completion to task work.
|
||||||
*/
|
*/
|
||||||
if (cookie != NULL && blk_rq_is_poll(req))
|
if (cookie != NULL && blk_rq_is_poll(req))
|
||||||
nvme_uring_task_cb(ioucmd, IO_URING_F_UNLOCKED);
|
nvme_uring_task_cb(ioucmd);
|
||||||
else
|
else
|
||||||
io_uring_cmd_complete_in_task(ioucmd, nvme_uring_task_cb);
|
io_uring_cmd_complete_in_task(ioucmd, nvme_uring_task_cb);
|
||||||
|
|
||||||
@ -464,7 +462,7 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io_meta(struct request *req,
|
|||||||
* Otherwise, move the completion to task work.
|
* Otherwise, move the completion to task work.
|
||||||
*/
|
*/
|
||||||
if (cookie != NULL && blk_rq_is_poll(req))
|
if (cookie != NULL && blk_rq_is_poll(req))
|
||||||
nvme_uring_task_meta_cb(ioucmd, IO_URING_F_UNLOCKED);
|
nvme_uring_task_meta_cb(ioucmd);
|
||||||
else
|
else
|
||||||
io_uring_cmd_complete_in_task(ioucmd, nvme_uring_task_meta_cb);
|
io_uring_cmd_complete_in_task(ioucmd, nvme_uring_task_meta_cb);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ struct io_uring_cmd {
|
|||||||
const void *cmd;
|
const void *cmd;
|
||||||
union {
|
union {
|
||||||
/* callback to defer completions to task context */
|
/* callback to defer completions to task context */
|
||||||
void (*task_work_cb)(struct io_uring_cmd *cmd, unsigned);
|
void (*task_work_cb)(struct io_uring_cmd *cmd);
|
||||||
/* used for polled completion */
|
/* used for polled completion */
|
||||||
void *cookie;
|
void *cookie;
|
||||||
};
|
};
|
||||||
@ -38,10 +38,9 @@ struct io_uring_cmd {
|
|||||||
#if defined(CONFIG_IO_URING)
|
#if defined(CONFIG_IO_URING)
|
||||||
int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
|
int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
|
||||||
struct iov_iter *iter, void *ioucmd);
|
struct iov_iter *iter, void *ioucmd);
|
||||||
void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2,
|
void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2);
|
||||||
unsigned issue_flags);
|
|
||||||
void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
|
void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
|
||||||
void (*task_work_cb)(struct io_uring_cmd *, unsigned));
|
void (*task_work_cb)(struct io_uring_cmd *));
|
||||||
struct sock *io_uring_get_socket(struct file *file);
|
struct sock *io_uring_get_socket(struct file *file);
|
||||||
void __io_uring_cancel(bool cancel_all);
|
void __io_uring_cancel(bool cancel_all);
|
||||||
void __io_uring_free(struct task_struct *tsk);
|
void __io_uring_free(struct task_struct *tsk);
|
||||||
@ -72,11 +71,11 @@ static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
|
static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
|
||||||
ssize_t ret2, unsigned issue_flags)
|
ssize_t ret2)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
|
static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
|
||||||
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
|
void (*task_work_cb)(struct io_uring_cmd *))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static inline struct sock *io_uring_get_socket(struct file *file)
|
static inline struct sock *io_uring_get_socket(struct file *file)
|
||||||
|
@ -15,13 +15,12 @@
|
|||||||
static void io_uring_cmd_work(struct io_kiocb *req, bool *locked)
|
static void io_uring_cmd_work(struct io_kiocb *req, bool *locked)
|
||||||
{
|
{
|
||||||
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
|
struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd);
|
||||||
unsigned issue_flags = *locked ? 0 : IO_URING_F_UNLOCKED;
|
|
||||||
|
|
||||||
ioucmd->task_work_cb(ioucmd, issue_flags);
|
ioucmd->task_work_cb(ioucmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
|
void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
|
||||||
void (*task_work_cb)(struct io_uring_cmd *, unsigned))
|
void (*task_work_cb)(struct io_uring_cmd *))
|
||||||
{
|
{
|
||||||
struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
|
struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
|
||||||
|
|
||||||
@ -43,8 +42,7 @@ static inline void io_req_set_cqe32_extra(struct io_kiocb *req,
|
|||||||
* Called by consumers of io_uring_cmd, if they originally returned
|
* Called by consumers of io_uring_cmd, if they originally returned
|
||||||
* -EIOCBQUEUED upon receiving the command.
|
* -EIOCBQUEUED upon receiving the command.
|
||||||
*/
|
*/
|
||||||
void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, ssize_t res2,
|
void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, ssize_t res2)
|
||||||
unsigned issue_flags)
|
|
||||||
{
|
{
|
||||||
struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
|
struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
|
||||||
|
|
||||||
@ -58,7 +56,7 @@ void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, ssize_t res2,
|
|||||||
/* order with io_iopoll_req_issued() checking ->iopoll_complete */
|
/* order with io_iopoll_req_issued() checking ->iopoll_complete */
|
||||||
smp_store_release(&req->iopoll_completed, 1);
|
smp_store_release(&req->iopoll_completed, 1);
|
||||||
else
|
else
|
||||||
__io_req_complete(req, issue_flags);
|
__io_req_complete(req, 0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(io_uring_cmd_done);
|
EXPORT_SYMBOL_GPL(io_uring_cmd_done);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user