[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 2/4] nvdimm: add functions to initialize and
From: |
Haozhong Zhang |
Subject: |
Re: [Qemu-devel] [RFC PATCH 2/4] nvdimm: add functions to initialize and perform flush on back store |
Date: |
Tue, 11 Apr 2017 16:29:28 +0800 |
User-agent: |
Mutt/1.6.2-neo (2016-08-21) |
On 04/11/17 16:22 +0800, Haozhong Zhang wrote:
> On 04/06/17 19:52 +0800, Xiao Guangrong wrote:
> >
> >
> > 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 <address@hidden>
> > > ---
> > > 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.
>
> Oops, forgot to add this part. Thanks for remind.
Sorry, I replied too quick.
For hostmem-file, hostmem_mr->ram_block->fd is set in file_ram_alloc(),
which can be got by memory_region_get_fd() here.
Haozhong