[PATCHv3 5/5] nvme: support for zoned namespaces

Johannes Thumshirn Johannes.Thumshirn at wdc.com
Mon Jun 22 12:48:07 EDT 2020


On 22/06/2020 18:25, Keith Busch wrote:
[...]
> +static void *nvme_zns_alloc_report_buffer(struct nvme_ns *ns,
> +					  unsigned int nr_zones, size_t *buflen)
> +{
> +	struct request_queue *q = ns->disk->queue;
> +	size_t bufsize;
> +	void *buf;
> +
> +	const size_t min_bufsize = sizeof(struct nvme_zone_report) +
> +				   sizeof(struct nvme_zone_descriptor);
> +
> +	nr_zones = min_t(unsigned int, nr_zones,
> +			 get_capacity(ns->disk) >> ilog2(ns->zsze));
> +
> +	bufsize = sizeof(struct nvme_zone_report) +
> +		nr_zones * sizeof(struct nvme_zone_descriptor);
> +	bufsize = min_t(size_t, bufsize,
> +			queue_max_hw_sectors(q) << SECTOR_SHIFT);
> +	bufsize = min_t(size_t, bufsize, queue_max_segments(q) << PAGE_SHIFT);
> +
> +	while (bufsize >= min_bufsize) {
> +		buf = __vmalloc(bufsize,
> +				GFP_KERNEL | __GFP_ZERO | __GFP_NORETRY);


Nit: The __GFP_ZERO flag isn't needed as nvme_ns_report_zones() 
calls memset() on the report buffer before submitting it.

[...]

> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 95cd03e240a1..d862e5d70818 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -1,6 +1,7 @@
>  /* SPDX-License-Identifier: GPL-2.0 */
>  /*
> - * Definitions for the NVM Express interface
> + * Definitions for the NVM Ex
> + * ress interface
Accidental line break.

Otherwise:
Reviewed-by: Johannes Thumshirn <johannes.thumshirn at wdc.com>



More information about the Linux-nvme mailing list