Re: [PATCH 4/5] nvme: split out metadata vs non metadata end_io uring_cmd completions

Christoph Hellwig
2022-09-23T15:21:22Z

> + union {
> + struct {
> + void *meta; /* kernel-resident buffer */
> + void __user *meta_buffer;
> + };
> + struct {
> + u32 nvme_flags;
> + u32 nvme_status;
> + u64 result;
> + };
> + };

Without naming the arms of the union this is becoming a bit too much
of a mess..

> +static void nvme_uring_task_cb(struct io_uring_cmd *ioucmd)
> +{
> + struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
> + int status;
> +
> + if (pdu->nvme_flags & NVME_REQ_CANCELLED)
> + status = -EINTR;
> + else
> + status = pdu->nvme_status;

If you add a signed int field you only need one field instead of
two in the pdu for this (the nvme status is only 15 bits anyway).