Skip to content

Commit

Permalink
xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate
Browse files Browse the repository at this point in the history
The old ALLOCSP/FREESP ioctls in XFS can be used to preallocate space at
the end of files, just like fallocate and RESVSP.  Make the behavior
consistent with the other ioctls.

Reported-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
  • Loading branch information
Darrick J. Wong committed Dec 22, 2021
1 parent 2585cf9 commit 983d8e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/xfs/xfs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,8 @@ xfs_ioc_space(

if (bf->l_start > XFS_ISIZE(ip)) {
error = xfs_alloc_file_space(ip, XFS_ISIZE(ip),
bf->l_start - XFS_ISIZE(ip), 0);
bf->l_start - XFS_ISIZE(ip),
XFS_BMAPI_PREALLOC);
if (error)
goto out_unlock;
}
Expand Down

0 comments on commit 983d8e6

Please sign in to comment.