@@ -156,7 +156,7 @@ void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl)
156156 if (!ns -> head -> disk )
157157 continue ;
158158 kblockd_schedule_work (& ns -> head -> requeue_work );
159- if (ctrl -> state == NVME_CTRL_LIVE )
159+ if (nvme_ctrl_state ( ns -> ctrl ) == NVME_CTRL_LIVE )
160160 disk_uevent (ns -> head -> disk , KOBJ_CHANGE );
161161 }
162162 up_read (& ctrl -> namespaces_rwsem );
@@ -223,13 +223,14 @@ void nvme_mpath_revalidate_paths(struct nvme_ns *ns)
223223
224224static bool nvme_path_is_disabled (struct nvme_ns * ns )
225225{
226+ enum nvme_ctrl_state state = nvme_ctrl_state (ns -> ctrl );
227+
226228 /*
227229 * We don't treat NVME_CTRL_DELETING as a disabled path as I/O should
228230 * still be able to complete assuming that the controller is connected.
229231 * Otherwise it will fail immediately and return to the requeue list.
230232 */
231- if (ns -> ctrl -> state != NVME_CTRL_LIVE &&
232- ns -> ctrl -> state != NVME_CTRL_DELETING )
233+ if (state != NVME_CTRL_LIVE && state != NVME_CTRL_DELETING )
233234 return true;
234235 if (test_bit (NVME_NS_ANA_PENDING , & ns -> flags ) ||
235236 !test_bit (NVME_NS_READY , & ns -> flags ))
@@ -331,7 +332,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head,
331332
332333static inline bool nvme_path_is_optimized (struct nvme_ns * ns )
333334{
334- return ns -> ctrl -> state == NVME_CTRL_LIVE &&
335+ return nvme_ctrl_state ( ns -> ctrl ) == NVME_CTRL_LIVE &&
335336 ns -> ana_state == NVME_ANA_OPTIMIZED ;
336337}
337338
@@ -358,7 +359,7 @@ static bool nvme_available_path(struct nvme_ns_head *head)
358359 list_for_each_entry_rcu (ns , & head -> list , siblings ) {
359360 if (test_bit (NVME_CTRL_FAILFAST_EXPIRED , & ns -> ctrl -> flags ))
360361 continue ;
361- switch (ns -> ctrl -> state ) {
362+ switch (nvme_ctrl_state ( ns -> ctrl ) ) {
362363 case NVME_CTRL_LIVE :
363364 case NVME_CTRL_RESETTING :
364365 case NVME_CTRL_CONNECTING :
@@ -667,7 +668,7 @@ static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc,
667668 * controller is ready.
668669 */
669670 if (nvme_state_is_live (ns -> ana_state ) &&
670- ns -> ctrl -> state == NVME_CTRL_LIVE )
671+ nvme_ctrl_state ( ns -> ctrl ) == NVME_CTRL_LIVE )
671672 nvme_mpath_set_live (ns );
672673}
673674
@@ -748,7 +749,7 @@ static void nvme_ana_work(struct work_struct *work)
748749{
749750 struct nvme_ctrl * ctrl = container_of (work , struct nvme_ctrl , ana_work );
750751
751- if (ctrl -> state != NVME_CTRL_LIVE )
752+ if (nvme_ctrl_state ( ctrl ) != NVME_CTRL_LIVE )
752753 return ;
753754
754755 nvme_read_ana_log (ctrl );
0 commit comments