[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200420131947.41991-2-pankaj.gupta.linux@gmail.com>
Date: Mon, 20 Apr 2020 15:19:46 +0200
From: Pankaj Gupta <pankaj.gupta.linux@...il.com>
To: linux-kernel@...r.kernel.org, linux-nvdimm@...ts.01.org
Cc: dan.j.williams@...el.com, vishal.l.verma@...el.com,
dave.jiang@...el.com, david@...hat.com, mst@...hat.com,
jmoyer@...hat.com, pankaj.gupta@...ud.ionos.com,
Pankaj Gupta <pankaj.gupta.linux@...il.com>
Subject: [RFC 1/2] pmem: make nvdimm_flush asynchronous
This patch converts nvdimm_flush to return when
asynchronous flush is in process.
Signed-off-by: Pankaj Gupta <pankaj.gupta.linux@...il.com>
---
drivers/nvdimm/pmem.c | 15 ++++++++-------
drivers/nvdimm/region_devs.c | 3 +--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 4ffc6f7ca131..747ffaee513b 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -192,8 +192,10 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
struct pmem_device *pmem = q->queuedata;
struct nd_region *nd_region = to_region(pmem);
- if (bio->bi_opf & REQ_PREFLUSH)
- ret = nvdimm_flush(nd_region, bio);
+ if ((bio->bi_opf & REQ_PREFLUSH) &&
+ nvdimm_flush(nd_region, bio)) {
+ return BLK_QC_T_NONE;
+ }
do_acct = nd_iostat_start(bio, &start);
bio_for_each_segment(bvec, bio, iter) {
@@ -207,11 +209,10 @@ static blk_qc_t pmem_make_request(struct request_queue *q, struct bio *bio)
if (do_acct)
nd_iostat_end(bio, start);
- if (bio->bi_opf & REQ_FUA)
- ret = nvdimm_flush(nd_region, bio);
-
- if (ret)
- bio->bi_status = errno_to_blk_status(ret);
+ if (bio->bi_opf & REQ_FUA) {
+ nvdimm_flush(nd_region, bio);
+ return BLK_QC_T_NONE;
+ }
bio_endio(bio);
return BLK_QC_T_NONE;
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index a19e535830d9..1caa13f1523f 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -1091,8 +1091,7 @@ int nvdimm_flush(struct nd_region *nd_region, struct bio *bio)
if (!nd_region->flush)
rc = generic_nvdimm_flush(nd_region);
else {
- if (nd_region->flush(nd_region, bio))
- rc = -EIO;
+ rc = nd_region->flush(nd_region, bio);
}
return rc;
--
2.20.1
Powered by blists - more mailing lists