diff options
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
| -rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 34 | 
1 files changed, 34 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 0131feaa0..afff0517e 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -3813,3 +3813,37 @@ afr_set_low_priority (call_frame_t *frame)  {          frame->root->pid = LOW_PRIO_PROC_PID;  } + +int +afr_child_fd_ctx_set (xlator_t *this, fd_t *fd, int32_t child, +                      int flags, int32_t wbflags) +{ +        int             ret = 0; +        uint64_t        ctx = 0; +        afr_fd_ctx_t    *fd_ctx      = NULL; + +        GF_ASSERT (fd && fd->inode); +        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); +                goto out; +        } + +        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); +                goto out; +        } + +        fd_ctx = (afr_fd_ctx_t *)(long) ctx; +        fd_ctx->opened_on[child] = AFR_FD_OPENED; +        if (!IA_ISDIR (fd->inode->ia_type)) { +                fd_ctx->flags            = flags; +                fd_ctx->wbflags          = wbflags; +        } +        ret = 0; +out: +        return ret; +}  | 
