Commit f404dd92 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Keith Busch

nvme: move max_integrity_segments handling out of nvme_init_integrity

max_integrity_segments is just a hardware limit and doesn't need to be
in nvme_init_integrity with the PI setup.
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 1b2f5d5d
...@@ -1724,8 +1724,7 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo) ...@@ -1724,8 +1724,7 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo)
} }
#ifdef CONFIG_BLK_DEV_INTEGRITY #ifdef CONFIG_BLK_DEV_INTEGRITY
static void nvme_init_integrity(struct gendisk *disk, static void nvme_init_integrity(struct gendisk *disk, struct nvme_ns_head *head)
struct nvme_ns_head *head, u32 max_integrity_segments)
{ {
struct blk_integrity integrity = { }; struct blk_integrity integrity = { };
...@@ -1773,11 +1772,9 @@ static void nvme_init_integrity(struct gendisk *disk, ...@@ -1773,11 +1772,9 @@ static void nvme_init_integrity(struct gendisk *disk,
integrity.tuple_size = head->ms; integrity.tuple_size = head->ms;
integrity.pi_offset = head->pi_offset; integrity.pi_offset = head->pi_offset;
blk_integrity_register(disk, &integrity); blk_integrity_register(disk, &integrity);
blk_queue_max_integrity_segments(disk->queue, max_integrity_segments);
} }
#else #else
static void nvme_init_integrity(struct gendisk *disk, static void nvme_init_integrity(struct gendisk *disk, struct nvme_ns_head *head)
struct nvme_ns_head *head, u32 max_integrity_segments)
{ {
} }
#endif /* CONFIG_BLK_DEV_INTEGRITY */ #endif /* CONFIG_BLK_DEV_INTEGRITY */
...@@ -1954,6 +1951,7 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl, ...@@ -1954,6 +1951,7 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors); blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
blk_queue_max_segments(q, min_t(u32, USHRT_MAX, blk_queue_max_segments(q, min_t(u32, USHRT_MAX,
min_not_zero(nvme_max_drv_segments(ctrl), ctrl->max_segments))); min_not_zero(nvme_max_drv_segments(ctrl), ctrl->max_segments)));
blk_queue_max_integrity_segments(q, ctrl->max_integrity_segments);
blk_queue_virt_boundary(q, NVME_CTRL_PAGE_SIZE - 1); blk_queue_virt_boundary(q, NVME_CTRL_PAGE_SIZE - 1);
blk_queue_dma_alignment(q, 3); blk_queue_dma_alignment(q, 3);
blk_queue_write_cache(q, vwc, vwc); blk_queue_write_cache(q, vwc, vwc);
...@@ -2017,8 +2015,7 @@ static void nvme_update_disk_info(struct nvme_ctrl *ctrl, struct gendisk *disk, ...@@ -2017,8 +2015,7 @@ static void nvme_update_disk_info(struct nvme_ctrl *ctrl, struct gendisk *disk,
if (head->ms) { if (head->ms) {
if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) && if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) &&
(head->features & NVME_NS_METADATA_SUPPORTED)) (head->features & NVME_NS_METADATA_SUPPORTED))
nvme_init_integrity(disk, head, nvme_init_integrity(disk, head);
ctrl->max_integrity_segments);
else if (!nvme_ns_has_pi(head)) else if (!nvme_ns_has_pi(head))
capacity = 0; capacity = 0;
} }
......
Markdown is supported
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