aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-12-26 08:58:41 +0000
committerKeith Busch <kbusch@kernel.org>2024-01-03 08:09:40 -0800
commitd3074e9a73e3c0511f1033b15345e2feb9664b3c (patch)
treeaf12980759820f74aa2516f3db70dfcd62d114af /drivers/nvme
parent3a96bff229d6e3016805fd6c3dba0655ccba01eb (diff)
downloadlinux-d3074e9a73e3c0511f1033b15345e2feb9664b3c.tar.gz
nvme: update the explanation for not updating the limits in nvme_config_discard
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>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d144d1acb09a0..56107cfc97b7b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -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;