Skip to content

Commit 63dfa10

Browse files
Christoph Hellwigkeithbusch
authored andcommitted
nvme: move NVME_QUIRK_DEALLOCATE_ZEROES out of nvme_config_discard
Move the handling of the NVME_QUIRK_DEALLOCATE_ZEROES quirk out of nvme_config_discard so that it is combined with the normal write_zeroes limit handling. 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 152694c commit 63dfa10

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,9 +1816,6 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,
18161816
else
18171817
blk_queue_max_discard_segments(queue, NVME_DSM_MAX_RANGES);
18181818
queue->limits.discard_granularity = queue_logical_block_size(queue);
1819-
1820-
if (ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
1821-
blk_queue_max_write_zeroes_sectors(queue, UINT_MAX);
18221819
}
18231820

18241821
static bool nvme_ns_ids_equal(struct nvme_ns_ids *a, struct nvme_ns_ids *b)
@@ -2029,8 +2026,12 @@ static void nvme_update_disk_info(struct nvme_ctrl *ctrl, struct gendisk *disk,
20292026
set_capacity_and_notify(disk, capacity);
20302027

20312028
nvme_config_discard(ctrl, disk, head);
2032-
blk_queue_max_write_zeroes_sectors(disk->queue,
2033-
ctrl->max_zeroes_sectors);
2029+
2030+
if (ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
2031+
blk_queue_max_write_zeroes_sectors(disk->queue, UINT_MAX);
2032+
else
2033+
blk_queue_max_write_zeroes_sectors(disk->queue,
2034+
ctrl->max_zeroes_sectors);
20342035
}
20352036

20362037
static bool nvme_ns_is_readonly(struct nvme_ns *ns, struct nvme_ns_info *info)

0 commit comments

Comments
 (0)