nvme: update the explanation for not updating the limits in nvme_config_discard
authorChristoph Hellwig <hch@lst.de>
Tue, 26 Dec 2023 08:58:41 +0000 (08:58 +0000)
committerKeith Busch <kbusch@kernel.org>
Wed, 3 Jan 2024 16:09:40 +0000 (08:09 -0800)
Expeand the comment a bit to explain what is going on.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c

index d144d1acb09a05ae3fdb824730af4e9819db5c5d..56107cfc97b7bca0ba716d6b7835b301f98f492b 100644 (file)
@@ -1743,7 +1743,13 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,
 
        queue->limits.discard_granularity = size;
 
-       /* If discard is already enabled, don't reset queue limits */
+       /*
+        * If discard is already enabled, don't reset queue limits.
+        *
+        * This works around the fact that the block layer can't cope well with
+        * updating the hardware limits when overridden through sysfs.  This is
+        * harmless because discard limits in NVMe are purely advisory.
+        */
        if (queue->limits.max_discard_sectors)
                return;