From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: [PATCH 6/8] xfs: add DAX truncate support Date: Tue, 24 Mar 2015 21:51:04 +1100 Message-ID: <1427194266-2885-7-git-send-email-david@fromorbit.com> References: <1427194266-2885-1-git-send-email-david@fromorbit.com> Cc: linux-fsdevel@vger.kernel.org, willy@linux.intel.com, jack@suse.cz To: xfs@oss.sgi.com Return-path: Received: from ipmail04.adl6.internode.on.net ([150.101.137.141]:27601 "EHLO ipmail04.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbbCXKvT (ORCPT ); Tue, 24 Mar 2015 06:51:19 -0400 In-Reply-To: <1427194266-2885-1-git-send-email-david@fromorbit.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Dave Chinner 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 --- fs/xfs/xfs_iops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 8b9e688..9ca5352 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_dax); + else + error = block_truncate_page(inode->i_mapping, newsize, + xfs_get_blocks); if (error) return error; truncate_setsize(inode, newsize); -- 2.0.0