diff options
Diffstat (limited to 'libglusterfs/src')
| -rw-r--r-- | libglusterfs/src/syncop-utils.c | 35 | ||||
| -rw-r--r-- | libglusterfs/src/syncop-utils.h | 4 | 
2 files changed, 39 insertions, 0 deletions
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c index 029f10b058e..fa9e6a28768 100644 --- a/libglusterfs/src/syncop-utils.c +++ b/libglusterfs/src/syncop-utils.c @@ -591,3 +591,38 @@ out:          return ret;  } + +int +syncop_inode_find (xlator_t *this, xlator_t *subvol, +                   uuid_t gfid, inode_t **inode, +                   dict_t *xdata, dict_t **rsp_dict) +{ +        int         ret    = 0; +        loc_t       loc    = {0, }; +        struct iatt iatt   = {0, }; +	*inode =  NULL; + +        *inode = inode_find (this->itable, gfid); +        if (*inode) +                goto out; + +        loc.inode = inode_new (this->itable); +        if (!loc.inode) { +                ret = -ENOMEM; +                goto out; +        } +        gf_uuid_copy (loc.gfid, gfid); + +	ret = syncop_lookup (subvol, &loc, &iatt, NULL, xdata, rsp_dict); +        if (ret < 0) +                goto out; + +        *inode = inode_link (loc.inode, NULL, NULL, &iatt); +        if (!*inode) { +                ret = -ENOMEM; +                goto out; +        } +out: +        loc_wipe (&loc); +        return ret; +} diff --git a/libglusterfs/src/syncop-utils.h b/libglusterfs/src/syncop-utils.h index 3968d758c6e..4761371c120 100644 --- a/libglusterfs/src/syncop-utils.h +++ b/libglusterfs/src/syncop-utils.h @@ -43,4 +43,8 @@ syncop_ftw_throttle (xlator_t *subvol, loc_t *loc, int pid, void *data,                       int (*fn) (xlator_t *subvol, gf_dirent_t *entry,                                  loc_t *parent, void *data),                       int count, int sleep_time); +int +syncop_inode_find (xlator_t *this, xlator_t *subvol, +                   uuid_t gfid, inode_t **inode, +                   dict_t *xdata, dict_t **rsp_dict);  #endif /* _SYNCOP_H */  | 
