From 8e81cbacc53adc77bc4eabb5a26d6d13012f5f86 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Mon, 30 Jan 2012 15:03:56 +0530 Subject: fuse: fix resolver to handle graph switches properly perform resolution on the latest graph by caching it in state->itable and use fuse_nodeid as just a hint to the possible final resolved inode (in case it was resolved off the latest graph). GFID is the primary key for resolving inodes on the latest graph. Change-Id: I3921c6f59c9ff80e4ff076bec3bd334423fc36cc BUG: 785675 Reviewed-on: http://review.gluster.com/2703 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/mount/fuse/src/fuse-helpers.c | 60 ++++++++++------------------------- 1 file changed, 16 insertions(+), 44 deletions(-) (limited to 'xlators/mount/fuse/src/fuse-helpers.c') diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index 2070447fa..81994ad96 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -24,41 +24,10 @@ #include #endif -xlator_t * -fuse_state_subvol (fuse_state_t *state) -{ - xlator_t *subvol = NULL; - - if (!state) - return NULL; - - if (state->loc.inode) - subvol = state->loc.inode->table->xl; - - if (state->fd) - subvol = state->fd->inode->table->xl; - - return subvol; -} - - -xlator_t * -fuse_active_subvol (xlator_t *fuse) -{ - fuse_private_t *priv = NULL; - - priv = fuse->private; - - return priv->active_subvol; -} - - static void fuse_resolve_wipe (fuse_resolve_t *resolve) { - struct fuse_resolve_comp *comp = NULL; - if (resolve->path) GF_FREE ((void *)resolve->path); @@ -70,22 +39,18 @@ fuse_resolve_wipe (fuse_resolve_t *resolve) loc_wipe (&resolve->resolve_loc); - comp = resolve->components; - - if (comp) { - int i = 0; - - for (i = 0; comp[i].basename; i++) { - if (comp[i].inode) { - inode_unref (comp[i].inode); - comp[i].inode = NULL; - } - } + if (resolve->hint) { + inode_unref (resolve->hint); + resolve->hint = 0; + } - GF_FREE ((void *)resolve->components); - } + if (resolve->parhint) { + inode_unref (resolve->parhint); + resolve->parhint = 0; + } } + void free_fuse_state (fuse_state_t *state) { @@ -125,11 +90,18 @@ fuse_state_t * get_fuse_state (xlator_t *this, fuse_in_header_t *finh) { fuse_state_t *state = NULL; + xlator_t *active_subvol = NULL; state = (void *)GF_CALLOC (1, sizeof (*state), gf_fuse_mt_fuse_state_t); if (!state) return NULL; + + state->this = THIS; + active_subvol = fuse_active_subvol (state->this); + state->active_subvol = active_subvol; + state->itable = active_subvol->itable; + state->pool = this->ctx->pool; state->finh = finh; state->this = this; -- cgit