diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 4c7c7bfb2b2f..dc6e4fb8bbc9 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -2272,7 +2272,7 @@ xfs_alloc_file_space( | |||
2272 | count = len; | 2272 | count = len; |
2273 | imapp = &imaps[0]; | 2273 | imapp = &imaps[0]; |
2274 | nimaps = 1; | 2274 | nimaps = 1; |
2275 | bmapi_flag = XFS_BMAPI_WRITE | (alloc_type ? XFS_BMAPI_PREALLOC : 0); | 2275 | bmapi_flag = XFS_BMAPI_WRITE | alloc_type; |
2276 | startoffset_fsb = XFS_B_TO_FSBT(mp, offset); | 2276 | startoffset_fsb = XFS_B_TO_FSBT(mp, offset); |
2277 | allocatesize_fsb = XFS_B_TO_FSB(mp, count); | 2277 | allocatesize_fsb = XFS_B_TO_FSB(mp, count); |
2278 | 2278 | ||
@@ -2711,6 +2711,7 @@ xfs_change_file_space( | |||
2711 | xfs_off_t llen; | 2711 | xfs_off_t llen; |
2712 | xfs_trans_t *tp; | 2712 | xfs_trans_t *tp; |
2713 | struct iattr iattr; | 2713 | struct iattr iattr; |
2714 | int prealloc_type; | ||
2714 | 2715 | ||
2715 | if (!S_ISREG(ip->i_d.di_mode)) | 2716 | if (!S_ISREG(ip->i_d.di_mode)) |
2716 | return XFS_ERROR(EINVAL); | 2717 | return XFS_ERROR(EINVAL); |
@@ -2753,12 +2754,17 @@ xfs_change_file_space( | |||
2753 | * size to be changed. | 2754 | * size to be changed. |
2754 | */ | 2755 | */ |
2755 | setprealloc = clrprealloc = 0; | 2756 | setprealloc = clrprealloc = 0; |
2757 | prealloc_type = XFS_BMAPI_PREALLOC; | ||
2756 | 2758 | ||
2757 | switch (cmd) { | 2759 | switch (cmd) { |
2760 | case XFS_IOC_ZERO_RANGE: | ||
2761 | prealloc_type |= XFS_BMAPI_CONVERT; | ||
2762 | xfs_tosspages(ip, startoffset, startoffset + bf->l_len, 0); | ||
2763 | /* FALLTHRU */ | ||
2758 | case XFS_IOC_RESVSP: | 2764 | case XFS_IOC_RESVSP: |
2759 | case XFS_IOC_RESVSP64: | 2765 | case XFS_IOC_RESVSP64: |
2760 | error = xfs_alloc_file_space(ip, startoffset, bf->l_len, | 2766 | error = xfs_alloc_file_space(ip, startoffset, bf->l_len, |
2761 | 1, attr_flags); | 2767 | prealloc_type, attr_flags); |
2762 | if (error) | 2768 | if (error) |
2763 | return error; | 2769 | return error; |
2764 | setprealloc = 1; | 2770 | setprealloc = 1; |