Project

General

Profile

Bug #13444 ยป patch_FS.cc

Suggested patch - David Casier, 10/10/2015 06:47 PM

 
--- fs/FS_.cc 2015-10-10 20:12:32.974174595 +0200
+++ fs/FS.cc 2015-10-10 20:14:01.824639502 +0200
@@ -18,6 +18,10 @@
#include <fcntl.h>
// from include/linux/falloc.h:
+#ifndef FALLOC_FL_KEEP_SIZE
+# define FALLOC_FL_KEEP_SIZE 0x1
+#endif
+
#ifndef FALLOC_FL_PUNCH_HOLE
# define FALLOC_FL_PUNCH_HOLE 0x2
#endif
@@ -124,7 +128,7 @@
#ifdef CEPH_HAVE_FALLOCATE
# if !defined(DARWIN) && !defined(__FreeBSD__)
// first try fallocate
- r = fallocate(fd, FALLOC_FL_PUNCH_HOLE, offset, length);
+ r = fallocate(fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, offset, length);
if (r < 0) {
r = -errno;
}
    (1-1/1)