Skip to content

Commit a02b9f1

Browse files
hreineckedwsuse
authored andcommitted
Inline nvme_flush()
nvme_flush() is a trivial wrapper around nvme_submit_io_passthru(), so inline it instead of carrying a function in the library. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 7eb8331 commit a02b9f1

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/nvme/ioctl.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,16 +1542,6 @@ int nvme_io_passthru(int fd, __u8 opcode, __u8 flags, __u16 rsvd,
15421542
data, metadata_len, metadata, timeout_ms, result);
15431543
}
15441544

1545-
int nvme_flush(int fd, __u32 nsid)
1546-
{
1547-
struct nvme_passthru_cmd cmd = {
1548-
.opcode = nvme_cmd_flush,
1549-
.nsid = nsid,
1550-
};
1551-
1552-
return nvme_submit_io_passthru(fd, &cmd, NULL);
1553-
}
1554-
15551545
int nvme_io(struct nvme_io_args *args, __u8 opcode)
15561546
{
15571547
__u32 cdw2 = args->storage_tag & 0xffffffff;

src/nvme/ioctl.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3567,7 +3567,14 @@ int nvme_virtual_mgmt(struct nvme_virtual_mgmt_args *args);
35673567
* Return: The nvme command status if a response was received (see
35683568
* &enum nvme_status_field) or -1 with errno set otherwise.
35693569
*/
3570-
int nvme_flush(int fd, __u32 nsid);
3570+
static inline int nvme_flush(int fd, __u32 nsid) {
3571+
struct nvme_passthru_cmd cmd = {};
3572+
3573+
cmd.opcode = nvme_cmd_flush;
3574+
cmd.nsid = nsid;
3575+
3576+
return nvme_submit_io_passthru(fd, &cmd, NULL);
3577+
}
35713578

35723579
/**
35733580
* nvme_io_args - Arguments for NVMe I/O commands

0 commit comments

Comments
 (0)