> +static int blk_bio_poll_io(struct io_context *submit_ioc,
> +             struct io_context *poll_ioc)

Givem that poll_ioc is always current->io_context there is no
need to pass it.

> +     struct blk_bio_poll_ctx *poll_ctx = poll_ioc ?
> +             poll_ioc->data : NULL;

and it really should not be NULL here, should it?

> +static int __blk_bio_poll(blk_qc_t cookie)
> +{
> +     struct io_context *poll_ioc = current->io_context;
> +     pid_t pid;
> +     struct task_struct *submit_task;
> +     int ret;
> +
> +     pid = (pid_t)cookie;
> +
> +     /* io poll often share io submission context */
> +     if (likely(current->pid == pid && blk_bio_ioc_valid(current)))
> +             return blk_bio_poll_io(poll_ioc, poll_ioc);
> +
> +     submit_task = find_get_task_by_vpid(pid);
> +     if (likely(blk_bio_ioc_valid(submit_task)))
> +             ret = blk_bio_poll_io(submit_task->io_context, poll_ioc);
> +     else
> +             ret = 0;
> +     if (likely(submit_task))
> +             put_task_struct(submit_task);

Wouldn't it make more sense to just store the submitting context
in the bio, even if that uses more space?  Having to call
find_get_task_by_vpid in the poll context seems rather problematic.

Note that this requires doing the refacoring to get rid of the separate
blk_qc_t passed up the stack I asked for earlier, but hiding all these
details seems like a really useful change anyway.

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to