[PATCH 1/9] nvme-fc: add a helper to initialize connect_q
Chaitanya Kulkarni
chaitanyak at nvidia.com
Fri Jan 28 01:23:23 PST 2022
(+CC James james.smart at broadcom.com)
On 1/28/22 1:20 AM, Chaitanya Kulkarni wrote:
> From: Chaitanya Kulkarni <kch at nvidia.com>
>
> Add and use helper to remove duplicate code for fabrics connect_q
> initialization from all the transports.
>
> Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
> ---
> drivers/nvme/host/fc.c | 6 ++----
> drivers/nvme/host/nvme.h | 8 ++++++++
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index 71b3108c22f0..23c896a138a3 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -2916,11 +2916,9 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
>
> ctrl->ctrl.tagset = &ctrl->tag_set;
>
> - ctrl->ctrl.connect_q = blk_mq_init_queue(&ctrl->tag_set);
> - if (IS_ERR(ctrl->ctrl.connect_q)) {
> - ret = PTR_ERR(ctrl->ctrl.connect_q);
> + ret = nvme_ctrl_init_connect_q(&(ctrl->ctrl));
> + if (ret)
> goto out_free_tag_set;
> - }
>
> ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
> if (ret)
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index a162f6c6da6e..f8658f984d64 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -894,6 +894,14 @@ static inline int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf)
> }
> #endif
>
> +static inline int nvme_ctrl_init_connect_q(struct nvme_ctrl *ctrl)
> +{
> + ctrl->connect_q = blk_mq_init_queue(ctrl->tagset);
> + if (IS_ERR(ctrl->connect_q))
> + return PTR_ERR(ctrl->connect_q);
> + return 0;
> +}
> +
> static inline struct nvme_ns *nvme_get_ns_from_dev(struct device *dev)
> {
> return dev_to_disk(dev)->private_data;
>
More information about the Linux-nvme
mailing list