[RFC-v2 08/11] nvmet/io-cmd: Hookup sbc_ops->execute_sync_cache backend ops
Nicholas A. Bellinger
nab at linux-iscsi.org
Mon Jun 13 21:35:43 PDT 2016
From: Nicholas Bellinger <nab at linux-iscsi.org>
This patch converts nvmet_execute_flush() to utilize
sbc_ops->execute_sync_cache() for target_iostate
submission into existing backends drivers via
configfs in /sys/kernel/config/target/core/.
Cc: Jens Axboe <axboe at fb.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Martin Petersen <martin.petersen at oracle.com>
Cc: Sagi Grimberg <sagi at grimberg.me>
Cc: Hannes Reinecke <hare at suse.de>
Cc: Mike Christie <michaelc at cs.wisc.edu>
Signed-off-by: Nicholas Bellinger <nab at linux-iscsi.org>
---
drivers/nvme/target/io-cmd.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/target/io-cmd.c b/drivers/nvme/target/io-cmd.c
index 133a14a..23905a8 100644
--- a/drivers/nvme/target/io-cmd.c
+++ b/drivers/nvme/target/io-cmd.c
@@ -109,18 +109,21 @@ static void nvmet_execute_rw(struct nvmet_req *req)
static void nvmet_execute_flush(struct nvmet_req *req)
{
-#if 0
- struct bio *bio;
+ struct target_iostate *ios = &req->t_iostate;
+ struct se_device *dev = rcu_dereference_raw(req->ns->dev);
+ struct sbc_ops *sbc_ops = dev->transport->sbc_ops;
+ sense_reason_t rc;
- nvmet_inline_bio_init(req);
- bio = &req->inline_bio;
+ if (!sbc_ops || !sbc_ops->execute_sync_cache) {
+ nvmet_req_complete(req, NVME_SC_INTERNAL | NVME_SC_DNR);
+ return;
+ }
- bio->bi_bdev = req->ns->bdev;
- bio->bi_private = req;
- bio->bi_end_io = nvmet_bio_done;
+ ios->se_dev = dev;
+ ios->iomem = NULL;
+ ios->t_comp_func = &nvmet_complete_ios;
- submit_bio(WRITE_FLUSH, bio);
-#endif
+ rc = sbc_ops->execute_sync_cache(ios, false);
}
#if 0
--
1.9.1
More information about the Linux-nvme
mailing list