from C code using the fallocate system call, or if it's not present the xfs RESVSP ioctl, as documented by the xfsctl manpage when you have the xfsprogs development libraries installed. If you actually want to keep the file sparse it's much harder. You could try larger I/O sized, or trying using the xfs extent size hint which is set using the XFS_IOC_FSSETXATTR ioctl, again documented in the xfsctl man page.