From 5cfca9f388cd153bcbcb963ba91867acf3bfac25 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Fri, 30 Sep 2011 07:07:59 +0530 Subject: cluster/afr: set fd ctx on opendir Change-Id: Ica845035781f47de990e9dcfefdeb37bed99d515 BUG: 3637 Reviewed-on: http://review.gluster.com/536 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-open.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'xlators/cluster/afr/src/afr-open.c') diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c index 4075c2724..646d23ccb 100644 --- a/xlators/cluster/afr/src/afr-open.c +++ b/xlators/cluster/afr/src/afr-open.c @@ -143,8 +143,6 @@ afr_open_cbk (call_frame_t *frame, void *cookie, fd_t *fd) { afr_local_t * local = NULL; - uint64_t ctx = 0; - afr_fd_ctx_t *fd_ctx = NULL; int ret = 0; int call_count = -1; int child_index = (long) cookie; @@ -163,32 +161,14 @@ afr_open_cbk (call_frame_t *frame, void *cookie, local->op_ret = op_ret; local->success_count++; - ret = afr_fd_ctx_set (this, fd); - - if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, - "could not set fd ctx for fd=%p", fd); - - local->op_ret = -1; - local->op_errno = -ret; - goto unlock; - } - - ret = fd_ctx_get (fd, this, &ctx); - - if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, - "could not get fd ctx for fd=%p", fd); - local->op_ret = -1; + ret = afr_child_fd_ctx_set (this, fd, child_index, + local->cont.open.flags, + local->cont.open.wbflags); + if (ret) { + local->op_ret = -1; local->op_errno = -ret; goto unlock; } - - fd_ctx = (afr_fd_ctx_t *)(long) ctx; - - fd_ctx->opened_on[child_index] = AFR_FD_OPENED; - fd_ctx->flags = local->cont.open.flags; - fd_ctx->wbflags = local->cont.open.wbflags; } } unlock: -- cgit