From: Keith Busch <kbusch@meta.com>
To: <linux-nvme@lists.infradead.org>, <hch@lst.de>, <sagi@grimberg.me>
Cc: Keith Busch <kbusch@kernel.org>
Subject: [PATCH] nvme: respect user max_discard_sectors setting
Date: Thu, 4 Jan 2024 11:12:44 -0800 [thread overview]
Message-ID: <20240104191244.737208-1-kbusch@meta.com> (raw)
From: Keith Busch <kbusch@kernel.org>
A user can change that attribute to 0 through sysfs, but they can't
change the hw limit. Check the hw limit instead to know if the driver
previously set up discard capabilities.
Fixes: 70200574cc229 ("block: remove QUEUE_FLAG_DISCARD")
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 50818dbcfa1ae..8d56c102974ee 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1748,7 +1748,7 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,
* 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)
+ if (queue->limits.max_hw_discard_sectors)
return;
blk_queue_max_discard_sectors(queue, max_discard_sectors);
--
2.34.1
next reply other threads:[~2024-01-04 19:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 19:12 Keith Busch [this message]
2024-01-05 4:34 ` [PATCH] nvme: respect user max_discard_sectors setting Christoph Hellwig
2024-01-05 16:07 ` Keith Busch
2024-01-08 8:26 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240104191244.737208-1-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox