diff options
author | Jan Kara <jack@suse.cz> | 2016-11-21 02:47:07 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-11-21 02:47:07 +0100 |
commit | 00697eed386d57c5267aad5b8343f027b10da0c0 (patch) | |
tree | b1440f03d2aea6832e4d7ae044e665159144984e /fs/ext2 | |
parent | ext4: rip out DAX handling from direct IO path (diff) | |
download | linux-00697eed386d57c5267aad5b8343f027b10da0c0.tar.xz linux-00697eed386d57c5267aad5b8343f027b10da0c0.zip |
ext2: use iomap_zero_range() for zeroing truncated page in DAX path
Currently the last user of ext2_get_blocks() for DAX inodes was
dax_truncate_page(). Convert that to iomap_zero_range() so that all DAX
IO uses the iomap path.
Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/inode.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 41b8b44a391c..046b642f3585 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -850,6 +850,9 @@ struct iomap_ops ext2_iomap_ops = { .iomap_begin = ext2_iomap_begin, .iomap_end = ext2_iomap_end, }; +#else +/* Define empty ops for !CONFIG_FS_DAX case to avoid ugly ifdefs */ +struct iomap_ops ext2_iomap_ops; #endif /* CONFIG_FS_DAX */ int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, @@ -1293,9 +1296,11 @@ static int ext2_setsize(struct inode *inode, loff_t newsize) inode_dio_wait(inode); - if (IS_DAX(inode)) - error = dax_truncate_page(inode, newsize, ext2_get_block); - else if (test_opt(inode->i_sb, NOBH)) + if (IS_DAX(inode)) { + error = iomap_zero_range(inode, newsize, + PAGE_ALIGN(newsize) - newsize, NULL, + &ext2_iomap_ops); + } else if (test_opt(inode->i_sb, NOBH)) error = nobh_truncate_page(inode->i_mapping, newsize, ext2_get_block); else |