This patch adds 'DAXDEV_SYNC' flag which is set for nd_region doing synchronous flush. This later is used to disable MAP_SYNC functionality for ext4 & xfs filesystem for devices don't support synchronous flush.
Showing the changes to include/linux (2 of 8 files). Show all
Unified · Split
| @@ -7,6 +7,9 @@ · 6 unmodified lines | |||
| 7 | #include <linux/radix-tree.h> | 7 | #include <linux/radix-tree.h> |
| 8 | #include <asm/pgtable.h> | 8 | #include <asm/pgtable.h> |
| 9 | 9 | ||
| 10 | /* Flag for synchronous flush */ | ||
| 11 | #define DAXDEV_F_SYNC (1UL << 0) | ||
| 12 | |||
| 10 | typedef unsigned long dax_entry_t; | 13 | typedef unsigned long dax_entry_t; |
| 11 | 14 | ||
| 12 | struct iomap_ops; | 15 | struct iomap_ops; |
| @@ -38,18 +41,28 @@ extern struct attribute_group dax_attribute_group; · 25 unmodified lines | |||
| 38 | #if IS_ENABLED(CONFIG_DAX) | 41 | #if IS_ENABLED(CONFIG_DAX) |
| 39 | struct dax_device *dax_get_by_host(const char *host); | 42 | struct dax_device *dax_get_by_host(const char *host); |
| 40 | struct dax_device *alloc_dax(void *private, const char *host, | 43 | struct dax_device *alloc_dax(void *private, const char *host, |
| 41 | const struct dax_operations *ops); | 44 | const struct dax_operations *ops, unsigned long flags); |
| 42 | void put_dax(struct dax_device *dax_dev); | 45 | void put_dax(struct dax_device *dax_dev); |
| 43 | void kill_dax(struct dax_device *dax_dev); | 46 | void kill_dax(struct dax_device *dax_dev); |
| 44 | void dax_write_cache(struct dax_device *dax_dev, bool wc); | 47 | void dax_write_cache(struct dax_device *dax_dev, bool wc); |
| 45 | bool dax_write_cache_enabled(struct dax_device *dax_dev); | 48 | bool dax_write_cache_enabled(struct dax_device *dax_dev); |
| 49 | bool __dax_synchronous(struct dax_device *dax_dev); | ||
| 50 | static inline bool dax_synchronous(struct dax_device *dax_dev) | ||
| 51 | { | ||
| 52 | return __dax_synchronous(dax_dev); | ||
| 53 | } | ||
| 54 | void __set_dax_synchronous(struct dax_device *dax_dev); | ||
| 55 | static inline void set_dax_synchronous(struct dax_device *dax_dev) | ||
| 56 | { | ||
| 57 | __set_dax_synchronous(dax_dev); | ||
| 58 | } | ||
| 46 | #else | 59 | #else |
| 47 | static inline struct dax_device *dax_get_by_host(const char *host) | 60 | static inline struct dax_device *dax_get_by_host(const char *host) |
| 48 | { | 61 | { |
| 49 | return NULL; | 62 | return NULL; |
| 50 | } | 63 | } |
| 51 | static inline struct dax_device *alloc_dax(void *private, const char *host, | 64 | static inline struct dax_device *alloc_dax(void *private, const char *host, |
| 52 | const struct dax_operations *ops) | 65 | const struct dax_operations *ops, unsigned long flags) |
| 53 | { | 66 | { |
| 54 | /* | 67 | /* |
| 55 | * Callers should check IS_ENABLED(CONFIG_DAX) to know if this | 68 | * Callers should check IS_ENABLED(CONFIG_DAX) to know if this |
| @@ -70,6 +83,13 @@ static inline bool dax_write_cache_enabled(struct dax_device *dax_dev) · 14 unmodified lines | |||
| 70 | { | 83 | { |
| 71 | return false; | 84 | return false; |
| 72 | } | 85 | } |
| 86 | static inline bool dax_synchronous(struct dax_device *dax_dev) | ||
| 87 | { | ||
| 88 | return true; | ||
| 89 | } | ||
| 90 | static inline void set_dax_synchronous(struct dax_device *dax_dev) | ||
| 91 | { | ||
| 92 | } | ||
| 73 | #endif | 93 | #endif |
| 74 | 94 | ||
| 75 | struct writeback_control; | 95 | struct writeback_control; |
| @@ -263,6 +263,7 @@ int generic_nvdimm_flush(struct nd_region *nd_region); · 262 unmodified lines | |||
| 263 | int nvdimm_has_flush(struct nd_region *nd_region); | 263 | int nvdimm_has_flush(struct nd_region *nd_region); |
| 264 | int nvdimm_has_cache(struct nd_region *nd_region); | 264 | int nvdimm_has_cache(struct nd_region *nd_region); |
| 265 | int nvdimm_in_overwrite(struct nvdimm *nvdimm); | 265 | int nvdimm_in_overwrite(struct nvdimm *nvdimm); |
| 266 | bool is_nvdimm_sync(struct nd_region *nd_region); | ||
| 266 | 267 | ||
| 267 | static inline int nvdimm_ctl(struct nvdimm *nvdimm, unsigned int cmd, void *buf, | 268 | static inline int nvdimm_ctl(struct nvdimm *nvdimm, unsigned int cmd, void *buf, |
| 268 | unsigned int buf_len, int *cmd_rc) | 269 | unsigned int buf_len, int *cmd_rc) |