#ifdef CEPH_HAVE_FALLOCATE
# if !defined(DARWIN) && !defined(__FreeBSD__)
+# ifdef FALLOC_FL_KEEP_SIZE
// first try to punch a hole.
FDRef fd;
ret = lfn_open(cid, oid, false, &fd);
}
// first try fallocate
- ret = fallocate(**fd, FALLOC_FL_PUNCH_HOLE, offset, len);
+ ret = fallocate(**fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, offset, len);
if (ret < 0)
ret = -errno;
lfn_close(fd);
goto out; // yay!
if (ret != -EOPNOTSUPP)
goto out; // some other error
+# endif
# endif
#endif