summaryrefslogtreecommitdiffstats
path: root/xlators/mount/fuse/src/fuse-helpers.c
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2012-01-30 15:03:56 +0530
committerAnand Avati <avati@gluster.com>2012-02-08 03:13:08 -0800
commit8e81cbacc53adc77bc4eabb5a26d6d13012f5f86 (patch)
tree4788e3a14fb2d276689c4423cc7542f0d72c3348 /xlators/mount/fuse/src/fuse-helpers.c
parentaec6d5d89249868dc99d8fb432d8ab120bb38ef1 (diff)
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 <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/mount/fuse/src/fuse-helpers.c')
-rw-r--r--xlators/mount/fuse/src/fuse-helpers.c60
1 files changed, 16 insertions, 44 deletions
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 <sys/sysctl.h>
#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;