On 3/31/20 2:57 AM, Damien Le Moal wrote:
On 2020/03/27 16:15, Hannes Reinecke wrote:
Instead of calculating the zone index by the offset within the
zone array store the index within the structure itself.

Signed-off-by: Hannes Reinecke <h...@suse.de>
---
  drivers/md/dm-zoned-metadata.c | 3 ++-
  drivers/md/dm-zoned.h          | 3 +++
  2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
index c8787560fa9f..afce594067fb 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -189,7 +189,7 @@ struct dmz_metadata {
   */
  unsigned int dmz_id(struct dmz_metadata *zmd, struct dm_zone *zone)
  {
-       return ((unsigned int)(zone - zmd->zones));
+       return zone->id;
  }
sector_t dmz_start_sect(struct dmz_metadata *zmd, struct dm_zone *zone)
@@ -1119,6 +1119,7 @@ static int dmz_init_zone(struct blk_zone *blkz, unsigned 
int idx, void *data)
INIT_LIST_HEAD(&zone->link);
        atomic_set(&zone->refcount, 0);
+       zone->id = idx;

See my comment on patch 4. Allowing partial bdev mapping changes the meaning of
this ID: for a partial mapping, this is not equal to the zone number anymore. So
we should document that (in the struct declaration), and may be merge this patch
with patch 4 since they are related so closely ?

See my reply to patch 4. I do not allow for partial mapping, nor was it ever the intention to do so.
The zone numbering will not change.

Cheers,

Hannes
--
Dr. Hannes Reinecke            Teamlead Storage & Networking
h...@suse.de                               +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer


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

Reply via email to