Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1290260

Re: [PATCH] lightnvm: fix bio submission issue

From Matias <mb@lightnvm.io>
Newsgroups linux.kernel
Subject Re: [PATCH] lightnvm: fix bio submission issue
Date 2015-12-12 20:10 +0100
Message-ID <qEXIm-6af-13@gated-at.bofh.it> (permalink)
References <qDN8l-xe-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 12/09/2015 02:26 PM, Wenwei Tao wrote:
> put bio when submission fails, since we get it
> before submission. And return error when backend
> device driver doesn't provide a submit_io method,
> thus we can end IO properly.
>
> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
>   drivers/lightnvm/gennvm.c | 2 +-
>   drivers/lightnvm/rrpc.c   | 4 +++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
> index 35dde84..c8e53c5 100644
> --- a/drivers/lightnvm/gennvm.c
> +++ b/drivers/lightnvm/gennvm.c
> @@ -343,7 +343,7 @@ static void gennvm_generic_to_addr_mode(struct nvm_dev *dev, struct nvm_rq *rqd)
>   static int gennvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
>   {
>   	if (!dev->ops->submit_io)
> -		return 0;
> +		return -ENODEV;
>
>   	/* Convert address space */
>   	gennvm_generic_to_addr_mode(dev, rqd);
> diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
> index 75e59c3..77b066f 100644
> --- a/drivers/lightnvm/rrpc.c
> +++ b/drivers/lightnvm/rrpc.c
> @@ -636,11 +636,12 @@ static int rrpc_end_io(struct nvm_rq *rqd, int error)
>   	if (bio_data_dir(rqd->bio) == WRITE)
>   		rrpc_end_io_write(rrpc, rrqd, laddr, npages);
>
> +	bio_put(rqd->bio);
> +
>   	if (rrqd->flags & NVM_IOTYPE_GC)
>   		return 0;
>
>   	rrpc_unlock_rq(rrpc, rqd);
> -	bio_put(rqd->bio);
>
>   	if (npages > 1)
>   		nvm_dev_dma_free(rrpc->dev, rqd->ppa_list, rqd->dma_ppa_list);
> @@ -827,6 +828,7 @@ static int rrpc_submit_io(struct rrpc *rrpc, struct bio *bio,
>   	err = nvm_submit_io(rrpc->dev, rqd);
>   	if (err) {
>   		pr_err("rrpc: I/O submission failed: %d\n", err);
> +		bio_put(bio);
>   		return NVM_IO_ERR;
>   	}
>
>
Thanks Tao, applied :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] lightnvm: fix bio submission issue Wenwei Tao <ww.tao0320@gmail.com> - 2015-12-09 14:40 +0100
  Re: [PATCH] lightnvm: fix bio submission issue Matias <mb@lightnvm.io> - 2015-12-12 20:10 +0100

csiph-web