mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Matias Bjørling" <m@bjorling.me>
To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com
Cc: "Wenwei Tao" <ww.tao0320@gmail.com>, "Matias Bjørling" <m@bjorling.me>
Subject: [PATCH 01/25] lightnvm: fix bio submission issue
Date: Tue, 12 Jan 2016 07:49:15 +0100	[thread overview]
Message-ID: <1452581379-18162-2-git-send-email-m@bjorling.me> (raw)
In-Reply-To: <1452581379-18162-1-git-send-email-m@bjorling.me>

From: Wenwei Tao <ww.tao0320@gmail.com>

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>
Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 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 a54b339..62c6f4d 100644
--- a/drivers/lightnvm/gennvm.c
+++ b/drivers/lightnvm/gennvm.c
@@ -345,7 +345,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 134e4fa..a1e7488 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -650,11 +650,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);
@@ -841,6 +842,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;
 	}
 
-- 
2.1.4

  reply	other threads:[~2016-01-12  6:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12  6:49 [PATCH 00/25] LightNVM patches for 4.5 Matias Bjørling
2016-01-12  6:49 ` Matias Bjørling [this message]
2016-01-12  6:49 ` [PATCH 02/25] lightnvm: fix incorrect nr_free_blocks stat Matias Bjørling
2016-01-12  6:49 ` [PATCH 03/25] lightnvm: add check after mempool allocation Matias Bjørling
2016-01-12  6:49 ` [PATCH 04/25] lightnvm: unlock rq and free ppa_list on submission fail Matias Bjørling
2016-01-12  6:49 ` [PATCH 05/25] lightnvm: move ppa erase logic to core Matias Bjørling
2016-01-12  6:49 ` [PATCH 06/25] lightnvm: refactor rqd ppa list into set/free Matias Bjørling
2016-01-12  6:49 ` [PATCH 07/25] lightnvm: refactor end_io functions for sync Matias Bjørling
2016-01-12  6:49 ` [PATCH 08/25] lightnvm: return the get_bb_tbl return value Matias Bjørling
2016-01-12  6:49 ` [PATCH 09/25] lightnvm: check bi_error in gc Matias Bjørling
2016-01-12  6:49 ` [PATCH 10/25] lightnvm: put block back to gc list on its reclaim fail Matias Bjørling
2016-01-12  6:49 ` [PATCH 11/25] lightnvm: fix locking and mempool in rrpc_lun_gc Matias Bjørling
2016-01-12  6:49 ` [PATCH 12/25] lightnvm: sectors first in ppa list Matias Bjørling
2016-01-12  6:49 ` [PATCH 13/25] lightnvm: move the pages per block check out of the loop Matias Bjørling
2016-01-12  6:49 ` [PATCH 14/25] lightnvm: support multiple ppas in nvm_erase_ppa Matias Bjørling
2016-01-12  6:49 ` [PATCH 15/25] lightnvm: move rq->error to nvm_rq->error Matias Bjørling
2016-01-12  6:49 ` [PATCH 16/25] lightnvm: introduce nvm_submit_ppa Matias Bjørling
2016-01-12  6:49 ` [PATCH 17/25] lightnvm: reference rrpc lun in rrpc block Matias Bjørling
2016-01-12  6:49 ` [PATCH 18/25] lightnvm: fix missing grown bad block type Matias Bjørling
2016-01-12  6:49 ` [PATCH 19/25] lightnvm: manage open and closed blocks separately Matias Bjørling
2016-01-12  6:49 ` [PATCH 20/25] lightnvm: add mccap support Matias Bjørling
2016-01-12  6:49 ` [PATCH 21/25] lightnvm: introduce mlc lower page table mappings Matias Bjørling
2016-01-12  6:49 ` [PATCH 22/25] lightnvm: core on-disk initialization Matias Bjørling
2016-01-12  6:49 ` [PATCH 23/25] lightnvm: introduce ioctl to initialize device Matias Bjørling
2016-01-12  6:49 ` [PATCH 24/25] lightnvm: use system block for mm initialization Matias Bjørling
2016-01-12  6:49 ` [PATCH 25/25] lightnvm: introduce factory reset Matias Bjørling
2016-01-12 15:19 ` [PATCH 00/25] LightNVM patches for 4.5 Jens Axboe
2016-01-13  0:09   ` Matias Bjorling

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=1452581379-18162-2-git-send-email-m@bjorling.me \
    --to=m@bjorling.me \
    --cc=axboe@fb.com \
    --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

all inboxes | Powered by JetHome®