• Christoph Hellwig's avatar
    nvme: fix max_discard_sectors calculation · f29886c2
    Christoph Hellwig authored
    ctrl->max_discard_sectors stores a value that is potentially based of
    the DMRSL field in Identify Controller, which is in units of LBAs and
    thus dependent on the Format of a namespace.
    
    Fix this by moving the calculation of max_discard_sectors entirely
    into nvme_config_discard and replacing the ctrl->max_discard_sectors
    value with a local variable so that the calculation is always
    namespace-specific.
    
    Fixes: 1a86924e ("nvme: fix interpretation of DMRSL")
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
    f29886c2
core.c 127 KB