[PATCH 16/20] nvme: revalidate zone bitmaps in nvme_update_ns_info

Damien Le Moal Damien.LeMoal at wdc.com
Mon Sep 28 11:06:06 EDT 2020


On 2020/09/28 21:35, Christoph Hellwig wrote:
> Consolidate the two calls into a single place.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  drivers/nvme/host/core.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index f19f6c7c5b1242..9c137d8819f756 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2150,6 +2150,12 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
>  	nvme_update_disk_info(ns->disk, ns, id);
>  	blk_mq_unfreeze_queue(ns->disk->queue);
>  
> +	if (blk_queue_is_zoned(ns->queue)) {
> +		ret = nvme_revalidate_zones(ns);
> +		if (ret)
> +			return ret;
> +	}

Is it OK to call this before nvme_update_ns_info() ?

> +
>  #ifdef CONFIG_NVME_MULTIPATH
>  	if (ns->head->disk) {
>  		blk_mq_freeze_queue(ns->head->disk->queue);
> @@ -3915,8 +3921,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
>  
>  	if (nvme_update_ns_info(ns, id))
>  		goto out_put_disk;
> -	if (blk_queue_is_zoned(ns->queue) && nvme_revalidate_zones(ns))
> -		goto out_put_disk;
>  
>  	if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
>  		ret = nvme_nvm_register(ns, disk_name, node);
> @@ -4012,8 +4016,6 @@ static void nvme_validate_or_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
>  	}
>  
>  	ret = nvme_validate_ns(ns);
> -	if (!ret && blk_queue_is_zoned(ns->queue))
> -		ret = nvme_revalidate_zones(ns);
>  	revalidate_disk_size(ns->disk, ret == 0);
>  	if (ret)
>  		nvme_ns_remove(ns);
> 


-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list