summaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/claim.c
diff options
context:
space:
mode:
authorPankaj Gupta <pagupta@redhat.com>2019-07-05 19:33:22 +0530
committerDan Williams <dan.j.williams@intel.com>2019-07-05 15:19:10 -0700
commitc5d4355d10d414a96ca870b731756b89d068d57a (patch)
tree9796dcbf336da17f018db742bd0f7e33ada85b2c /drivers/nvdimm/claim.c
parentdb5d00c93edc0afba1027e51ff3b38dc0e5f7728 (diff)
downloadlinux-c5d4355d10d414a96ca870b731756b89d068d57a.tar.gz
linux-c5d4355d10d414a96ca870b731756b89d068d57a.tar.bz2
linux-c5d4355d10d414a96ca870b731756b89d068d57a.zip
libnvdimm: nd_region flush callback support
This patch adds functionality to perform flush from guest to host over VIRTIO. We are registering a callback based on 'nd_region' type. virtio_pmem driver requires this special flush function. For rest of the region types we are registering existing flush function. Report error returned by host fsync failure to userspace. Signed-off-by: Pankaj Gupta <pagupta@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/claim.c')
-rw-r--r--drivers/nvdimm/claim.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 26c1c7618891..2985ca949912 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -255,7 +255,7 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
unsigned int sz_align = ALIGN(size + (offset & (512 - 1)), 512);
sector_t sector = offset >> 9;
- int rc = 0;
+ int rc = 0, ret = 0;
if (unlikely(!size))
return 0;
@@ -293,7 +293,9 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
}
memcpy_flushcache(nsio->addr + offset, buf, size);
- nvdimm_flush(to_nd_region(ndns->dev.parent));
+ ret = nvdimm_flush(to_nd_region(ndns->dev.parent), NULL);
+ if (ret)
+ rc = ret;
return rc;
}