[RFC PATCH v3 1/3] io_uring: add helper for uring_cmd completion in submitter-task
Stefan Metzmacher
metze at samba.org
Tue Mar 16 15:43:12 GMT 2021
Hi Kanchan,
> +static void uring_cmd_work(struct callback_head *cb)
> +{
> + struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
> + struct io_uring_cmd *cmd = &req->uring_cmd;
> +
> + req->driver_cb(cmd);
> +}
> +int uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
> + void (*driver_cb)(struct io_uring_cmd *))
> +{
> + int ret;
> + struct io_kiocb *req = container_of(ioucmd, struct io_kiocb, uring_cmd);
> +
> + req->driver_cb = driver_cb;
> + req->task_work.func = uring_cmd_work;
> + ret = io_req_task_work_add(req);
> + if (unlikely(ret)) {
> + req->result = -ECANCELED;
> + percpu_ref_get(&req->ctx->refs);
> + io_req_task_work_add_fallback(req, io_req_task_cancel);
> + }
> + return ret;
> +}
> +EXPORT_SYMBOL(uring_cmd_complete_in_task);
I think this should be have an io_ prefix:
io_uring_cmd_complete_in_task()
I'll let Jens comment if this is needed at all...
metze
More information about the Linux-nvme
mailing list