Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvmet: use PAGE_SECTORS_SHIFT

Replace occurences of the pattern "PAGE_SHIFT - 9" in the passthru and
loop targets with PAGE_SECTORS_SHIFT.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Damien Le Moal and committed by
Keith Busch
9bcf156f e5bb0988

+3 -3
+1 -1
drivers/nvme/target/loop.c
··· 373 373 goto out_cleanup_tagset; 374 374 375 375 ctrl->ctrl.max_hw_sectors = 376 - (NVME_LOOP_MAX_SEGMENTS - 1) << (PAGE_SHIFT - 9); 376 + (NVME_LOOP_MAX_SEGMENTS - 1) << PAGE_SECTORS_SHIFT; 377 377 378 378 nvme_unquiesce_admin_queue(&ctrl->ctrl); 379 379
+2 -2
drivers/nvme/target/passthru.c
··· 102 102 * which depends on the host's memory fragementation. To solve this, 103 103 * ensure mdts is limited to the pages equal to the number of segments. 104 104 */ 105 - max_hw_sectors = min_not_zero(pctrl->max_segments << (PAGE_SHIFT - 9), 105 + max_hw_sectors = min_not_zero(pctrl->max_segments << PAGE_SECTORS_SHIFT, 106 106 pctrl->max_hw_sectors); 107 107 108 108 /* 109 109 * nvmet_passthru_map_sg is limitted to using a single bio so limit 110 110 * the mdts based on BIO_MAX_VECS as well 111 111 */ 112 - max_hw_sectors = min_not_zero(BIO_MAX_VECS << (PAGE_SHIFT - 9), 112 + max_hw_sectors = min_not_zero(BIO_MAX_VECS << PAGE_SECTORS_SHIFT, 113 113 max_hw_sectors); 114 114 115 115 page_shift = NVME_CAP_MPSMIN(ctrl->cap) + 12;