On 03/31/2017 04:41 PM, Haozhong Zhang wrote:
fsync() is used to persist modifications to the back store. If the
host NVDIMM is used as the back store, fsync() on Linux will trigger
the write to the host flush hint address.

Signed-off-by: Haozhong Zhang <haozhong.zh...@intel.com>
---
 hw/mem/nvdimm.c         | 22 ++++++++++++++++++++++
 include/hw/mem/nvdimm.h | 13 +++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index db896b0..484ab8b 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -78,6 +78,26 @@ static MemoryRegion *nvdimm_get_memory_region(PCDIMMDevice 
*dimm)
     return &nvdimm->nvdimm_mr;
 }

+static void nvdimm_flush_init(NVDIMMDevice *nvdimm, MemoryRegion *hostmem_mr)
+{
+    if (nvdimm->flush_hint_enabled) {
+        nvdimm->backend_fd = memory_region_get_fd(hostmem_mr);

Hmm, IIRC host-mem-file does not initalize backend_fd at all.

Reply via email to