|
@@ -79,15 +79,14 @@ struct page *read_dax_sector(struct block_device *bdev, sector_t n)
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- * dax_clear_blocks() is called from within transaction context from XFS,
|
|
|
+ * dax_clear_sectors() is called from within transaction context from XFS,
|
|
|
* and hence this means the stack from this point must follow GFP_NOFS
|
|
|
* semantics for all operations.
|
|
|
*/
|
|
|
-int dax_clear_blocks(struct inode *inode, sector_t block, long _size)
|
|
|
+int dax_clear_sectors(struct block_device *bdev, sector_t _sector, long _size)
|
|
|
{
|
|
|
- struct block_device *bdev = inode->i_sb->s_bdev;
|
|
|
struct blk_dax_ctl dax = {
|
|
|
- .sector = block << (inode->i_blkbits - 9),
|
|
|
+ .sector = _sector,
|
|
|
.size = _size,
|
|
|
};
|
|
|
|
|
@@ -109,7 +108,7 @@ int dax_clear_blocks(struct inode *inode, sector_t block, long _size)
|
|
|
wmb_pmem();
|
|
|
return 0;
|
|
|
}
|
|
|
-EXPORT_SYMBOL_GPL(dax_clear_blocks);
|
|
|
+EXPORT_SYMBOL_GPL(dax_clear_sectors);
|
|
|
|
|
|
/* the clear_pmem() calls are ordered by a wmb_pmem() in the caller */
|
|
|
static void dax_new_buf(void __pmem *addr, unsigned size, unsigned first,
|
|
@@ -485,11 +484,10 @@ static int dax_writeback_one(struct block_device *bdev,
|
|
|
* end]. This is required by data integrity operations to ensure file data is
|
|
|
* on persistent storage prior to completion of the operation.
|
|
|
*/
|
|
|
-int dax_writeback_mapping_range(struct address_space *mapping, loff_t start,
|
|
|
- loff_t end)
|
|
|
+int dax_writeback_mapping_range(struct address_space *mapping,
|
|
|
+ struct block_device *bdev, struct writeback_control *wbc)
|
|
|
{
|
|
|
struct inode *inode = mapping->host;
|
|
|
- struct block_device *bdev = inode->i_sb->s_bdev;
|
|
|
pgoff_t start_index, end_index, pmd_index;
|
|
|
pgoff_t indices[PAGEVEC_SIZE];
|
|
|
struct pagevec pvec;
|
|
@@ -500,8 +498,11 @@ int dax_writeback_mapping_range(struct address_space *mapping, loff_t start,
|
|
|
if (WARN_ON_ONCE(inode->i_blkbits != PAGE_SHIFT))
|
|
|
return -EIO;
|
|
|
|
|
|
- start_index = start >> PAGE_CACHE_SHIFT;
|
|
|
- end_index = end >> PAGE_CACHE_SHIFT;
|
|
|
+ if (!mapping->nrexceptional || wbc->sync_mode != WB_SYNC_ALL)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ start_index = wbc->range_start >> PAGE_CACHE_SHIFT;
|
|
|
+ end_index = wbc->range_end >> PAGE_CACHE_SHIFT;
|
|
|
pmd_index = DAX_PMD_INDEX(start_index);
|
|
|
|
|
|
rcu_read_lock();
|