summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-12-04 11:33:05 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-06 09:28:34 -0800
commit61823259dcbcbd41e62cbb70a996b7f19c0b8de9 (patch)
treee143d0597de18123dcab8948fd00a588cac55c85 /xlators
parent58768ac88263ad73d593a319f50c2089719f76bd (diff)
performance/stat-prefetch: refactor sp_lookup_cbk to use sp_update_inode_ctx.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 257 (Backport stat-prefetch to 2.0) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=257
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index 78e4cd5753d..96d98742f85 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: