Commit 00697eed authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

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: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 0bd2d5ec
...@@ -850,6 +850,9 @@ struct iomap_ops ext2_iomap_ops = { ...@@ -850,6 +850,9 @@ struct iomap_ops ext2_iomap_ops = {
.iomap_begin = ext2_iomap_begin, .iomap_begin = ext2_iomap_begin,
.iomap_end = ext2_iomap_end, .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 */ #endif /* CONFIG_FS_DAX */
int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, 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) ...@@ -1293,9 +1296,11 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
inode_dio_wait(inode); inode_dio_wait(inode);
if (IS_DAX(inode)) if (IS_DAX(inode)) {
error = dax_truncate_page(inode, newsize, ext2_get_block); error = iomap_zero_range(inode, newsize,
else if (test_opt(inode->i_sb, NOBH)) PAGE_ALIGN(newsize) - newsize, NULL,
&ext2_iomap_ops);
} else if (test_opt(inode->i_sb, NOBH))
error = nobh_truncate_page(inode->i_mapping, error = nobh_truncate_page(inode->i_mapping,
newsize, ext2_get_block); newsize, ext2_get_block);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment