From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> 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@xxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Martin Petersen <martin.petersen@xxxxxxxxxx> Cc: Sagi Grimberg <sagi@xxxxxxxxxxx> Cc: Hannes Reinecke <hare@xxxxxxx> Cc: Mike Christie <michaelc@xxxxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html