From 30207094c563e7e4f2d6e1f4c54abd7e918c22d4 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Tue, 23 Feb 2010 01:27:21 +0000 Subject: performance/io-cache: set path in local during lookup. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati 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 --- xlators/performance/io-cache/src/io-cache.c | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 16d29109..beb2e0cc 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -185,10 +185,20 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint64_t tmp_ioc_inode = 0; 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) { + op_ret = -1; + op_errno = EINVAL; + goto out; + } + + path = local->file_loc.path; + LOCK (&inode->lock); { __inode_ctx_get (inode, this, &tmp_ioc_inode); @@ -231,6 +241,11 @@ ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, ioc_table_unlock (ioc_inode->table); out: + if (frame->local != NULL) { + local = frame->local; + loc_wipe (&local->file_loc); + } + STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, stbuf, dict, postparent); return 0; @@ -240,9 +255,34 @@ int32_t 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, ret = -1; + + local = CALLOC (1, sizeof (*local)); + if (local == NULL) { + op_errno = ENOMEM; + gf_log (this->name, GF_LOG_ERROR, "out of memory"); + goto unwind; + } + + ret = loc_copy (&local->file_loc, loc); + if (ret != 0) { + op_errno = ENOMEM; + gf_log (this->name, GF_LOG_ERROR, "out of memory"); + goto unwind; + } + + frame->local = local; + STACK_WIND (frame, ioc_lookup_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->lookup, loc, xattr_req); + return 0; + +unwind: + STACK_UNWIND_STRICT (lookup, frame, -1, op_errno, NULL, NULL, + NULL, NULL); + return 0; } -- cgit