Re: [PATCH 1/2] io_uring/cmd: split io_uring_cmd_set_res() from io_uring_cmd_done()

From: Caleb Sander Mateos

Date: Thu Aug 27 2026 - 17:45:06 EST


On Thu, Aug 27, 2026 at 1:05 PM Joanne Koong <joannelkoong@xxxxxxxxx> wrote:
>
> Hi Caleb,
>
> On Thu, Aug 27, 2026 at 11:57 AM Caleb Sander Mateos
> <csander@xxxxxxxxxxxxxxx> wrote:
> >
> > In preparation for setting the io_uring NVMe passthru CQE results from
> > the blk-mq request completion rather than the task work callback, split
> > out functions io_uring_cmd_set_res{,32}() from io_uring_cmd_done{,32}().
> > This allows io_uring_cmd_done{,32}() and __io_uring_cmd_done() to be
> > consolidated into a single CQE-size-agnostic function with 3 fewer
> > arguments than __io_uring_cmd_done().
> >
>
> The conversion looks logically correct to me but the interface feels a
> bit annoying / fragile on the caller side.
>
> Is there a way nvme can get what it needs without changing the other
> callers? Would it work to just keep the existing
> io_uring_cmd_done{,32}() as is and add a separate API for special
> callers like nvme, eg:
>
> void io_uring_cmd_set_res32(struct io_uring_cmd *cmd, s32 ret, u64 res2);
> void __io_uring_cmd_done(struct io_uring_cmd *cmd, unsigned issue_flags);
>
> where io_uring_cmd_done{,32} would then just be inline wrappers over
> those? afaict, then only the nvme callsite would have to change and
> fuse, btrfs, block, ublk, and scsi_bsg could just stay as is. Do you
> think something like that makes sense to do?

Sure, sounds fine to me. Thanks for taking a look.

Best,
Caleb