summaryrefslogtreecommitdiffstats
path: root/include/linux/dax.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2018-07-14 00:50:16 -0400
committerDave Jiang <dave.jiang@intel.com>2018-07-23 13:38:06 -0400
commitc2a7d2a115525d3501d38e23d24875a79a07e15e (patch)
treedf178de827dbda4bce219d4bfb812581d4883b53 /include/linux/dax.h
parentae1139ece126b8eb6d0770094fbac43ea928d9d9 (diff)
filesystem-dax: Introduce dax_lock_mapping_entry()
In preparation for implementing support for memory poison (media error) handling via dax mappings, implement a lock_page() equivalent. Poison error handling requires rmap and needs guarantees that the page->mapping association is maintained / valid (inode not freed) for the duration of the lookup. In the device-dax case it is sufficient to simply hold a dev_pagemap reference. In the filesystem-dax case we need to use the entry lock. Export the entry lock via dax_lock_mapping_entry() that uses rcu_read_lock() to protect against the inode being freed, and revalidates the page->mapping association under xa_lock(). Cc: Christoph Hellwig <hch@lst.de> Cc: Matthew Wilcox <willy@infradead.org> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Diffstat (limited to 'include/linux/dax.h')
-rw-r--r--include/linux/dax.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/dax.h b/include/linux/dax.h
index deb0f663252f..450b28db9533 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -88,6 +88,8 @@ int dax_writeback_mapping_range(struct address_space *mapping,
88 struct block_device *bdev, struct writeback_control *wbc); 88 struct block_device *bdev, struct writeback_control *wbc);
89 89
90struct page *dax_layout_busy_page(struct address_space *mapping); 90struct page *dax_layout_busy_page(struct address_space *mapping);
91bool dax_lock_mapping_entry(struct page *page);
92void dax_unlock_mapping_entry(struct page *page);
91#else 93#else
92static inline bool bdev_dax_supported(struct block_device *bdev, 94static inline bool bdev_dax_supported(struct block_device *bdev,
93 int blocksize) 95 int blocksize)
@@ -119,6 +121,17 @@ static inline int dax_writeback_mapping_range(struct address_space *mapping,
119{ 121{
120 return -EOPNOTSUPP; 122 return -EOPNOTSUPP;
121} 123}
124
125static inline bool dax_lock_mapping_entry(struct page *page)
126{
127 if (IS_DAX(page->mapping->host))
128 return true;
129 return false;
130}
131
132static inline void dax_unlock_mapping_entry(struct page *page)
133{
134}
122#endif 135#endif
123 136
124int dax_read_lock(void); 137int dax_read_lock(void);