[PATCH 3/4] nvme: just check the status code type in nvme_is_path_error
Sagi Grimberg
sagi at grimberg.me
Mon Aug 17 15:31:24 EDT 2020
> 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 at huawei.com>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> drivers/nvme/host/nvme.h | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index dfcdeb318f3ab6..11ee0176fc45f4 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -537,16 +537,7 @@ 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;
> - }
> + return (status & 0x700) == 0x300;
Nit - A little comment may help future readers of this.
More information about the Linux-nvme
mailing list