summaryrefslogtreecommitdiff
path: root/src/os_posix/os_fallocate.c
diff options
context:
space:
mode:
authorSusan LoVerso <sue@wiredtiger.com>2014-11-17 12:34:54 -0500
committerSusan LoVerso <sue@wiredtiger.com>2014-11-17 12:34:54 -0500
commit13c511141cd91bcf439c46295551fedf93bc3c68 (patch)
tree20c62f0a1745404c754b2900e16ed991b40f5611 /src/os_posix/os_fallocate.c
parent1aaeaa8448f16ed43953dc60357af71b7dcce708 (diff)
downloadmongo-13c511141cd91bcf439c46295551fedf93bc3c68.tar.gz
KNF
Diffstat (limited to 'src/os_posix/os_fallocate.c')
-rw-r--r--src/os_posix/os_fallocate.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/os_posix/os_fallocate.c b/src/os_posix/os_fallocate.c
index 88a01a69337..57029d3f95e 100644
--- a/src/os_posix/os_fallocate.c
+++ b/src/os_posix/os_fallocate.c
@@ -77,26 +77,23 @@ __wt_fallocate(
session, WT_VERB_FILEOPS, "%s: posix_fallocate", fh->name));
#if defined(__linux__)
- /**
- * We try the direct syscall for fallocate if the libc wrapper was not found.
- * The syscall actually exists in the kernel for RHEL 5.5, but not in
- * the version of libc, so this allows it to work everywhere the kernel
- * supports it.
- */
- WT_SYSCALL_RETRY(syscall(SYS_fallocate, fh->fd, FALLOC_FL_KEEP_SIZE, offset, len), ret);
- if (ret == 0) {
- fh->fallocate_requires_locking = 0;
- }
- else if (ret == ENOSYS) {
- WT_SYSCALL_RETRY(posix_fallocate(fh->fd, offset, len), ret);
- }
- else if (ret != ENOTSUP) {
- // see above handling for ENOTSUP
- WT_RET_MSG(session, ret, "%s: fallocate", fh->name);
- }
-#else
- WT_SYSCALL_RETRY(posix_fallocate(fh->fd, offset, len), ret);
+ /*
+ * We try the direct system call for fallocate even if the C library
+ * wrapper was not found. The system call actually exists in the kernel
+ * for some Linux versions, but not in the version of the C library.
+ * This allows it to work everywhere the kernel supports it.
+ */
+ WT_SYSCALL_RETRY(syscall(SYS_fallocate,
+ fh->fd, FALLOC_FL_KEEP_SIZE, offset, len), ret);
+ if (ret == 0)
+ fh->fallocate_requires_locking = 0;
+ else if (ret != ENOTSUP && ret != ENOSYS)
+ /* See comment above about ENOTSUP. */
+ WT_RET_MSG(session, ret, "%s: fallocate", fh->name);
+ else if (ret == ENOSYS)
+ /* Fall through to posix_fallocate if ENOSYS */
#endif
+ WT_SYSCALL_RETRY(posix_fallocate(fh->fd, offset, len), ret);
if (ret == 0)
return (0);