]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xfs: add DAX truncate support
authorDave Chinner <dchinner@redhat.com>
Wed, 3 Jun 2015 23:19:10 +0000 (09:19 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 3 Jun 2015 23:19:10 +0000 (09:19 +1000)
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 <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_iops.c

index f4cd7204e23667724c01a4c4b8efe8c1d48b1cb3..0994f95c368f8381842db5288b588b51ec301395 100644 (file)
@@ -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);