diff options
author | shishir gowda <sgowda@redhat.com> | 2012-08-23 18:34:09 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-08-27 08:08:45 -0700 |
commit | 10617e6cbc73329f259b471327d88375352042b0 (patch) | |
tree | 8fd7b0a1a17763730f11208908263baa8897df6f /xlators/storage/posix/src/posix-helpers.c | |
parent | d0c52c8064a4097d97180240b36c53bfe98cac22 (diff) |
storage/posix: implement native linux AIO support
Configurable via cli with "storage.linux-aio" settable option
Backported Avati's patch http://review.gluster.org/#change,3627
BUG: 837495
Change-Id: Ia7c26f5734d34d341debd422a5c59bba31eef844
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/3849
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-helpers.c')
-rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index f4dcc70a2ab..0e291cb9dbe 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -1066,5 +1066,29 @@ int posix_fd_ctx_get_off (fd_t *fd, xlator_t *this, struct posix_fd **pfd, off_t offset) { - return posix_fd_ctx_get (fd, this, pfd); + int ret; + int flags; + + LOCK (&fd->inode->lock); + { + ret = __posix_fd_ctx_get (fd, this, pfd); + if (ret) + goto unlock; + + if ((offset & 0xfff) && (*pfd)->odirect) { + flags = fcntl ((*pfd)->fd, F_GETFL); + ret = fcntl ((*pfd)->fd, F_SETFL, (flags & (~O_DIRECT))); + (*pfd)->odirect = 0; + } + + if (((offset & 0xfff) == 0) && (!(*pfd)->odirect)) { + flags = fcntl ((*pfd)->fd, F_GETFL); + ret = fcntl ((*pfd)->fd, F_SETFL, (flags | O_DIRECT)); + (*pfd)->odirect = 1; + } + } +unlock: + UNLOCK (&fd->inode->lock); + + return ret; } |