From 0143139ba85211e8b96ec238c97d0885ae0817b1 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Mon, 5 Apr 2010 05:59:17 +0000 Subject: performance/quick-read: read directly from backend for fds opened with O_DIRECT flag. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 723 (enhancements to quick read) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=723 --- xlators/performance/quick-read/src/quick-read.c | 13 +++++++++++-- xlators/performance/quick-read/src/quick-read.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'xlators/performance/quick-read') diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 41fa8b070d8..6cdb735a049 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -486,8 +486,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); { /* @@ -496,6 +497,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; @@ -781,6 +785,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 e5bca63767e..e6aebecc18d 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; -- cgit