From: Daniel Wagner Date: Thu, 13 Jan 2022 18:09:35 +0000 (+0100) Subject: ioctl: Rearrange members in nvme_zns_append_args X-Git-Tag: v1.0-rc0~3^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2fa9cf680d037ac181e10bac65fc6c69da6687f7;p=users%2Fsagi%2Flibnvme.git ioctl: Rearrange members in nvme_zns_append_args Avoid any holes in the struct by rearranging the members. Also add the attribute packed to struct definition to reduce ABI breakage. struct nvme_zns_append_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u64 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 nsid; /* 20 4 */ __u64 zslba; /* 24 8 */ __u16 nlb; /* 32 2 */ __u16 control; /* 34 2 */ __u32 ilbrt; /* 36 4 */ __u16 lbat; /* 40 2 */ __u16 lbatm; /* 42 2 */ __u32 data_len; /* 44 4 */ void * data; /* 48 8 */ void * metadata; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ __u32 metadata_len; /* 64 4 */ /* size: 72, cachelines: 2, members: 15 */ /* padding: 4 */ /* last cacheline: 8 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner --- diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index 73628e17..84e7e3c4 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -4052,6 +4052,8 @@ static inline int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba, /** * nvme_zns_append_args - Arguments for the NVMe ZNS Append command * @fd: File descriptor of nvme device + * @result: The command completion result from CQE dword0 + * @timeout: Timeout in ms * @nsid: Namespace ID * @zslba: Zone start logical block address * @nlb: Number of logical blocks @@ -4061,14 +4063,14 @@ static inline int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba, * @lbatm: Logical block application tag mask * @data_len: Length of @data * @data: Userspace address of the data - * @metadata_len: Length of @metadata * @metadata: Userspace address of the metadata - * @timeout: Timeout in ms - * @result: The command completion result from CQE dword0 + * @metadata_len: Length of @metadata */ struct nvme_zns_append_args { int args_size; int fd; + __u64 *result; + __u32 timeout; __u32 nsid; __u64 zslba; __u16 nlb; @@ -4078,11 +4080,9 @@ struct nvme_zns_append_args { __u16 lbatm; __u32 data_len; void *data; - __u32 metadata_len; void *metadata; - __u32 timeout; - __u64 *result; -}; + __u32 metadata_len; +} __attribute__((packed, aligned(__alignof__(__u64)))); /** * nvme_zns_append() - Append data to a zone