Skip to content

Commit a4be967

Browse files
Christoph Hellwigkeithbusch
authored andcommitted
nvme: also skip discard granularity updates in nvme_config_discard
Don't just skip the discard sectors and segments but also the granularity if a value was already set before. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent d3074e9 commit a4be967

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,6 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,
17271727
struct nvme_ns_head *head)
17281728
{
17291729
struct request_queue *queue = disk->queue;
1730-
u32 size = queue_logical_block_size(queue);
17311730

17321731
if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(head, UINT_MAX))
17331732
ctrl->max_discard_sectors =
@@ -1741,8 +1740,6 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,
17411740
BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
17421741
NVME_DSM_MAX_RANGES);
17431742

1744-
queue->limits.discard_granularity = size;
1745-
17461743
/*
17471744
* If discard is already enabled, don't reset queue limits.
17481745
*
@@ -1755,6 +1752,7 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,
17551752

17561753
blk_queue_max_discard_sectors(queue, ctrl->max_discard_sectors);
17571754
blk_queue_max_discard_segments(queue, ctrl->max_discard_segments);
1755+
queue->limits.discard_granularity = queue_logical_block_size(queue);
17581756

17591757
if (ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
17601758
blk_queue_max_write_zeroes_sectors(queue, UINT_MAX);

0 commit comments

Comments
 (0)