summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-04-06 02:18:26 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-04-08 03:08:50 -0700
commitd4098b8774ab222b50bde4f63882e6e25da4a1f7 (patch)
tree458fcca97acb1e1c8c94944dfb3426c244588943
parent03847ffada833ea7126f2118063245dff013c23f (diff)
performance/quick-read: read directly from backend for fds opened with O_DIRECT flag.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 723 (enhancements to quick read) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=723
-rw-r--r--xlators/performance/quick-read/src/quick-read.c13
-rw-r--r--xlators/performance/quick-read/src/quick-read.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 53da888..00d5e26 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -482,8 +482,9 @@ qr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
goto unwind;
}
- if (!content_cached || ((flags & O_WRONLY) == O_WRONLY)
- || ((flags & O_TRUNC) == O_TRUNC)) {
+ if (!content_cached || ((flags & O_ACCMODE) == O_WRONLY)
+ || ((flags & O_TRUNC) == O_TRUNC)
+ || ((flags & O_DIRECT) == O_DIRECT)) {
LOCK (&qr_fd_ctx->lock);
{
/*
@@ -492,6 +493,9 @@ qr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
*/
qr_fd_ctx->open_in_transit = 1;
+ if ((flags & O_DIRECT) == O_DIRECT) {
+ qr_fd_ctx->disabled = 1;
+ }
}
UNLOCK (&qr_fd_ctx->lock);
goto wind;
@@ -776,6 +780,11 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
ret = fd_ctx_get (fd, this, &value);
if (ret == 0) {
qr_fd_ctx = (qr_fd_ctx_t *)(long) value;
+ if (qr_fd_ctx != NULL) {
+ if (qr_fd_ctx->disabled) {
+ goto out;
+ }
+ }
}
iobuf_pool = this->ctx->iobuf_pool;
diff --git a/xlators/performance/quick-read/src/quick-read.h b/xlators/performance/quick-read/src/quick-read.h
index 57a7e4d..fdecd61 100644
--- a/xlators/performance/quick-read/src/quick-read.h
+++ b/xlators/performance/quick-read/src/quick-read.h
@@ -45,6 +45,7 @@
struct qr_fd_ctx {
char opened;
+ char disabled;
char open_in_transit;
char *path;
int flags;