Skip to content

Commit f404dd9

Browse files
Christoph Hellwigkeithbusch
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 1b2f5d5 commit f404dd9

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,8 +1724,7 @@ int nvme_getgeo(struct block_device *bdev, struct hd_geometry *geo)
17241724
}
17251725

17261726
#ifdef CONFIG_BLK_DEV_INTEGRITY
1727-
static void nvme_init_integrity(struct gendisk *disk,
1728-
struct nvme_ns_head *head, u32 max_integrity_segments)
1727+
static void nvme_init_integrity(struct gendisk *disk, struct nvme_ns_head *head)
17291728
{
17301729
struct blk_integrity integrity = { };
17311730

@@ -1773,11 +1772,9 @@ static void nvme_init_integrity(struct gendisk *disk,
17731772
integrity.tuple_size = head->ms;
17741773
integrity.pi_offset = head->pi_offset;
17751774
blk_integrity_register(disk, &integrity);
1776-
blk_queue_max_integrity_segments(disk->queue, max_integrity_segments);
17771775
}
17781776
#else
1779-
static void nvme_init_integrity(struct gendisk *disk,
1780-
struct nvme_ns_head *head, u32 max_integrity_segments)
1777+
static void nvme_init_integrity(struct gendisk *disk, struct nvme_ns_head *head)
17811778
{
17821779
}
17831780
#endif /* CONFIG_BLK_DEV_INTEGRITY */
@@ -1954,6 +1951,7 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
19541951
blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
19551952
blk_queue_max_segments(q, min_t(u32, USHRT_MAX,
19561953
min_not_zero(nvme_max_drv_segments(ctrl), ctrl->max_segments)));
1954+
blk_queue_max_integrity_segments(q, ctrl->max_integrity_segments);
19571955
blk_queue_virt_boundary(q, NVME_CTRL_PAGE_SIZE - 1);
19581956
blk_queue_dma_alignment(q, 3);
19591957
blk_queue_write_cache(q, vwc, vwc);
@@ -2017,8 +2015,7 @@ static void nvme_update_disk_info(struct nvme_ctrl *ctrl, struct gendisk *disk,
20172015
if (head->ms) {
20182016
if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) &&
20192017
(head->features & NVME_NS_METADATA_SUPPORTED))
2020-
nvme_init_integrity(disk, head,
2021-
ctrl->max_integrity_segments);
2018+
nvme_init_integrity(disk, head);
20222019
else if (!nvme_ns_has_pi(head))
20232020
capacity = 0;
20242021
}

0 commit comments

Comments
 (0)