Commit 84e4c204 authored by Wu Bo's avatar Wu Bo Committed by Christoph Hellwig

nvme: disable streams when get stream params failed

Disable streams again if getting the stream params fails.
Signed-off-by: default avatarWu Bo <wubo40@huawei.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 614fc1c0
...@@ -552,19 +552,22 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl) ...@@ -552,19 +552,22 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL); ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL);
if (ret) if (ret)
return ret; goto out_disable_stream;
ctrl->nssa = le16_to_cpu(s.nssa); ctrl->nssa = le16_to_cpu(s.nssa);
if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) { if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) {
dev_info(ctrl->device, "too few streams (%u) available\n", dev_info(ctrl->device, "too few streams (%u) available\n",
ctrl->nssa); ctrl->nssa);
nvme_disable_streams(ctrl); goto out_disable_stream;
return 0;
} }
ctrl->nr_streams = min_t(unsigned, ctrl->nssa, BLK_MAX_WRITE_HINTS - 1); ctrl->nr_streams = min_t(unsigned, ctrl->nssa, BLK_MAX_WRITE_HINTS - 1);
dev_info(ctrl->device, "Using %u streams\n", ctrl->nr_streams); dev_info(ctrl->device, "Using %u streams\n", ctrl->nr_streams);
return 0; return 0;
out_disable_stream:
nvme_disable_streams(ctrl);
return ret;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment