summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-12-03 21:46:52 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-04 01:46:30 -0800
commit4db7a358a294e11568ef818e64d5b3f37176609b (patch)
tree8c9b934818be16e60190269009c174286ac70433 /xlators/performance
parent58535b168ca9d65a5c5018f89882d7c18d8f15fe (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: 221 (stat prefetch implementation) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=221
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index e4dedb5ad..30a3f9b06 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -629,14 +629,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, struct stat *postparent)
{
- 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;
int need_unwind = 0;
+ char looked_up = 0, lookup_in_progress = 0;
INIT_LIST_HEAD (&waiting_ops);
@@ -663,36 +662,18 @@ sp_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->is_lookup)
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;
- if ((op_ret == 0) && S_ISDIR (buf->st_mode)) {
- memcpy (&inode_ctx->stbuf, buf,
- sizeof (*buf));
- }
- 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, buf,
+ &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:
if (need_unwind) {
SP_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, buf,