[PATCH 01/13] nvme: add common helpers to allocate and free tagsets

Chao Leng lengchao at huawei.com
Thu Sep 22 01:09:14 PDT 2022



On 2022/9/22 13:48, Christoph Hellwig wrote:
> On Wed, Sep 21, 2022 at 11:25:11AM +0300, Sagi Grimberg wrote:
>>> +	if (ops->map_queues)
>>> +		set->nr_maps = ctrl->opts->nr_poll_queues ? HCTX_MAX_TYPES : 2;
>>> +	ret = blk_mq_alloc_tag_set(set);
>>> +	if (ret)
>>> +		return ret;
>>> +
>>
>> if (ctrl->ops->flags & NVME_F_FABRICS) {
> 
> Incremental fixup:
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index f8d9f32adc87c..91c2cb59c4eb6 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -4877,10 +4877,12 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
>   	if (ret)
>   		return ret;
>   
> -	ctrl->connect_q = blk_mq_init_queue(set);
> -        if (IS_ERR(ctrl->connect_q)) {
> -		ret = PTR_ERR(ctrl->connect_q);
> -		goto out_free_tag_set;
> +	if (ctrl->ops->flags & NVME_F_FABRICS) {
> +		ctrl->connect_q = blk_mq_init_queue(set);
> +        	if (IS_ERR(ctrl->connect_q)) {
> +			ret = PTR_ERR(ctrl->connect_q);
> +			goto out_free_tag_set;
> +		}
>   	}
Maybe we should not add the checking of NVME_F_FABRICS.
+	if (ctrl->ops->flags & NVME_F_FABRICS) {
+		ctrl->fabrics_q = blk_mq_init_queue(set);
+		if (IS_ERR(ctrl->fabrics_q)) {
+			ret = PTR_ERR(ctrl->fabrics_q);
+			goto out_cleanup_admin_q;
+		}
+	}
nvme_alloc_admin_tag_set should not check NVME_F_FABRICS either.
The new helpers is just used for fabrics.
Maybe adding fabric to the function name would make it clearer.
Like this: nvme_alloc_fabric_admin_tag_set.
Thus can avoid confusion with nvme_alloc_admin_tags.
>   
>   	ctrl->tagset = set;
> 
> .
> 



More information about the Linux-nvme mailing list