Re: [PATCH] lightnvm: pblk: fix error codes in pblk_submit_read_gc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 18 Oct 2017, at 09.42, Dan Carpenter <dan.carpenter@xxxxxxxxxx> 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@xxxxxxxxxx>
> 
> 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@xxxxxxxxxxxx>

Attachment: signature.asc
Description: Message signed with OpenPGP


[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux