DM-Devel Archive mirror
 help / color / mirror / Atom feed
* [dm-devel] [PATCH] dm zoned: check zone capacity
@ 2021-05-19  1:26 Damien Le Moal
  2021-05-28  8:38 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Le Moal @ 2021-05-19  1:26 UTC (permalink / raw
  To: dm-devel, Mike Snitzer

The dm-zoned target cannot support zoned block devices with zones that
have a capacity smaller than the zone size (e.g. NVMe zoned namespaces)
due to the current chunk zone mapping implementation as it is assumed
that zones and chunks have the same size with all blocks usable.
If a zoned drive is found to have zones with a capacity different from
the zone size, fail the target initialization.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 drivers/md/dm-zoned-metadata.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
index 039d17b28938..ee4626d08557 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -1390,6 +1390,13 @@ static int dmz_init_zone(struct blk_zone *blkz, unsigned int num, void *data)
 		return -ENXIO;
 	}
 
+	/*
+	 * Devices that have zones with a capacity smaller than the zone size
+	 * (e.g. NVMe zoned namespaces) are not supported.
+	 */
+	if (blkz->capacity != blkz->len)
+		return -ENXIO;
+
 	switch (blkz->type) {
 	case BLK_ZONE_TYPE_CONVENTIONAL:
 		set_bit(DMZ_RND, &zone->flags);
-- 
2.31.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [dm-devel] [PATCH] dm zoned: check zone capacity
  2021-05-19  1:26 [dm-devel] [PATCH] dm zoned: check zone capacity Damien Le Moal
@ 2021-05-28  8:38 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2021-05-28  8:38 UTC (permalink / raw
  To: dm-devel@redhat.com, Mike Snitzer

On 2021/05/19 10:26, Damien Le Moal wrote:
> The dm-zoned target cannot support zoned block devices with zones that
> have a capacity smaller than the zone size (e.g. NVMe zoned namespaces)
> due to the current chunk zone mapping implementation as it is assumed
> that zones and chunks have the same size with all blocks usable.
> If a zoned drive is found to have zones with a capacity different from
> the zone size, fail the target initialization.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
>  drivers/md/dm-zoned-metadata.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
> index 039d17b28938..ee4626d08557 100644
> --- a/drivers/md/dm-zoned-metadata.c
> +++ b/drivers/md/dm-zoned-metadata.c
> @@ -1390,6 +1390,13 @@ static int dmz_init_zone(struct blk_zone *blkz, unsigned int num, void *data)
>  		return -ENXIO;
>  	}
>  
> +	/*
> +	 * Devices that have zones with a capacity smaller than the zone size
> +	 * (e.g. NVMe zoned namespaces) are not supported.
> +	 */
> +	if (blkz->capacity != blkz->len)
> +		return -ENXIO;
> +
>  	switch (blkz->type) {
>  	case BLK_ZONE_TYPE_CONVENTIONAL:
>  		set_bit(DMZ_RND, &zone->flags);
> 

Hi Mike,

I just realized that I forgot to add:

Cc: stable@vger.kernel.org # v5.9+

to this patch.

Should I resend ? Or can you add this tag when applying the patch ?

Thanks !

-- 
Damien Le Moal
Western Digital Research



--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-28  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-19  1:26 [dm-devel] [PATCH] dm zoned: check zone capacity Damien Le Moal
2021-05-28  8:38 ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).