From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: hch@lst.de, sagi@grimberg.me, damien.lemoal@wdc.com,
Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Subject: [PATCH V9 9/9] nvmet: call nvmet_bio_done() for zone append
Date: Mon, 11 Jan 2021 20:26:23 -0800 [thread overview]
Message-ID: <20210112042623.6316-10-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20210112042623.6316-1-chaitanya.kulkarni@wdc.com>
The function nvmet_bdev_execute_zone_append() does exactly same thing
for completion of the bio that is done in the nvmet_bio_done(),
completing the request & calling nvmet_bio_put()_to put non online bio.
Export the function nvmet_bio_done() and use that in the
nvmet_bdev_execute_zone_append() for the request completion and bio
processing. Set the bio->private after the call to submit_bio_wait() to
nvmet request. The call to nvmet_bio_done() also updates error log page
via call to blk_to_nvme_status() from nvmet_bio_done().
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/target/io-cmd-bdev.c | 2 +-
drivers/nvme/target/nvmet.h | 1 +
drivers/nvme/target/zns.c | 10 ++++------
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index c23a719513b0..72a22351da2a 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -167,7 +167,7 @@ static u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
return status;
}
-static void nvmet_bio_done(struct bio *bio)
+void nvmet_bio_done(struct bio *bio)
{
struct nvmet_req *req = bio->bi_private;
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index f4f9d622df0d..ab84ab75b952 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -535,6 +535,7 @@ void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid);
void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns);
int nvmet_file_ns_revalidate(struct nvmet_ns *ns);
void nvmet_ns_revalidate(struct nvmet_ns *ns);
+void nvmet_bio_done(struct bio *bio);
static inline u32 nvmet_rw_data_len(struct nvmet_req *req)
{
diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c
index 149bc8ce7010..da4be0231428 100644
--- a/drivers/nvme/target/zns.c
+++ b/drivers/nvme/target/zns.c
@@ -283,7 +283,6 @@ void nvmet_bdev_execute_zone_append(struct nvmet_req *req)
struct request_queue *q = req->ns->bdev->bd_disk->queue;
unsigned int op = REQ_OP_ZONE_APPEND | REQ_SYNC | REQ_IDLE;
unsigned int max_sects = queue_max_zone_append_sectors(q);
- u16 status = NVME_SC_SUCCESS;
unsigned int total_len = 0;
struct scatterlist *sg;
int ret = 0, sg_cnt;
@@ -306,7 +305,7 @@ void nvmet_bdev_execute_zone_append(struct nvmet_req *req)
ret = bio_add_hw_page(q, bio, p, l, o, max_sects, &same_page);
if (ret != sg->length) {
- status = NVME_SC_INTERNAL;
+ bio->bi_status = BLK_STS_IOERR;
goto out_bio_put;
}
if (same_page)
@@ -316,15 +315,14 @@ void nvmet_bdev_execute_zone_append(struct nvmet_req *req)
}
if (total_len != nvmet_rw_data_len(req)) {
- status = NVME_SC_INTERNAL | NVME_SC_DNR;
+ bio->bi_status = BLK_STS_IOERR;
goto out_bio_put;
}
ret = submit_bio_wait(bio);
req->cqe->result.u64 = nvmet_sect_to_lba(req->ns,
bio->bi_iter.bi_sector);
-
out_bio_put:
- nvmet_req_bio_put(req, bio);
- nvmet_req_complete(req, ret < 0 ? NVME_SC_INTERNAL : status);
+ bio->bi_private = req;
+ nvmet_bio_done(bio);
}
--
2.22.1
next prev parent reply other threads:[~2021-01-12 4:28 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 4:26 [PATCH V9 0/9] nvmet: add ZBD backend support Chaitanya Kulkarni
2021-01-12 4:26 ` [PATCH V9 1/9] block: export bio_add_hw_pages() Chaitanya Kulkarni
2021-01-12 5:40 ` Damien Le Moal
2021-01-12 7:24 ` Christoph Hellwig
2021-01-13 1:20 ` Chaitanya Kulkarni
2021-01-12 4:26 ` [PATCH V9 2/9] nvmet: add lba to sect conversion helpers Chaitanya Kulkarni
2021-01-12 5:08 ` Damien Le Moal
2021-01-18 18:19 ` Christoph Hellwig
2021-01-12 4:26 ` [PATCH V9 3/9] nvmet: add NVM command set identifier support Chaitanya Kulkarni
2021-01-12 7:27 ` Christoph Hellwig
2021-01-13 4:16 ` Chaitanya Kulkarni
2021-01-18 18:21 ` Christoph Hellwig
2021-01-12 4:26 ` [PATCH V9 4/9] nvmet: add ZBD over ZNS backend support Chaitanya Kulkarni
2021-01-12 5:32 ` Damien Le Moal
2021-01-12 6:11 ` Chaitanya Kulkarni
2021-01-12 6:31 ` Damien Le Moal
2021-01-12 7:48 ` Christoph Hellwig
2021-01-12 7:52 ` Damien Le Moal
2021-01-18 18:25 ` Christoph Hellwig
2021-01-19 0:02 ` Damien Le Moal
2021-01-19 4:28 ` Damien Le Moal
2021-01-19 6:15 ` hch
2021-01-13 4:57 ` Chaitanya Kulkarni
2021-01-18 18:27 ` Christoph Hellwig
2021-01-12 4:26 ` [PATCH V9 5/9] nvmet: add bio get helper for different backends Chaitanya Kulkarni
2021-01-12 5:37 ` Damien Le Moal
2021-01-12 5:55 ` Chaitanya Kulkarni
2021-01-12 7:33 ` Christoph Hellwig
2021-01-13 5:03 ` Chaitanya Kulkarni
2021-01-18 18:28 ` Christoph Hellwig
2021-01-19 4:57 ` Chaitanya Kulkarni
2021-01-12 4:26 ` [PATCH V9 6/9] nvmet: add bio init " Chaitanya Kulkarni
2021-01-12 5:40 ` Damien Le Moal
2021-01-12 5:57 ` Chaitanya Kulkarni
2021-01-12 6:27 ` Damien Le Moal
2021-01-12 7:33 ` Christoph Hellwig
2021-01-13 5:04 ` Chaitanya Kulkarni
2021-01-18 18:33 ` Christoph Hellwig
2021-01-12 4:26 ` [PATCH V9 7/9] nvmet: add bio put " Chaitanya Kulkarni
2021-01-12 4:26 ` [PATCH V9 8/9] nvmet: add common I/O length check helper Chaitanya Kulkarni
2021-01-12 7:35 ` Christoph Hellwig
2021-01-13 5:07 ` Chaitanya Kulkarni
2021-01-18 18:34 ` Christoph Hellwig
2021-01-12 4:26 ` Chaitanya Kulkarni [this message]
2021-01-12 7:36 ` [PATCH V9 9/9] nvmet: call nvmet_bio_done() for zone append Christoph Hellwig
2021-01-13 5:13 ` Chaitanya Kulkarni
2021-01-12 6:12 ` [PATCH V9 0/9] nvmet: add ZBD backend support Chaitanya Kulkarni
2021-02-10 22:42 ` Chaitanya Kulkarni
2021-02-11 7:20 ` hch
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=20210112042623.6316-10-chaitanya.kulkarni@wdc.com \
--to=chaitanya.kulkarni@wdc.com \
--cc=damien.lemoal@wdc.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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).