NVSL / linux-nova

NOVA is a log-structured file system designed for byte-addressable non-volatile memories, developed at the University of California, San Diego.
http://nvsl.ucsd.edu/index.php?path=projects/nova
Other
421 stars 118 forks source link

Support and ignore MAP_SYNC #101

Closed pleiadesian closed 3 years ago

pleiadesian commented 3 years ago

To fix issue #99, we only need to add MAP_SYNC in the mmap_supported_flags. The following condition to indicate synchronous page fault by VFS does not change, so the execution path of page fault in mmap remains the same.

// in fs/dax.c
/*
 * MAP_SYNC on a dax mapping guarantees dirty metadata is
 * flushed on write-faults (non-cow), but not read-faults.
 */
static bool dax_fault_is_synchronous(unsigned long flags,
        struct vm_area_struct *vma, struct iomap *iomap)
{
    return (flags & IOMAP_WRITE) && (vma->vm_flags & VM_SYNC)
        && (iomap->flags & IOMAP_F_DIRTY);
}

IOMAP_F_DIRTY indicates the inode has uncommitted metadata requiring fdatasync, which will not be set by NOVA. So dax_fault_is_synchronous still returns 0 whether VM_SYNC is 0 or 1.