nvme: move nvme_dsm_range size check to _nvme_check_size()
PATCH 1/1 nvme: move nvme_dsm_range size check to _nvme_check_size()
Move nvme_dsm_range size check to _nvme_check_size(), and remove redundant same check.
Signed-off-by Guixin Liu <[email protected]>
--- drivers/nvme/host/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/nvme/host/core.c +2 -5
@@ -1800,9 +1800,6 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,return ; } -BUILD_BUG_ON (PAGE_SIZE /sizeof (struct nvme_dsm_range ) < -NVME_DSM_MAX_RANGES ); -/* * If discard is already enabled, don't reset queue limits. *
@@ -4602,8 +4599,6 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, ctrl->ka_cmd.common.opcode = nvme_admin_keep_alive; ctrl->ka_last_check_time = jiffies; -BUILD_BUG_ON (NVME_DSM_MAX_RANGES *sizeof (struct nvme_dsm_range ) > -PAGE_SIZE ); ctrl->discard_page =alloc_page (GFP_KERNEL );if (!ctrl->discard_page) { ret = -ENOMEM ;
@@ -4823,6 +4818,8 @@ static inline void _nvme_check_size(void)BUILD_BUG_ON (sizeof (struct nvme_dbbuf ) !=64 );BUILD_BUG_ON (sizeof (struct nvme_directive_cmd ) !=64 );BUILD_BUG_ON (sizeof (struct nvme_feat_host_behavior ) !=512 ); +BUILD_BUG_ON (NVME_DSM_MAX_RANGES *sizeof (struct nvme_dsm_range ) > +PAGE_SIZE ); }
Signature · 1 line
2.43.0
Hi,
Gentle ping...
Best Regards,
Guixin Liu
Quoted 40 lines · Guixin Liu
Move
nvme_dsm_rangesize check to_nvme_check_size(), and remove redundant same check.Signed-off-by Guixin Liu <[email protected]>--- drivers/nvme/host/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/nvme/host/core.c +2
-5@@ -1800,9 +1800,6 @@ static void nvme_config_discard(struct nvme_ctrl *ctrl, struct gendisk *disk,return ; } -BUILD_BUG_ON (PAGE_SIZE /sizeof (struct nvme_dsm_range ) < -NVME_DSM_MAX_RANGES ); -/* * If discard is already enabled, don't reset queue limits. * @@ -4602,8 +4599,6 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, ctrl->ka_cmd.common.opcode = nvme_admin_keep_alive; ctrl->ka_last_check_time = jiffies; -BUILD_BUG_ON (NVME_DSM_MAX_RANGES *sizeof (struct nvme_dsm_range ) > -PAGE_SIZE ); ctrl->discard_page =alloc_page (GFP_KERNEL );if (!ctrl->discard_page) { ret = -ENOMEM ;@@ -4823,6 +4818,8 @@ static inline void _nvme_check_size(void)BUILD_BUG_ON (sizeof (struct nvme_dbbuf ) !=64 );BUILD_BUG_ON (sizeof (struct nvme_directive_cmd ) !=64 );BUILD_BUG_ON (sizeof (struct nvme_feat_host_behavior ) !=512 ); +BUILD_BUG_ON (NVME_DSM_MAX_RANGES *sizeof (struct nvme_dsm_range ) > +PAGE_SIZE ); }
Christoph Hellwig
maintainerThis is not a check for a spec provided struct size, so it should not be grouped with them.
Sagi Grimberg
maintainerQuoted 3 lines · Christoph Hellwig
This is not a check for a spec provided struct size, so it should not be grouped with them.
Agreed.