diff options
author | Ross Zwisler <ross.zwisler@linux.intel.com> | 2016-02-26 18:19:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-27 13:28:52 -0500 |
commit | 7f6d5b529b7dfe2fca30cbf4bc81e16575090025 (patch) | |
tree | 3dce0ed231dadcd470db83c1762a701004c1616b /fs/block_dev.c | |
parent | 20a90f58997245749c2bdfaea9e51f785ec90d0b (diff) |
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 <ross.zwisler@linux.intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 31c6d1090f11..826b164a4b5b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1697,13 +1697,24 @@ static int blkdev_releasepage(struct page *page, gfp_t wait) | |||
1697 | return try_to_free_buffers(page); | 1697 | return try_to_free_buffers(page); |
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | static int blkdev_writepages(struct address_space *mapping, | ||
1701 | struct writeback_control *wbc) | ||
1702 | { | ||
1703 | if (dax_mapping(mapping)) { | ||
1704 | struct block_device *bdev = I_BDEV(mapping->host); | ||
1705 | |||
1706 | return dax_writeback_mapping_range(mapping, bdev, wbc); | ||
1707 | } | ||
1708 | return generic_writepages(mapping, wbc); | ||
1709 | } | ||
1710 | |||
1700 | static const struct address_space_operations def_blk_aops = { | 1711 | static const struct address_space_operations def_blk_aops = { |
1701 | .readpage = blkdev_readpage, | 1712 | .readpage = blkdev_readpage, |
1702 | .readpages = blkdev_readpages, | 1713 | .readpages = blkdev_readpages, |
1703 | .writepage = blkdev_writepage, | 1714 | .writepage = blkdev_writepage, |
1704 | .write_begin = blkdev_write_begin, | 1715 | .write_begin = blkdev_write_begin, |
1705 | .write_end = blkdev_write_end, | 1716 | .write_end = blkdev_write_end, |
1706 | .writepages = generic_writepages, | 1717 | .writepages = blkdev_writepages, |
1707 | .releasepage = blkdev_releasepage, | 1718 | .releasepage = blkdev_releasepage, |
1708 | .direct_IO = blkdev_direct_IO, | 1719 | .direct_IO = blkdev_direct_IO, |
1709 | .is_dirty_writeback = buffer_check_dirty_writeback, | 1720 | .is_dirty_writeback = buffer_check_dirty_writeback, |