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

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.

BUG=b/213202826
TEST=presubmit
RELEASE_NOTE=None
SOURCE=UPSTREAM(983d8e60f50806f90534cc5373d0ce867e5aaf79)

cos-patch: bug
Change-Id: Ic1f18038d8626aaf3ce5703707f621734f386873
Signed-off-by: Vaibhav Rustagi <vaibhavrustagi@google.com>
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/27202
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Main-Branch-Verified: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index b3021d9..7b7a009 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -714,7 +714,8 @@
 		flags |= XFS_PREALLOC_CLEAR;
 		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;
 		}