All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc()
@ 2017-10-18  7:42 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-10-18  7:42 UTC (permalink / raw)
  To: Matias Bjorling, Javier González; +Cc: linux-block, kernel-janitors

There is a missing error code if pblk_bio_map_addr() fails.  This
function used to return NVM_IO_ERR on error and it still returns
NVM_IO_OK (which is zero) on success, but now it returns negative error
codes on failure.  I decided to use a standard error code and remove the
reference to NVM_IO_OK so that no one was confused.

Fixes: d340121eb770 ("lightnvm: pblk: simplify data validity check on GC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index ca79d8fb3e60..c26f527dbf86 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -528,7 +528,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 	struct bio *bio;
 	struct nvm_rq rqd;
 	int data_len;
-	int ret = NVM_IO_OK;
+	int ret;
 
 	memset(&rqd, 0, sizeof(struct nvm_rq));
 
@@ -561,6 +561,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 						PBLK_VMALLOC_META, GFP_KERNEL);
 	if (IS_ERR(bio)) {
 		pr_err("pblk: could not allocate GC bio (%lu)\n", PTR_ERR(bio));
+		ret = PTR_ERR(bio);
 		goto err_free_dma;
 	}
 
@@ -595,7 +596,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 
 out:
 	nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list);
-	return ret;
+	return 0;
 
 err_free_bio:
 	bio_put(bio);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc()
@ 2017-10-18  7:42 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-10-18  7:42 UTC (permalink / raw)
  To: Matias Bjorling, Javier González; +Cc: linux-block, kernel-janitors

There is a missing error code if pblk_bio_map_addr() fails.  This
function used to return NVM_IO_ERR on error and it still returns
NVM_IO_OK (which is zero) on success, but now it returns negative error
codes on failure.  I decided to use a standard error code and remove the
reference to NVM_IO_OK so that no one was confused.

Fixes: d340121eb770 ("lightnvm: pblk: simplify data validity check on GC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index ca79d8fb3e60..c26f527dbf86 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -528,7 +528,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 	struct bio *bio;
 	struct nvm_rq rqd;
 	int data_len;
-	int ret = NVM_IO_OK;
+	int ret;
 
 	memset(&rqd, 0, sizeof(struct nvm_rq));
 
@@ -561,6 +561,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 						PBLK_VMALLOC_META, GFP_KERNEL);
 	if (IS_ERR(bio)) {
 		pr_err("pblk: could not allocate GC bio (%lu)\n", PTR_ERR(bio));
+		ret = PTR_ERR(bio);
 		goto err_free_dma;
 	}
 
@@ -595,7 +596,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
 
 out:
 	nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list);
-	return ret;
+	return 0;
 
 err_free_bio:
 	bio_put(bio);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc()
  2017-10-18  7:42 ` Dan Carpenter
@ 2017-10-18  7:49   ` Javier González
  -1 siblings, 0 replies; 4+ messages in thread
From: Javier González @ 2017-10-18  7:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Matias Bjørling, linux-block, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]

> On 18 Oct 2017, at 09.42, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> There is a missing error code if pblk_bio_map_addr() fails.  This
> function used to return NVM_IO_ERR on error and it still returns
> NVM_IO_OK (which is zero) on success, but now it returns negative error
> codes on failure.

Good catch. Thanks Dan.

> I decided to use a standard error code and remove the
> reference to NVM_IO_OK so that no one was confused.

It's ok with me. We only use the internal codes NVM_IO_X on the user
data path to know if we need to complete the bio or not (e.g., in case
of a REQ_FLUSH). GC is better off with standard error codes.

> 
> Fixes: d340121eb770 ("lightnvm: pblk: simplify data validity check on GC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
> index ca79d8fb3e60..c26f527dbf86 100644
> --- a/drivers/lightnvm/pblk-read.c
> +++ b/drivers/lightnvm/pblk-read.c
> @@ -528,7 +528,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
> 	struct bio *bio;
> 	struct nvm_rq rqd;
> 	int data_len;
> -	int ret = NVM_IO_OK;
> +	int ret;
> 
> 	memset(&rqd, 0, sizeof(struct nvm_rq));
> 
> @@ -561,6 +561,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
> 						PBLK_VMALLOC_META, GFP_KERNEL);
> 	if (IS_ERR(bio)) {
> 		pr_err("pblk: could not allocate GC bio (%lu)\n", PTR_ERR(bio));
> +		ret = PTR_ERR(bio);
> 		goto err_free_dma;
> 	}
> 
> @@ -595,7 +596,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
> 
> out:
> 	nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list);
> -	return ret;
> +	return 0;
> 
> err_free_bio:
> 	bio_put(bio);


Reviewed-by: Javier González <javier@cnexlabs.com>


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc()
@ 2017-10-18  7:49   ` Javier González
  0 siblings, 0 replies; 4+ messages in thread
From: Javier González @ 2017-10-18  7:49 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Matias Bjørling, linux-block, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1838 bytes --]

> On 18 Oct 2017, at 09.42, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> There is a missing error code if pblk_bio_map_addr() fails.  This
> function used to return NVM_IO_ERR on error and it still returns
> NVM_IO_OK (which is zero) on success, but now it returns negative error
> codes on failure.

Good catch. Thanks Dan.

> I decided to use a standard error code and remove the
> reference to NVM_IO_OK so that no one was confused.

It's ok with me. We only use the internal codes NVM_IO_X on the user
data path to know if we need to complete the bio or not (e.g., in case
of a REQ_FLUSH). GC is better off with standard error codes.

> 
> Fixes: d340121eb770 ("lightnvm: pblk: simplify data validity check on GC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
> index ca79d8fb3e60..c26f527dbf86 100644
> --- a/drivers/lightnvm/pblk-read.c
> +++ b/drivers/lightnvm/pblk-read.c
> @@ -528,7 +528,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
> 	struct bio *bio;
> 	struct nvm_rq rqd;
> 	int data_len;
> -	int ret = NVM_IO_OK;
> +	int ret;
> 
> 	memset(&rqd, 0, sizeof(struct nvm_rq));
> 
> @@ -561,6 +561,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
> 						PBLK_VMALLOC_META, GFP_KERNEL);
> 	if (IS_ERR(bio)) {
> 		pr_err("pblk: could not allocate GC bio (%lu)\n", PTR_ERR(bio));
> +		ret = PTR_ERR(bio);
> 		goto err_free_dma;
> 	}
> 
> @@ -595,7 +596,7 @@ int pblk_submit_read_gc(struct pblk *pblk, struct pblk_gc_rq *gc_rq)
> 
> out:
> 	nvm_dev_dma_free(dev->parent, rqd.meta_list, rqd.dma_meta_list);
> -	return ret;
> +	return 0;
> 
> err_free_bio:
> 	bio_put(bio);


Reviewed-by: Javier González <javier@cnexlabs.com>


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-18  7:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-18  7:42 [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc() Dan Carpenter
2017-10-18  7:42 ` Dan Carpenter
2017-10-18  7:49 ` Javier González
2017-10-18  7:49   ` Javier González

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.