From: Dave Chinner Date: Wed, 3 Jun 2015 23:19:10 +0000 (+1000) Subject: xfs: add DAX truncate support X-Git-Tag: v4.1.12-92~18^2^2~178 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f4e4927eccd71458e64311104e16b897b6e91c34;p=users%2Fjedix%2Flinux-maple.git xfs: add DAX truncate support Orabug: 22913653 When we truncate a DAX file, we need to call through the DAX page truncation path rather than through block_truncate_page() so that mappings and block zeroing are all handled correctly. Otherwise, truncate does not need to change. Signed-off-by: Dave Chinner Reviewed-by: Brian Foster Signed-off-by: Dave Chinner (cherry picked from commit 9969441f9f86a8a7de8c36514fa789e5f5d83145) Signed-off-by: Dan Duval --- diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index f4cd7204e2366..0994f95c368f8 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -851,7 +851,11 @@ xfs_setattr_size( * to hope that the caller sees ENOMEM and retries the truncate * operation. */ - error = block_truncate_page(inode->i_mapping, newsize, xfs_get_blocks); + if (IS_DAX(inode)) + error = dax_truncate_page(inode, newsize, xfs_get_blocks_direct); + else + error = block_truncate_page(inode->i_mapping, newsize, + xfs_get_blocks); if (error) return error; truncate_setsize(inode, newsize);