diff options
author | Raghavendra G <raghavendra@gluster.com> | 2010-02-23 01:22:14 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-02-22 23:26:58 -0800 |
commit | 781e390dcf0d2e4af8d8882131292a544fbb2288 (patch) | |
tree | 836b6b182717cb179dd7b457133c2d54ebab3d55 | |
parent | 23a318db143764ba62dce004fa1d774bd97bbba2 (diff) |
performance/io-cache: use loc_copy and loc_wipe in ioc_lookup.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 570 (Cache only those files whose sizes falls under a configured window size)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=570
-rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 3a440ca772d..f16bc393ff8 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -188,9 +188,6 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t weight = 0xffffffff; const char *path = NULL; ioc_local_t *local = NULL; - - if (op_ret != 0) - goto out; local = frame->local; if (local == NULL) { @@ -199,6 +196,9 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto out; } + if (op_ret != 0) + goto out; + path = local->file_loc.path; LOCK (&inode->lock); @@ -243,6 +243,10 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ioc_table_unlock (ioc_inode->table); out: + if (local != NULL) { + loc_wipe (&local->file_loc); + } + STACK_UNWIND (frame, op_ret, op_errno, inode, stbuf, dict); return 0; } @@ -252,7 +256,7 @@ ioc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) { ioc_local_t *local = NULL; - int32_t op_errno = -1; + int32_t op_errno = -1, ret = -1; local = CALLOC (1, sizeof (ioc_local_t)); if (local == NULL) { @@ -261,10 +265,14 @@ ioc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, goto unwind; } - local->file_loc.path = loc->path; - local->file_loc.inode = loc->inode; - frame->local = local; + ret = loc_copy (&local->file_loc, loc); + if (ret != 0) { + gf_log (this->name, GF_LOG_ERROR, "out of memory"); + op_errno = ENOMEM; + goto unwind; + } + STACK_WIND (frame, ioc_lookup_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->lookup, loc, xattr_req); @@ -272,6 +280,10 @@ ioc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, return 0; unwind: + if (local != NULL) { + loc_wipe (&local->file_loc); + } + STACK_UNWIND (frame, -1, op_errno, NULL, NULL, NULL); return 0; } |