summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2014-09-26 02:10:46 +0200
committerVijay Bellur <vbellur@redhat.com>2014-09-26 05:24:04 -0700
commite78ad0c426c31264651b13d6138b70fa53c4af86 (patch)
tree1dc2999a1940e5f2d72dc67d3772520aa9554755
parentb32224c8a5caff175a83e6089cf2cbf90253a2d7 (diff)
Do not forbid fallocate on non Linux systems
Linux fallocate() differs from posix_fallocate() by an extra flag that can have the FALLOC_FL_KEEP_SIZE value; Do not test FALLOC_FL_KEEP_SIZE existence to enable fallocate() in posix xlator, as sys_fallocate() in libglusterfs provides support for both implementations. Backport of Idf41a0396028a15e81281791bf6912d7fd674e3f BUG: 1138897 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Change-Id: Ie6e5ea923561630c52a6db5c7f83313cfdc34811 Reviewed-on: http://review.gluster.org/8862 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/storage/posix/src/posix.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 2b979cfc27f..0fc0e4e16df 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -572,7 +572,6 @@ out:
return 0;
}
-#ifdef FALLOC_FL_KEEP_SIZE
static int32_t
posix_do_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
off_t offset, size_t len, struct iatt *statpre,
@@ -625,7 +624,6 @@ out:
return ret;
}
-#endif /* FALLOC_FL_KEEP_SIZE */
char*
_page_aligned_alloc (size_t size, char **aligned_buf)
@@ -796,16 +794,14 @@ _posix_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t keep_siz
off_t offset, size_t len, dict_t *xdata)
{
int32_t ret;
-#ifndef FALLOC_FL_KEEP_SIZE
- ret = EOPNOTSUPP;
-
-#else /* FALLOC_FL_KEEP_SIZE */
int32_t flags = 0;
struct iatt statpre = {0,};
struct iatt statpost = {0,};
+#ifdef FALLOC_FL_KEEP_SIZE
if (keep_size)
flags = FALLOC_FL_KEEP_SIZE;
+#endif /* FALLOC_FL_KEEP_SIZE */
ret = posix_do_fallocate(frame, this, fd, flags, offset, len,
&statpre, &statpost);
@@ -816,7 +812,6 @@ _posix_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t keep_siz
return 0;
err:
-#endif /* FALLOC_FL_KEEP_SIZE */
STACK_UNWIND_STRICT(fallocate, frame, -1, -ret, NULL, NULL, NULL);
return 0;
}