[RFC PATCH] nvmet: Make blksize_shift configurable
Chaitanya Kulkarni
chaitanyak at nvidia.com
Mon Apr 21 23:47:36 PDT 2025
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
More information about the Linux-nvme
mailing list