mirror of https://gitee.com/openkylin/linux.git
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
|
* to hope that the caller sees ENOMEM and retries the truncate
|
||||||
* operation.
|
* 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)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
truncate_setsize(inode, newsize);
|
truncate_setsize(inode, newsize);
|
||||||
|
|
Loading…
Reference in New Issue