[PATCH 14/16] nvme: use the atomic queue limits update API

Kanchan Joshi joshi.k at samsung.com
Tue Mar 26 03:24:49 PDT 2024


On 3/4/2024 7:34 PM, Christoph Hellwig wrote:
> @@ -2098,11 +2091,26 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
>   	ns->head->nuse = le64_to_cpu(id->nuse);
>   	capacity = nvme_lba_to_sect(ns->head, le64_to_cpu(id->nsze));
>   
> -	nvme_set_queue_limits(ns->ctrl, ns->queue);
> +	lim = queue_limits_start_update(ns->disk->queue);
> +	nvme_set_ctrl_limits(ns->ctrl, &lim);
>   	nvme_configure_metadata(ns->ctrl, ns->head, id, nvm);
> -	nvme_set_chunk_sectors(ns, id);
> -	if (!nvme_update_disk_info(ns, id))
> +	nvme_set_chunk_sectors(ns, id, &lim);
> +	if (!nvme_update_disk_info(ns, id, &lim))
>   		capacity = 0;
> +	nvme_config_discard(ns, &lim);
> +	if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) &&
> +	    ns->head->ids.csi == NVME_CSI_ZNS) {
> +		ret = nvme_update_zone_info(ns, lbaf, &lim);
> +		if (ret) {
> +			blk_mq_unfreeze_queue(ns->disk->queue);
> +			goto out;
> +		}
> +	}
> +	ret = queue_limits_commit_update(ns->disk->queue, &lim);
> +	if (ret) {
> +		blk_mq_unfreeze_queue(ns->disk->queue);
> +		goto out;
> +	}

Not sure if this has been discussed already.
But do we need something that does not update the limit but still 
releases the mutex (q->limits_lock)?
If nvme_update_zone_info() returns error, the mutex will not be released.



More information about the Linux-nvme mailing list