diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2013-11-18 17:38:03 +0100 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-11-20 14:47:31 -0800 |
commit | ed75205b1ca592d0b33cc5663e7bdc4ccfc2cf02 (patch) | |
tree | 7d81e9291c43bc0da07ab88f45fafefe72b46d89 | |
parent | 2bb025699a8b9b34491c8b13a2bbb6da302a5d77 (diff) |
Build storage/posix xlator if fallocate() does not exists
If fallocate() does not exists, just return EOPNOTSUPP
BUG: 764655
Change-Id: I808114f733c88985519dc47fb7537e1ced1db077
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/6289
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | xlators/storage/posix/src/posix.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index de785420555..1a344acbb5a 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -564,6 +564,7 @@ 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, @@ -616,6 +617,7 @@ out: return ret; } +#endif /* FALLOC_FL_KEEP_SIZE */ char* _page_aligned_alloc (size_t size, char **aligned_buf) @@ -786,6 +788,10 @@ _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,}; @@ -802,6 +808,7 @@ _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; } @@ -811,6 +818,10 @@ posix_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, 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 = FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE; struct iatt statpre = {0,}; struct iatt statpost = {0,}; @@ -824,9 +835,9 @@ posix_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, return 0; err: +#endif /* FALLOC_FL_KEEP_SIZE */ STACK_UNWIND_STRICT(discard, frame, -1, -ret, NULL, NULL, NULL); return 0; - } static int32_t |