xfs: add DAX truncate support
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>
This commit is contained in:
parent
4f69f578a8
commit
9969441f9f
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue