diff options
| author | Raghavendra G <raghavendra@gluster.com> | 2010-04-26 09:31:58 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2010-04-27 02:38:15 -0700 | 
| commit | 608e73fb963a9ae3ca9a81d95f18af7b6749c846 (patch) | |
| tree | 2d97c6e04a141aeae7e99e471eab51caa4043d91 | |
| parent | 6607f92f578b4aad5a8df3e8121420b9db69382d (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.c | 29 | ||||
| -rw-r--r-- | xlators/performance/quick-read/src/quick-read.h | 1 | 
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 00d5e2643ab..f8bed732647 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -550,10 +550,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; +        qr_local_t  *local = NULL; +        uint64_t     value = 0; +        int32_t      ret = 0; +        call_stub_t *stub = NULL;          local = frame->local;           if ((local == NULL) || ((local->fd) == NULL)) { @@ -593,11 +594,11 @@ qr_validate_cache_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          }          UNLOCK (&qr_file->lock); -        frame->local = NULL; +        local->just_validated = 1; +        stub = local->stub; +        local->stub = NULL; +        call_resume (stub); -        call_resume (local->stub); -         -        FREE (local);          return 0;  unwind: @@ -773,6 +774,8 @@ 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; @@ -787,6 +790,13 @@ qr_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,                  }          } +        local = frame->local; +        if (local != NULL) { +                frame->local = NULL; +                just_validated = local->just_validated; +                FREE (local); +        } +          iobuf_pool = this->ctx->iobuf_pool;          ret = inode_ctx_get (fd->inode, this, &value); @@ -796,7 +806,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;  | 
