summaryrefslogtreecommitdiffstats
path: root/xlators/performance/quick-read
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-04-26 07:48:29 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-04-27 02:38:06 -0700
commit81d53a0f5d09afed172ceb93061156c8910fa5d1 (patch)
treeac19e04a0b63abc8c1b31b16d35d674328c96ca0 /xlators/performance/quick-read
parentcade6a8f2305800750bf7d9a6907e02f8b06f0b6 (diff)
performance/quick-read: don't try to validate again if qr_readv is called just after validation.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 852 (QR cache-timeout 0 causes high CPU usage and app hangs) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=852
Diffstat (limited to 'xlators/performance/quick-read')
-rw-r--r--xlators/performance/quick-read/src/quick-read.c16
-rw-r--r--xlators/performance/quick-read/src/quick-read.h1
2 files changed, 13 insertions, 4 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 15d4b6378dd..6be668a7a66 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -569,6 +569,8 @@ qr_validate_cache_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto unwind;
}
+ local->just_validated = 1;
+
if (op_ret == -1) {
goto unwind;
}
@@ -599,11 +601,8 @@ qr_validate_cache_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
UNLOCK (&qr_file->lock);
- frame->local = NULL;
-
call_resume (local->stub);
- GF_FREE (local);
return 0;
unwind:
@@ -782,10 +781,18 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t start = 0, end = 0;
size_t len = 0;
struct iobuf_pool *iobuf_pool = NULL;
+ qr_local_t *local = NULL;
+ char just_validated = 0;
op_ret = 0;
conf = this->private;
+ local = frame->local;
+
+ if (local != NULL) {
+ just_validated = local->just_validated;
+ }
+
ret = fd_ctx_get (fd, this, &value);
if (ret == 0) {
qr_fd_ctx = (qr_fd_ctx_t *)(long) value;
@@ -805,7 +812,8 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
LOCK (&file->lock);
{
if (file->xattr){
- if (qr_need_validation (conf,file)) {
+ if (!just_validated &&
+ qr_need_validation (conf,file)) {
need_validation = 1;
goto unlock;
}
diff --git a/xlators/performance/quick-read/src/quick-read.h b/xlators/performance/quick-read/src/quick-read.h
index 7b832ff88ca..6de040dd6e6 100644
--- a/xlators/performance/quick-read/src/quick-read.h
+++ b/xlators/performance/quick-read/src/quick-read.h
@@ -58,6 +58,7 @@ typedef struct qr_fd_ctx qr_fd_ctx_t;
struct qr_local {
char is_open;
+ char just_validated;
fd_t *fd;
int open_flags;
int32_t op_ret;