Re: [PATCH for-6.0 v2 3/8] hw/block/nvme: fix the nsid 'invalid' value

2021-04-06 Thread Klaus Jensen
On Apr  6 08:53, Philippe Mathieu-Daudé wrote:
> Hi Klaus,
> 
> On 4/5/21 7:54 PM, Klaus Jensen wrote:
> > From: Klaus Jensen 
> > 
> > The `nvme_nsid()` function returns '-1' (h) when the given
> > namespace is NULL. Since h is actually a valid namespace
> > identifier (the "broadcast" value), change this to be '0' since that
> > actually *is* the invalid value.
> > 
> > Signed-off-by: Klaus Jensen 
> > Reviewed-by: Gollu Appalanaidu 
> > ---
> >  hw/block/nvme-ns.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
> > index 9ab7894fc83e..82340c4b2574 100644
> > --- a/hw/block/nvme-ns.h
> > +++ b/hw/block/nvme-ns.h
> > @@ -96,7 +96,7 @@ static inline uint32_t nvme_nsid(NvmeNamespace *ns)
> >  return ns->params.nsid;
> >  }
> >  
> > -return -1;
> > +return 0;
> 
> For 6.1 can you add a NVME_NSID_INVALID definition along
> NVME_NSID_BROADCAST and use it here?
> 

Good idea Philippe, I'll write that up, thanks!


signature.asc
Description: PGP signature


Re: [PATCH for-6.0 v2 3/8] hw/block/nvme: fix the nsid 'invalid' value

2021-04-06 Thread Philippe Mathieu-Daudé
Hi Klaus,

On 4/5/21 7:54 PM, Klaus Jensen wrote:
> From: Klaus Jensen 
> 
> The `nvme_nsid()` function returns '-1' (h) when the given
> namespace is NULL. Since h is actually a valid namespace
> identifier (the "broadcast" value), change this to be '0' since that
> actually *is* the invalid value.
> 
> Signed-off-by: Klaus Jensen 
> Reviewed-by: Gollu Appalanaidu 
> ---
>  hw/block/nvme-ns.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
> index 9ab7894fc83e..82340c4b2574 100644
> --- a/hw/block/nvme-ns.h
> +++ b/hw/block/nvme-ns.h
> @@ -96,7 +96,7 @@ static inline uint32_t nvme_nsid(NvmeNamespace *ns)
>  return ns->params.nsid;
>  }
>  
> -return -1;
> +return 0;

For 6.1 can you add a NVME_NSID_INVALID definition along
NVME_NSID_BROADCAST and use it here?

>  }
>  
>  static inline bool nvme_ns_shared(NvmeNamespace *ns)
> 




[PATCH for-6.0 v2 3/8] hw/block/nvme: fix the nsid 'invalid' value

2021-04-05 Thread Klaus Jensen
From: Klaus Jensen 

The `nvme_nsid()` function returns '-1' (h) when the given
namespace is NULL. Since h is actually a valid namespace
identifier (the "broadcast" value), change this to be '0' since that
actually *is* the invalid value.

Signed-off-by: Klaus Jensen 
Reviewed-by: Gollu Appalanaidu 
---
 hw/block/nvme-ns.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
index 9ab7894fc83e..82340c4b2574 100644
--- a/hw/block/nvme-ns.h
+++ b/hw/block/nvme-ns.h
@@ -96,7 +96,7 @@ static inline uint32_t nvme_nsid(NvmeNamespace *ns)
 return ns->params.nsid;
 }
 
-return -1;
+return 0;
 }
 
 static inline bool nvme_ns_shared(NvmeNamespace *ns)
-- 
2.31.1