public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Guixin Liu <kanie@linux.alibaba.com>
To: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme: move nvme_dsm_range size check to _nvme_check_size()
Date: Tue, 27 Feb 2024 14:05:40 +0800	[thread overview]
Message-ID: <c8f19c2c-82fe-4cc3-b408-bf8040222fba@linux.alibaba.com> (raw)
In-Reply-To: <20240223032947.55086-1-kanie@linux.alibaba.com>

Hi,

     Gentle ping...

Best Regards,

Guixin Liu

在 2024/2/23 11:29, Guixin Liu 写道:
> Move nvme_dsm_range size check to _nvme_check_size(), and remove
> redundant same check.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>   drivers/nvme/host/core.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 5cdd22f591f9..848d4b896fec 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -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);
>   }
>   
>   


  reply	other threads:[~2024-02-27  6:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23  3:29 [PATCH] nvme: move nvme_dsm_range size check to _nvme_check_size() Guixin Liu
2024-02-27  6:05 ` Guixin Liu [this message]
2024-02-27 15:21   ` Christoph Hellwig
2024-03-07  9:39     ` Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8f19c2c-82fe-4cc3-b408-bf8040222fba@linux.alibaba.com \
    --to=kanie@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox