[PATCH] nvme: respect user max_discard_sectors setting

Christoph Hellwig hch at lst.de
Thu Jan 4 20:34:01 PST 2024


On Thu, Jan 04, 2024 at 11:12:44AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch at 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.

blk_queue_max_discard_sectors updates the hardware and user limit.
It's a bit of a mess, but Jens didn't quite like my half-hearted fix
last time.  If we want to do this properly we probably need a separate
user limit and recalculate the effective limit when either the hw or
user limit changes.  For early in the 6.9 merge window I plan to redo
how all the limits are set, and that should give us a better opportunity
for these kinds of things




More information about the Linux-nvme mailing list