Message ID | 20220711110155.649153-3-joshi.k@samsung.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | nvme-multipathing for uring-passthrough | expand |
On Mon, Jul 11, 2022 at 04:31:53PM +0530, Kanchan Joshi wrote: > From: Anuj Gupta <anuj20.g@samsung.com> > > Mark this packed so that we can create bit more space in its container > i.e. io_uring_cmd. This is in preparation to support multipathing on > uring-passthrough. > Move its definition to nvme.h as well. I do not like this. packed structures that contain pointers are inherently dangerous as that will get us into unaligned accesses very quickly. I also do not think we should expose it any more widely than absolutely required. In fact if possible I'd really like to figure out how we can remove this pdu concept entirely an just have a small number of well typed field directly in the uring cmd. This will involved some rework of the passthrough I/O completions so that we can get at the metadata biovecs and integrity data.
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 9227e07f717e..fc02eddd4977 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -340,20 +340,6 @@ struct nvme_uring_data { __u32 timeout_ms; }; -/* - * This overlays struct io_uring_cmd pdu. - * Expect build errors if this grows larger than that. - */ -struct nvme_uring_cmd_pdu { - union { - struct bio *bio; - struct request *req; - }; - void *meta; /* kernel-resident buffer */ - void __user *meta_buffer; - u32 meta_len; -}; - static inline struct nvme_uring_cmd_pdu *nvme_uring_cmd_pdu( struct io_uring_cmd *ioucmd) { diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 7323a2f61126..9d3ff6feda06 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -165,6 +165,20 @@ struct nvme_request { struct nvme_ctrl *ctrl; }; +/* + * This overlays struct io_uring_cmd pdu. + * Expect build errors if this grows larger than that. + */ +struct nvme_uring_cmd_pdu { + union { + struct bio *bio; + struct request *req; + }; + void *meta; /* kernel-resident buffer */ + void __user *meta_buffer; + u32 meta_len; +} __packed; + /* * Mark a bio as coming in through the mpath node. */