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

Christoph Hellwig hch at lst.de
Fri Jul 7 02:46:14 PDT 2023


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>
---
 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);
 
-- 
2.39.2




More information about the Linux-nvme mailing list