summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-helpers.c
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2012-10-08 14:11:15 +0530
committerVijay Bellur <vbellur@redhat.com>2012-12-12 00:19:38 -0500
commitdae281f7ed9fe1a8e57eaef5eeaebe44990fae8a (patch)
tree86bcd3799a0a0be52cc3c55aa68e8d7490c54d8b /xlators/storage/posix/src/posix-helpers.c
parentfeae7bdfbcafdaa10fbde928a62e7646222fe56a (diff)
linux-aio: fixes while setting O_DIRECT flag
Linux AIO needs O_DIRECT to be set for effective operation. O_DIRECT in turn has constraints on when it can work (offset, size alignment) So use O_DIRECT (unless instructed by application) only when offset and size alignments match. Else, io_submit() will happen over non-O_DIRECT fd, effectively blocking till the completion of the IO. Also fix a multithreading bug where detection/setting of O_DIRECT for a request was not atomic with io_submit() of that request. Change-Id: I190017e8bc78217429aff0714dca224cbe6f251d BUG: 859406 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.org/4006 Tested-by: Amar Tumballi <amarts@redhat.com> Original-Author: Anand Avati <avati@redhat.com> Reviewed-on: https://code.engineering.redhat.com/gerrit/61 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: https://code.engineering.redhat.com/gerrit/1874
Diffstat (limited to 'xlators/storage/posix/src/posix-helpers.c')
-rw-r--r--xlators/storage/posix/src/posix-helpers.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 7d419cd9222..2e7bce3ed7b 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1060,35 +1060,3 @@ posix_fd_ctx_get (fd_t *fd, xlator_t *this, struct posix_fd **pfd)
return ret;
}
-
-
-int
-posix_fd_ctx_get_off (fd_t *fd, xlator_t *this, struct posix_fd **pfd,
- off_t offset)
-{
- 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;
-}