Commit 5c687c28 authored by Keith Busch's avatar Keith Busch
Browse files

nvme: introduce helper function to get ctrl state



The controller state is typically written by another CPU, so reading it
should ensure no optimizations are taken. This is a repeated pattern in
the driver, so start with adding a convenience function that returns the
controller state with READ_ONCE().

Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent a134cd8d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -387,6 +387,11 @@ struct nvme_ctrl {
	enum nvme_dctype dctype;
};

static inline enum nvme_ctrl_state nvme_ctrl_state(struct nvme_ctrl *ctrl)
{
	return READ_ONCE(ctrl->state);
}

enum nvme_iopolicy {
	NVME_IOPOLICY_NUMA,
	NVME_IOPOLICY_RR,