summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-04-26 09:19:47 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-04-27 02:38:23 -0700
commit4db632f5f68adc1c7d7b696d24e5b25058dcedc3 (patch)
tree5dcc3e893e547f1d920b49963b592f0ff7df4938
parent70f03fafa44e4f0f422de6f59f2db936c59a317d (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
-rw-r--r--xlators/performance/quick-read/src/quick-read.c29
-rw-r--r--xlators/performance/quick-read/src/quick-read.h1
2 files changed, 21 insertions, 9 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 50b113a3ab3..1470ad50d08 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -553,10 +553,11 @@ static int32_t
qr_validate_cache_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct stat *buf)
{
- qr_file_t *qr_file = NULL;
- qr_local_t *local = NULL;
- uint64_t value = 0;
- int32_t ret = 0;
+ qr_file_t *qr_file = NULL;
+ call_stub_t *stub = NULL;
+ qr_local_t *local = NULL;
+ uint64_t value = 0;
+ int32_t ret = 0;
local = frame->local;
if ((local == NULL) || ((local->fd) == NULL)) {
@@ -596,11 +597,11 @@ qr_validate_cache_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
UNLOCK (&qr_file->lock);
- frame->local = NULL;
-
- call_resume (local->stub);
+ stub = local->stub;
+ local->stub = NULL;
+ local->just_validated = 1;
+ call_resume (stub);
- FREE (local);
return 0;
unwind:
@@ -759,6 +760,8 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset)
{
qr_file_t *file = NULL;
+ qr_local_t *local = NULL;
+ char just_validated = 0;
int32_t ret = -1, op_ret = -1, op_errno = -1;
uint64_t value = 0;
int count = -1, flags = 0, i = 0;
@@ -782,6 +785,13 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
op_ret = 0;
conf = this->private;
+ local = frame->local;
+ if (local != NULL) {
+ just_validated = local->just_validated;
+ FREE (local);
+ frame->local = NULL;
+ }
+
ret = fd_ctx_get (fd, this, &value);
if (ret == 0) {
qr_fd_ctx = (qr_fd_ctx_t *)(long) value;
@@ -801,7 +811,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 fdecd61ed04..7562f6e65af 100644
--- a/xlators/performance/quick-read/src/quick-read.h
+++ b/xlators/performance/quick-read/src/quick-read.h
@@ -56,6 +56,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;