From 61823259dcbcbd41e62cbb70a996b7f19c0b8de9 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Fri, 4 Dec 2009 11:33:05 +0000 Subject: performance/stat-prefetch: refactor sp_lookup_cbk to use sp_update_inode_ctx. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 257 (Backport stat-prefetch to 2.0) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=257 --- .../performance/stat-prefetch/src/stat-prefetch.c | 34 ++++++---------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'xlators/performance/stat-prefetch/src') diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 78e4cd575..96d98742f 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -841,14 +841,13 @@ sp_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct stat *buf, dict_t *dict) { - sp_inode_ctx_t *inode_ctx = NULL; - uint64_t value = 0; int ret = 0; struct list_head waiting_ops = {0, }; call_stub_t *stub = NULL, *tmp = NULL; sp_local_t *local = NULL; sp_cache_t *cache = NULL; char need_unwind = 0; + char looked_up = 0, lookup_in_progress = 0; INIT_LIST_HEAD (&waiting_ops); @@ -877,30 +876,15 @@ sp_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, need_unwind = 1; } - ret = inode_ctx_get (local->loc.inode, this, &value); - if (ret == 0) { - inode_ctx = (sp_inode_ctx_t *)(long)value; - if (inode_ctx == NULL) { - op_ret = -1; - op_errno = EINVAL; - goto out; - } - - LOCK (&inode_ctx->lock); - { - inode_ctx->op_ret = op_ret; - inode_ctx->op_errno = op_errno; - inode_ctx->looked_up = 1; - inode_ctx->lookup_in_progress = 0; - list_splice_init (&inode_ctx->waiting_ops, - &waiting_ops); - } - UNLOCK (&inode_ctx->lock); + lookup_in_progress = 0; + looked_up = 1; + ret = sp_update_inode_ctx (this, local->loc.inode, &op_ret, &op_errno, + &lookup_in_progress, &looked_up, + &waiting_ops, &op_errno); - list_for_each_entry_safe (stub, tmp, &waiting_ops, list) { - list_del_init (&stub->list); - call_resume (stub); - } + list_for_each_entry_safe (stub, tmp, &waiting_ops, list) { + list_del_init (&stub->list); + call_resume (stub); } out: -- cgit