[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bdf2b8c4-366d-4f04-915b-c2f374eddcba@nvidia.com>
Date: Tue, 22 Apr 2025 06:47:36 +0000
From: Chaitanya Kulkarni <chaitanyak@...dia.com>
To: Richard Weinberger <richard@....at>, "linux-nvme@...ts.infradead.org"
<linux-nvme@...ts.infradead.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Chaitanya
Kulkarni <chaitanyak@...dia.com>, "sagi@...mberg.me" <sagi@...mberg.me>,
"hch@....de" <hch@....de>, "upstream+nvme@...ma-star.at"
<upstream+nvme@...ma-star.at>
Subject: Re: [RFC PATCH] nvmet: Make blksize_shift configurable
On 4/18/25 02:08, Richard Weinberger wrote:
> +static ssize_t nvmet_ns_blksize_shift_store(struct config_item *item,
> + const char *page, size_t count)
> +{
> + struct nvmet_ns *ns = to_nvmet_ns(item);
> + u32 shift;
> + int ret;
> +
> + ret = kstrtou32(page, 0, &shift);
> + if (ret)
> + return ret;
> +
> + mutex_lock(&ns->subsys->lock);
> + if (ns->enabled) {
> + pr_err("the ns:%d is already enabled.\n", ns->nsid);
> + mutex_unlock(&ns->subsys->lock);
> + return -EINVAL;
> + }
> + ns->blksize_shift = shift;
> + mutex_unlock(&ns->subsys->lock);
> +
> + return count;
> +}
before we overwrite the old value in ns->blksize_shift don't we need
to make sure new value shift is in the acceptable range ? in case value
is not within the acceptable range then we need to return -EINVAL ?
Also, do we need to #define min and max values for the acceptable
range?
-ck
Powered by blists - more mailing lists