summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-02-23 01:27:21 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-02-22 23:26:42 -0800
commit30207094c563e7e4f2d6e1f4c54abd7e918c22d4 (patch)
tree2a55e3921dba2b1578cf01650ab93619aafd3e4c
parent5ae4f11319de9a800a595175678762f9fc924755 (diff)
performance/io-cache: set path in local during 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.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 16d29109a..beb2e0ccc 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;
}