mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
dax: move writeback calls into the filesystems
Previously calls to dax_writeback_mapping_range() for all DAX filesystems (ext2, ext4 & xfs) were centralized in filemap_write_and_wait_range(). dax_writeback_mapping_range() needs a struct block_device, and it used to get that from inode->i_sb->s_bdev. This is correct for normal inodes mounted on ext2, ext4 and XFS filesystems, but is incorrect for DAX raw block devices and for XFS real-time files. Instead, call dax_writeback_mapping_range() directly from the filesystem ->writepages function so that it can supply us with a valid block device. This also fixes DAX code to properly flush caches in response to sync(2). Signed-off-by: Ross Zwisler <[email protected]> Signed-off-by: Jan Kara <[email protected]> Cc: Al Viro <[email protected]> Cc: Dan Williams <[email protected]> Cc: Dave Chinner <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Theodore Ts'o <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
20a90f5899
commit
7f6d5b529b
7 changed files with 43 additions and 16 deletions
12
fs/dax.c
12
fs/dax.c
|
|
@ -484,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;
|
||||
|
|
@ -499,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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue