mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
nvme: introduce helper function to get ctrl state
[ Upstream commit 5c687c287c
]
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:
parent
a50562146d
commit
df2bd52354
1 changed files with 5 additions and 0 deletions
|
@ -382,6 +382,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,
|
||||
|
|
Loading…
Reference in a new issue