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
This commit is contained in:
parent
5ae4f11319
commit
30207094c5
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user