Up till now, dax_direct_access() is used implicitly for normal access, but for the purpose of recovery write, dax range with poison is requested. To make the interface clear, introduce enum dax_access_mode { DAX_ACCESS, DAX_RECOVERY_WRITE, } where DAX_ACCESS is used for normal dax access, and DAX_RECOVERY_WRITE is used for dax recovery write.
Showing the changes to include (2 of 16 files). Show all
Unified · Split
| @@ -14,6 +14,11 @@ struct iomap_ops; · 13 unmodified lines | |||
| 14 | struct iomap_iter; | 14 | struct iomap_iter; |
| 15 | struct iomap; | 15 | struct iomap; |
| 16 | 16 | ||
| 17 | enum dax_access_mode { | ||
| 18 | DAX_ACCESS, | ||
| 19 | DAX_RECOVERY_WRITE, | ||
| 20 | }; | ||
| 21 | |||
| 17 | struct dax_operations { | 22 | struct dax_operations { |
| 18 | /* | 23 | /* |
| 19 | * direct_access: translate a device-relative | 24 | * direct_access: translate a device-relative |
| @@ -21,7 +26,7 @@ struct dax_operations { · 1 unmodified line | |||
| 21 | * number of pages available for DAX at that pfn. | 26 | * number of pages available for DAX at that pfn. |
| 22 | */ | 27 | */ |
| 23 | long (*direct_access)(struct dax_device *, pgoff_t, long, | 28 | long (*direct_access)(struct dax_device *, pgoff_t, long, |
| 24 | void **, pfn_t *); | 29 | enum dax_access_mode, void **, pfn_t *); |
| 25 | /* | 30 | /* |
| 26 | * Validate whether this device is usable as an fsdax backing | 31 | * Validate whether this device is usable as an fsdax backing |
| 27 | * device. | 32 | * device. |
| @@ -178,7 +183,7 @@ static inline void dax_read_unlock(int id) · 150 unmodified lines | |||
| 178 | bool dax_alive(struct dax_device *dax_dev); | 183 | bool dax_alive(struct dax_device *dax_dev); |
| 179 | void *dax_get_private(struct dax_device *dax_dev); | 184 | void *dax_get_private(struct dax_device *dax_dev); |
| 180 | long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, | 185 | long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, |
| 181 | void **kaddr, pfn_t *pfn); | 186 | enum dax_access_mode mode, void **kaddr, pfn_t *pfn); |
| 182 | size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, | 187 | size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, |
| 183 | size_t bytes, struct iov_iter *i); | 188 | size_t bytes, struct iov_iter *i); |
| 184 | size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, | 189 | size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, |
| @@ -20,6 +20,7 @@ struct dm_table; · 19 unmodified lines | |||
| 20 | struct dm_report_zones_args; | 20 | struct dm_report_zones_args; |
| 21 | struct mapped_device; | 21 | struct mapped_device; |
| 22 | struct bio_vec; | 22 | struct bio_vec; |
| 23 | enum dax_access_mode; | ||
| 23 | 24 | ||
| 24 | /* | 25 | /* |
| 25 | * Type of table, mapped_device's mempool and request_queue | 26 | * Type of table, mapped_device's mempool and request_queue |
| @@ -146,7 +147,8 @@ typedef int (*dm_busy_fn) (struct dm_target *ti); · 120 unmodified lines | |||
| 146 | * >= 0 : the number of bytes accessible at the address | 147 | * >= 0 : the number of bytes accessible at the address |
| 147 | */ | 148 | */ |
| 148 | typedef long (*dm_dax_direct_access_fn) (struct dm_target *ti, pgoff_t pgoff, | 149 | typedef long (*dm_dax_direct_access_fn) (struct dm_target *ti, pgoff_t pgoff, |
| 149 | long nr_pages, void **kaddr, pfn_t *pfn); | 150 | long nr_pages, enum dax_access_mode node, void **kaddr, |
| 151 | pfn_t *pfn); | ||
| 150 | typedef int (*dm_dax_zero_page_range_fn)(struct dm_target *ti, pgoff_t pgoff, | 152 | typedef int (*dm_dax_zero_page_range_fn)(struct dm_target *ti, pgoff_t pgoff, |
| 151 | size_t nr_pages); | 153 | size_t nr_pages); |
| 152 | 154 | ||