Skip to content

Commit

Permalink
nvme: just check the status code type in nvme_is_path_error
Browse files Browse the repository at this point in the history
Check the SCT sub-field for a path related status instead of enumerating
invididual status code.  As of NVMe 1.4 this adds "Internal Path Error"
and "Controller Pathing Error" to the list, but it also future proofs for
additional status codes added to the category.

Suggested-by: Chao Leng <lengchao@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Aug 21, 2020
1 parent 5ddaabe commit 1e41f3b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions drivers/nvme/host/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,8 @@ static inline bool nvme_is_ana_error(u16 status)

static inline bool nvme_is_path_error(u16 status)
{
switch (status & 0x7ff) {
case NVME_SC_HOST_PATH_ERROR:
case NVME_SC_HOST_ABORTED_CMD:
case NVME_SC_ANA_TRANSITION:
case NVME_SC_ANA_INACCESSIBLE:
case NVME_SC_ANA_PERSISTENT_LOSS:
return true;
default:
return false;
}
/* check for a status code type of 'path related status' */
return (status & 0x700) == 0x300;
}

/*
Expand Down

0 comments on commit 1e41f3b

Please sign in to comment.