From: Aneesh Kumar K.V Date: Tue, 24 Sep 2019 11:43:27 +0000 (+0530) Subject: libnvdimm/region: Enable MAP_SYNC for volatile regions X-Git-Tag: v5.4-rc1~10^2 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=4c806b897d6075bfa5067e524fb058c57ab64e7b;p=linux.git libnvdimm/region: Enable MAP_SYNC for volatile regions Some environments want to use a host tmpfs/ramdisk to back guest pmem. While the data is not persisted relative to the host it *is* persisted relative to guest crashes / reboots. The guest is free to use dax and MAP_SYNC to keep filesystem metadata consistent with dax accesses without requiring guest fsync(). The guest can also observe that the region is volatile and skip cache flushing as global visibility is enough to "persist" data relative to the host staying alive over guest reset events. Signed-off-by: Aneesh Kumar K.V Reviewed-by: Pankaj Gupta Link: https://lore.kernel.org/r/20190924114327.14700-1-aneesh.kumar@linux.ibm.com [djbw: reword the changelog] Signed-off-by: Dan Williams --- diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index ab91890f2486..ef423ba1a711 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1168,6 +1168,9 @@ EXPORT_SYMBOL_GPL(nvdimm_has_cache); bool is_nvdimm_sync(struct nd_region *nd_region) { + if (is_nd_volatile(&nd_region->dev)) + return true; + return is_nd_pmem(&nd_region->dev) && !test_bit(ND_REGION_ASYNC, &nd_region->flags); }