> -----Original Message-----
> From: Klaus Jensen <[email protected]>
> Sent: Monday, October 19, 2020 7:43 AM
> To: Dmitry Fomichev <[email protected]>
> Cc: Keith Busch <[email protected]>; Klaus Jensen
> <[email protected]>; Kevin Wolf <[email protected]>; Philippe
> Mathieu-Daudé <[email protected]>; Maxim Levitsky
> <[email protected]>; Fam Zheng <[email protected]>; Niklas Cassel
> <[email protected]>; Damien Le Moal <[email protected]>;
> [email protected]; [email protected]; Alistair Francis
> <[email protected]>; Matias Bjorling <[email protected]>
> Subject: Re: [PATCH v7 08/11] hw/block/nvme: Add injection of Offline/Read-
> Only zones
> 
> On Oct 19 11:17, Dmitry Fomichev wrote:
> > ZNS specification defines two zone conditions for the zones that no
> > longer can function properly, possibly because of flash wear or other
> > internal fault. It is useful to be able to "inject" a small number of
> > such zones for testing purposes.
> >
> > This commit defines two optional device properties, "offline_zones"
> > and "rdonly_zones". Users can assign non-zero values to these variables
> > to specify the number of zones to be initialized as Offline or
> > Read-Only. The actual number of injected zones may be smaller than the
> > requested amount - Read-Only and Offline counts are expected to be much
> > smaller than the total number of zones on a drive.
> >
> > Signed-off-by: Dmitry Fomichev <[email protected]>
> > ---
> >  hw/block/nvme-ns.c | 64
> ++++++++++++++++++++++++++++++++++++++++++++++
> >  hw/block/nvme-ns.h |  2 ++
> >  2 files changed, 66 insertions(+)
> >
> > diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
> > index 255ded2b43..d050f97909 100644
> > --- a/hw/block/nvme-ns.c
> > +++ b/hw/block/nvme-ns.c
> > @@ -21,6 +21,7 @@
> >  #include "sysemu/sysemu.h"
> >  #include "sysemu/block-backend.h"
> >  #include "qapi/error.h"
> > +#include "crypto/random.h"
> >
> >  #include "hw/qdev-properties.h"
> >  #include "hw/qdev-core.h"
> > @@ -132,6 +133,32 @@ static int
> nvme_calc_zone_geometry(NvmeNamespace *ns, Error **errp)
> >          return -1;
> >      }
> >
> > +    if (ns->params.zd_extension_size) {
> > +        if (ns->params.zd_extension_size & 0x3f) {
> > +            error_setg(errp,
> > +                "zone descriptor extension size must be a multiple of 
> > 64B");
> > +            return -1;
> > +        }
> > +        if ((ns->params.zd_extension_size >> 6) > 0xff) {
> > +            error_setg(errp, "zone descriptor extension size is too 
> > large");
> > +            return -1;
> > +        }
> > +    }
> 
> Looks like this should have been added in the previous patch.

Right, this belongs to ZDE patch. 

Reply via email to