Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56adcda5 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Greg Kroah-Hartman
Browse files

xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate



commit 983d8e60f50806f90534cc5373d0ce867e5aaf79 upstream.

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: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ca4b6a60
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -729,7 +729,8 @@ xfs_ioc_space(
		flags |= XFS_PREALLOC_CLEAR;
		flags |= XFS_PREALLOC_CLEAR;
		if (bf->l_start > XFS_ISIZE(ip)) {
		if (bf->l_start > XFS_ISIZE(ip)) {
			error = xfs_alloc_file_space(ip, 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)
			if (error)
				goto out_unlock;
				goto out_unlock;
		}
		}