Skip to content

How to set the number of zones and zone size in ZNS mode #177

@bulliss93

Description

@bulliss93

I am trying to set the number of zones and zone size. I am able to get the FEMU to launch with a zoned device but when I run the nvme-cli command to give zone information I only get 16 zones.

femu@fvm:~$ sudo nvme zns report-zones /dev/nvme0n1
nr_zones: 16
SLBA: 0 WP: 0 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x80000 WP: 0x80000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x100000 WP: 0x100000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x180000 WP: 0x180000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x200000 WP: 0x200000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x280000 WP: 0x280000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x300000 WP: 0x300000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x380000 WP: 0x380000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x400000 WP: 0x400000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x480000 WP: 0x480000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x500000 WP: 0x500000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x580000 WP: 0x580000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x600000 WP: 0x600000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x680000 WP: 0x680000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x700000 WP: 0x700000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0
SLBA: 0x780000 WP: 0x780000 Cap: 0x80000 State: 0x10 Type: 0x2 Attrs: 0 AttrsInfo: 0

The sizes work out to be 4GB total for the device which is what I am running the device size at, but I would like to cut the zone size in half and double the zone count. I tried going into /hw/femu/zns/zns.c and changing the #define NVME_DEFAULT_ZONE_SIZE value from 128MB to 64MB and recompiling but it doesn't change the value of the zone size. Interestingly, the zone size looks to be 0x80000 which is roughly 256MB if I am not mistaken, whereas the size of NVME_DEFAULT_ZONE_SIZE is set originally to 128MB so it seems as if the zone size is getting set elsewhere. Any idea how to change the zone size here?

It looks like in zns.c at line 29 this sets the zone size so I am thinking that n->zone_size_bs is overriding the NVME_DEFAULT_ZONE_SIZE but I can't track down where n->zone_size_bs is set.

if (n->zone_size_bs) {
zone_size = n->zone_size_bs;
} else {
zone_size = NVME_DEFAULT_ZONE_SIZE;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions