Hi, On Fri, Apr 26, 2019 at 08:36:51AM +0800, Wei Yang wrote: > From: Zhang Yi <[email protected]> > > When a file supporting DAX is used as vNVDIMM backend, mmap it with > MAP_SYNC flag in addition which can ensure file system metadata > synced in each guest writes to the backend file, without other QEMU > actions (e.g., periodic fsync() by QEMU). > > Current, We have below different possible use cases: > > 1. pmem=on is set, shared=on is set, MAP_SYNC supported: > a: backend is a dax supporting file. > - MAP_SYNC will active. > b: backend is not a dax supporting file. > - mmap will trigger a warning. then MAP_SYNC flag will be ignored > > 2. The rest of cases: > - we will never pass the MAP_SYNC to mmap2 > > Signed-off-by: Haozhong Zhang <[email protected]> > Signed-off-by: Zhang Yi <[email protected]> > [ehabkost: Rebased patch to latest code on master] > Signed-off-by: Eduardo Habkost <[email protected]> > Signed-off-by: Wei Yang <[email protected]> > Tested-by: Wei Yang <[email protected]> > Reviewed-by: Stefan Hajnoczi <[email protected]> > > --- > v15: fix compile issue on pre-linux4.15 > v14: rebase on top of current upstream
Note that v14 was already merged, so the build fix would need to be submitted separately. However: [...] > +#ifdef CONFIG_LINUX > +#include <linux/mman.h> > +#endif /* CONFIG_LINUX */ > + > +#ifndef MAP_SYNC > +#define MAP_SYNC 0 > +#endif > +#ifndef MAP_SHARED_VALIDATE > +#define MAP_SHARED_VALIDATE 0 > +#endif Why would we need this, if we added copies of mman.h to linux-headers? -- Eduardo
