[PATCH 2/4] nvme: update discard limits in nvme_config_discard

Damien Le Moal dlemoal at kernel.org
Sun Jul 9 20:54:50 PDT 2023


On 7/7/23 18:46, Christoph Hellwig wrote:
> nvme_config_discard currently skips updating the discard limits if they
> were set before because blk_queue_max_discard_sectors used to update the
> configurable max_discard_sectors limit unconditionally.  Now that this
> has been fixed we can update the discard limits even if they were set
> to deal with the case of a reset changing the limits after e.g. a
> firmware update.
> 
> Fixes: 3831761eb859 ("nvme: only reconfigure discard if necessary")
> Signed-off-by: Christoph Hellwig <hch at lst.de>

Look OK to me.

Reviewed-by: Damien Le Moal <dlemoal at kernel.org>

> ---
>  drivers/nvme/host/core.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 47d7ba2827ff29..2d6c1f4ad7f5c8 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1734,10 +1734,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
>  
>  	queue->limits.discard_granularity = size;
>  
> -	/* If discard is already enabled, don't reset queue limits */
> -	if (queue->limits.max_discard_sectors)
> -		return;
> -
>  	blk_queue_max_discard_sectors(queue, ctrl->max_discard_sectors);
>  	blk_queue_max_discard_segments(queue, ctrl->max_discard_segments);
>  

-- 
Damien Le Moal
Western Digital Research




More information about the Linux-nvme mailing list