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 | 7 | #include <linux/radix-tree.h> |
| 8 | 8 | #include <asm/pgtable.h> |
| 9 | 9 | |
| 10 | +/* Flag for synchronous flush */ | |
| 11 | +#define DAXDEV_F_SYNC (1UL << 0) | |
| 12 | + | |
| 10 | 13 | typedef unsigned long dax_entry_t; |
| 11 | 14 | |
| 12 | 15 | struct iomap_ops; |
| @@ -38,18 +41,28 @@ extern struct attribute_group dax_attribute_group; · 25 unmodified lines | ||
| 38 | 41 | #if IS_ENABLED(CONFIG_DAX) |
| 39 | 42 | struct dax_device *dax_get_by_host(const char *host); |
| 40 | 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 | 45 | void put_dax(struct dax_device *dax_dev); |
| 43 | 46 | void kill_dax(struct dax_device *dax_dev); |
| 44 | 47 | void dax_write_cache(struct dax_device *dax_dev, bool wc); |
| 45 | 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 | 59 | #else |
| 47 | 60 | static inline struct dax_device *dax_get_by_host(const char *host) |
| 48 | 61 | { |
| 49 | 62 | return NULL; |
| 50 | 63 | } |
| 51 | 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 | 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 | 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 | 93 | #endif |
| 74 | 94 | |
| 75 | 95 | struct writeback_control; |
| @@ -263,6 +263,7 @@ int generic_nvdimm_flush(struct nd_region *nd_region); · 262 unmodified lines | ||
| 263 | 263 | int nvdimm_has_flush(struct nd_region *nd_region); |
| 264 | 264 | int nvdimm_has_cache(struct nd_region *nd_region); |
| 265 | 265 | int nvdimm_in_overwrite(struct nvdimm *nvdimm); |
| 266 | +bool is_nvdimm_sync(struct nd_region *nd_region); | |
| 266 | 267 | |
| 267 | 268 | static inline int nvdimm_ctl(struct nvdimm *nvdimm, unsigned int cmd, void *buf, |
| 268 | 269 | unsigned int buf_len, int *cmd_rc) |