Commit 63dfa100 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Keith Busch
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMax Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent 152694c8
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1816,9 +1816,6 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,
	else
		blk_queue_max_discard_segments(queue, NVME_DSM_MAX_RANGES);
	queue->limits.discard_granularity = queue_logical_block_size(queue);

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

static bool nvme_ns_ids_equal(struct nvme_ns_ids *a, struct nvme_ns_ids *b)
@@ -2029,6 +2026,10 @@ static void nvme_update_disk_info(struct nvme_ctrl *ctrl, struct gendisk *disk,
	set_capacity_and_notify(disk, capacity);

	nvme_config_discard(ctrl, disk, head);

	if (ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES)
		blk_queue_max_write_zeroes_sectors(disk->queue, UINT_MAX);
	else
		blk_queue_max_write_zeroes_sectors(disk->queue,
				ctrl->max_zeroes_sectors);
}