Skip to content

Commit 2fa9cf6

Browse files
committed
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 <[email protected]>
1 parent 727b8b0 commit 2fa9cf6

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/nvme/ioctl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,8 @@ static inline int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba,
40524052
/**
40534053
* nvme_zns_append_args - Arguments for the NVMe ZNS Append command
40544054
* @fd: File descriptor of nvme device
4055+
* @result: The command completion result from CQE dword0
4056+
* @timeout: Timeout in ms
40554057
* @nsid: Namespace ID
40564058
* @zslba: Zone start logical block address
40574059
* @nlb: Number of logical blocks
@@ -4061,14 +4063,14 @@ static inline int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba,
40614063
* @lbatm: Logical block application tag mask
40624064
* @data_len: Length of @data
40634065
* @data: Userspace address of the data
4064-
* @metadata_len: Length of @metadata
40654066
* @metadata: Userspace address of the metadata
4066-
* @timeout: Timeout in ms
4067-
* @result: The command completion result from CQE dword0
4067+
* @metadata_len: Length of @metadata
40684068
*/
40694069
struct nvme_zns_append_args {
40704070
int args_size;
40714071
int fd;
4072+
__u64 *result;
4073+
__u32 timeout;
40724074
__u32 nsid;
40734075
__u64 zslba;
40744076
__u16 nlb;
@@ -4078,11 +4080,9 @@ struct nvme_zns_append_args {
40784080
__u16 lbatm;
40794081
__u32 data_len;
40804082
void *data;
4081-
__u32 metadata_len;
40824083
void *metadata;
4083-
__u32 timeout;
4084-
__u64 *result;
4085-
};
4084+
__u32 metadata_len;
4085+
} __attribute__((packed, aligned(__alignof__(__u64))));
40864086

40874087
/**
40884088
* nvme_zns_append() - Append data to a zone

0 commit comments

Comments
 (0)