Re: [PATCH 5/5] nvme-pci: Use standard block status macro

2020-07-08 Thread Christoph Hellwig
On Tue, Jul 07, 2020 at 12:01:23PM -0700, Keith Busch wrote:
> On Fri, Jul 03, 2020 at 10:49:24AM +0800, Baolin Wang wrote:
> >  static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request 
> > *req,
> > @@ -844,7 +844,7 @@ static blk_status_t nvme_map_metadata(struct nvme_dev 
> > *dev, struct request *req,
> > if (dma_mapping_error(dev->dev, iod->meta_dma))
> > return BLK_STS_IOERR;
> > cmnd->rw.metadata = cpu_to_le64(iod->meta_dma);
> > -   return 0;
> > +   return BLK_STS_OK;
> >  }
> 
> This is fine, though it takes knowing that this value is 0 for the
> subsequent 'if (!ret)' check to make sense. Maybe those should change to
> 'if (ret != BLK_STS_OK)' so the check uses the same symbol as the
> return, and will always work in the unlikely event that the defines
> are reordered.

If you think this version is inconsistent I'd rather drop this patch.
The assumption that 0 == BLK_STS_OK is inherent all over the code.


Re: [PATCH 5/5] nvme-pci: Use standard block status macro

2020-07-07 Thread Baolin Wang
On Tue, Jul 07, 2020 at 12:01:23PM -0700, Keith Busch wrote:
> On Fri, Jul 03, 2020 at 10:49:24AM +0800, Baolin Wang wrote:
> >  static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request 
> > *req,
> > @@ -844,7 +844,7 @@ static blk_status_t nvme_map_metadata(struct nvme_dev 
> > *dev, struct request *req,
> > if (dma_mapping_error(dev->dev, iod->meta_dma))
> > return BLK_STS_IOERR;
> > cmnd->rw.metadata = cpu_to_le64(iod->meta_dma);
> > -   return 0;
> > +   return BLK_STS_OK;
> >  }
> 
> This is fine, though it takes knowing that this value is 0 for the
> subsequent 'if (!ret)' check to make sense. Maybe those should change to
> 'if (ret != BLK_STS_OK)' so the check uses the same symbol as the
> return, and will always work in the unlikely event that the defines
> are reordered.

Okay, I will send another patch to convert to 'if (ret != BLK_STS_OK)'
validation. Thanks.



Re: [PATCH 5/5] nvme-pci: Use standard block status macro

2020-07-07 Thread Keith Busch
On Fri, Jul 03, 2020 at 10:49:24AM +0800, Baolin Wang wrote:
>  static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
> @@ -844,7 +844,7 @@ static blk_status_t nvme_map_metadata(struct nvme_dev 
> *dev, struct request *req,
>   if (dma_mapping_error(dev->dev, iod->meta_dma))
>   return BLK_STS_IOERR;
>   cmnd->rw.metadata = cpu_to_le64(iod->meta_dma);
> - return 0;
> + return BLK_STS_OK;
>  }

This is fine, though it takes knowing that this value is 0 for the
subsequent 'if (!ret)' check to make sense. Maybe those should change to
'if (ret != BLK_STS_OK)' so the check uses the same symbol as the
return, and will always work in the unlikely event that the defines
are reordered.


Re: [PATCH 5/5] nvme-pci: Use standard block status macro

2020-07-05 Thread Chaitanya Kulkarni
On 7/2/20 7:55 PM, Baolin Wang wrote:
> Use standard block status macro.
> 
> Signed-off-by: Baolin Wang

Looks good.

Reviewed-by: Chaitanya Kulkarni 


Re: [PATCH 5/5] nvme-pci: Use standard block status macro

2020-07-05 Thread Sagi Grimberg

Reviewed-by: Sagi Grimberg 


[PATCH 5/5] nvme-pci: Use standard block status macro

2020-07-02 Thread Baolin Wang
Use standard block status macro.

Signed-off-by: Baolin Wang 
---
 drivers/nvme/host/pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 235ba34..616163a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -762,7 +762,7 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev 
*dev,
cmnd->dptr.prp1 = cpu_to_le64(iod->first_dma);
if (bv->bv_len > first_prp_len)
cmnd->dptr.prp2 = cpu_to_le64(iod->first_dma + first_prp_len);
-   return 0;
+   return BLK_STS_OK;
 }
 
 static blk_status_t nvme_setup_sgl_simple(struct nvme_dev *dev,
@@ -780,7 +780,7 @@ static blk_status_t nvme_setup_sgl_simple(struct nvme_dev 
*dev,
cmnd->dptr.sgl.addr = cpu_to_le64(iod->first_dma);
cmnd->dptr.sgl.length = cpu_to_le32(iod->dma_len);
cmnd->dptr.sgl.type = NVME_SGL_FMT_DATA_DESC << 4;
-   return 0;
+   return BLK_STS_OK;
 }
 
 static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
@@ -844,7 +844,7 @@ static blk_status_t nvme_map_metadata(struct nvme_dev *dev, 
struct request *req,
if (dma_mapping_error(dev->dev, iod->meta_dma))
return BLK_STS_IOERR;
cmnd->rw.metadata = cpu_to_le64(iod->meta_dma);
-   return 0;
+   return BLK_STS_OK;
 }
 
 /*
-- 
1.8.3.1