diff options
| author | Amar Tumballi <amar@gluster.com> | 2011-11-16 15:39:29 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2011-11-16 03:44:32 -0800 | 
| commit | 14f4e023822a22e0a4902acfd28c8f5ea8c94ccd (patch) | |
| tree | 580ae84b87adf7f7ce83d6a409c303aa49ba4220 /libglusterfs/src | |
| parent | 217842180858afff79d06c24389752299c5ed716 (diff) | |
core: remove 'ino' variable from 'inode_t' structure
Change-Id: I0f078d1753db65d2f2e0380d1b0450c114cf40dd
BUG: 3518
Reviewed-on: http://review.gluster.com/522
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'libglusterfs/src')
| -rw-r--r-- | libglusterfs/src/inode.c | 34 | ||||
| -rw-r--r-- | libglusterfs/src/inode.h | 3 | 
2 files changed, 21 insertions, 16 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 3239878b3..1f9da30c4 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -223,8 +223,8 @@ __is_dentry_cyclic (dentry_t *dentry)                  gf_log (dentry->inode->table->name, GF_LOG_CRITICAL,                          "detected cyclic loop formation during inode linkage." -                        " inode (%"PRId64"/%s) linking under itself as %s", -                        inode->ino, uuid_utoa (inode->gfid), name); +                        " inode (%s) linking under itself as %s", +                        uuid_utoa (inode->gfid), name);          }          return ret; @@ -275,7 +275,7 @@ __inode_hash (inode_t *inode)  static dentry_t * -__dentry_search_for_inode (inode_t *inode, ino_t par, const char *name) +__dentry_search_for_inode (inode_t *inode, uuid_t pargfid, const char *name)  {          dentry_t *dentry = NULL;          dentry_t *tmp = NULL; @@ -285,8 +285,15 @@ __dentry_search_for_inode (inode_t *inode, ino_t par, const char *name)                  return NULL;          } +        /* earlier, just the ino was sent, which could have been 0, now +           we deal with gfid, and if sent gfid is null or 0, no need to +           continue with the check */ +        if (!pargfid || uuid_is_null (pargfid)) +                return NULL; +          list_for_each_entry (tmp, &inode->dentry_list, inode_list) { -                if (tmp->parent->ino == par && !strcmp (tmp->name, name)) { +                if ((uuid_compare (tmp->parent->gfid, pargfid) == 0) && +                    !strcmp (tmp->name, name)) {                          dentry = tmp;                          break;                  } @@ -392,7 +399,7 @@ __inode_unref (inode_t *inode)          if (!inode)                  return NULL; -        if (inode->ino == 1) +        if (__is_root_gfid(inode->gfid))                  return inode;          GF_ASSERT (inode->ref); @@ -756,7 +763,6 @@ __inode_link (inode_t *inode, inode_t *parent, const char *name,                          return NULL;                  uuid_copy (inode->gfid, iatt->ia_gfid); -                inode->ino        = iatt->ia_ino;                  inode->ia_type    = iatt->ia_type;                  old_inode = __inode_find (table, inode->gfid); @@ -872,7 +878,7 @@ __inode_unlink (inode_t *inode, inode_t *parent, const char *name)          if (!inode || !parent || !name)                  return; -        dentry = __dentry_search_for_inode (inode, parent->ino, name); +        dentry = __dentry_search_for_inode (inode, parent->gfid, name);          /* dentry NULL for corrupted backend */          if (dentry) @@ -955,7 +961,7 @@ __dentry_search_arbit (inode_t *inode)  inode_t * -inode_parent (inode_t *inode, ino_t par, const char *name) +inode_parent (inode_t *inode, uuid_t pargfid, const char *name)  {          inode_t       *parent = NULL;          inode_table_t *table = NULL; @@ -970,8 +976,8 @@ inode_parent (inode_t *inode, ino_t par, const char *name)          pthread_mutex_lock (&table->lock);          { -                if (par && name) { -                        dentry = __dentry_search_for_inode (inode, par, name); +                if (pargfid && !uuid_is_null (pargfid) && name) { +                        dentry = __dentry_search_for_inode (inode, pargfid, name);                  } else {                          dentry = __dentry_search_arbit (inode);                  } @@ -1018,11 +1024,11 @@ __inode_path (inode_t *inode, const char *name, char **bufp)                  }          } -        if ((inode->ino != 1) && +        if (!__is_root_gfid (inode->gfid) &&              (i == 0)) {                  gf_log (table->name, GF_LOG_WARNING, -                        "no dentry for non-root inode %"PRId64": %s", -                        inode->ino, uuid_utoa (inode->gfid)); +                        "no dentry for non-root inode : %s", +                        uuid_utoa (inode->gfid));                  ret = -ENOENT;                  goto out;          } @@ -1059,7 +1065,7 @@ __inode_path (inode_t *inode, const char *name, char **bufp)          }  out: -        if (inode->ino == 1 && !name) { +        if (__is_root_gfid (inode->gfid) && !name) {                  ret = 1;                  if (buf) {                          GF_FREE (buf); diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h index a632ff5e9..df415286b 100644 --- a/libglusterfs/src/inode.h +++ b/libglusterfs/src/inode.h @@ -96,7 +96,6 @@ struct _inode {          gf_lock_t            lock;          uint64_t             nlookup;          uint32_t             ref;           /* reference count on this inode */ -        ino_t                ino;           /* inode number in the storage (persistent) */          ia_type_t            ia_type;       /* what kind of file */          struct list_head     fd_list;       /* list of open files on this inode */          struct list_head     dentry_list;   /* list of directory entries for this inode */ @@ -121,7 +120,7 @@ void  inode_unlink (inode_t *inode, inode_t *parent, const char *name);  inode_t * -inode_parent (inode_t *inode, ino_t par, const char *name); +inode_parent (inode_t *inode, uuid_t pargfid, const char *name);  inode_t *  inode_ref (inode_t *inode);  | 
