From: Darrick J. Wong Date: Fri, 14 Jan 2022 22:38:32 +0000 (-0800) Subject: unwritten_sync: convert XFS_IOC_FREESP64 to ftruncate X-Git-Tag: v2022.05.01~108 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=bec9f2cc9d7ad86a9bf2a602529bc20667fcfe88;ds=sidebyside unwritten_sync: convert XFS_IOC_FREESP64 to ftruncate This ioctl will be dropped soon, so port the program to use ftruncate, which does the same thing. Signed-off-by: Darrick J. Wong Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/src/unwritten_sync.c b/src/unwritten_sync.c index ebdc8248..45ac7df9 100644 --- a/src/unwritten_sync.c +++ b/src/unwritten_sync.c @@ -92,10 +92,11 @@ main(int argc, char *argv[]) print_getbmapx(file, fd, 0, 0); - flock.l_whence = 0; - flock.l_start= 0; - flock.l_len = 0; - xfsctl(file, fd, XFS_IOC_FREESP64, &flock); + if (ftruncate(fd, 0)) { + perror("ftruncate"); + exit(1); + } + print_getbmapx(file, fd, 0, 0); close(fd); }