linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matias <mb@lightnvm.io>
To: Wenwei Tao <ww.tao0320@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] lightnvm: fix bio submission issue
Date: Sat, 12 Dec 2015 20:08:15 +0100	[thread overview]
Message-ID: <566C709F.8050003@lightnvm.io> (raw)
In-Reply-To: <1449667564-7132-1-git-send-email-ww.tao0320@gmail.com>

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 :)

      reply	other threads:[~2015-12-12 19:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 13:26 [PATCH] lightnvm: fix bio submission issue Wenwei Tao
2015-12-12 19:08 ` Matias [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566C709F.8050003@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ww.tao0320@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).