nvme: introduce helper function to get ctrl state
[ Upstream commit 5c687c287c46fadb14644091823298875a5216aa ] 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: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
a8b1ddeeac
commit
fb2f34d939
@@ -354,6 +354,11 @@ struct nvme_ctrl {
|
|||||||
struct nvme_fault_inject fault_inject;
|
struct nvme_fault_inject fault_inject;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline enum nvme_ctrl_state nvme_ctrl_state(struct nvme_ctrl *ctrl)
|
||||||
|
{
|
||||||
|
return READ_ONCE(ctrl->state);
|
||||||
|
}
|
||||||
|
|
||||||
enum nvme_iopolicy {
|
enum nvme_iopolicy {
|
||||||
NVME_IOPOLICY_NUMA,
|
NVME_IOPOLICY_NUMA,
|
||||||
NVME_IOPOLICY_RR,
|
NVME_IOPOLICY_RR,
|
||||||
|
Reference in New Issue
Block a user