Skip to content
Commit 012c045d authored by Keith Busch's avatar Keith Busch Committed by Greg Kroah-Hartman
Browse files

nvme: fix discard support without oncs



[ Upstream commit d3205ab7 ]

The device can report discard support without setting the ONCS DSM bit.
When not set, the driver clears max_discard_size expecting it to be set
later. We don't know the size until we have the namespace format,
though, so setting it is deferred until configuring one, but the driver
was abandoning the discard settings due to that initial clearing.

Move the max_discard_size calculation above the check for a '0' discard
size.

Fixes: 1a86924e ("nvme: fix interpretation of DMRSL")
Reported-by: default avatarLaurence Oberman <loberman@redhat.com>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Tested-by: default avatarLaurence Oberman <loberman@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6e06a68f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment