diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2015-02-25 11:37:57 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-02-27 01:28:35 -0800 |
commit | d5624b2d4baf509ad8d6037a0d9cabf9cd5ab1c5 (patch) | |
tree | a5f257e370606282a1f9c98418e48c466077e5f3 /heal | |
parent | 6a77db6d19dba5367c02cbf2a5883ac49cef94e2 (diff) |
libglusterfs: Moved common functions as utils in syncop/common-utils
These will be used by both afr and ec. Moved syncop_dirfd, syncop_ftw,
syncop_dir_scan functions also into syncop-utils.c
Change-Id: I467253c74a346e1e292d36a8c1a035775c3aa670
BUG: 1177601
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/9740
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-by: Anuradha Talur <atalur@redhat.com>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'heal')
-rw-r--r-- | heal/src/glfs-heal.c | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index 3ea3f430e3b..7e8673a65ac 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -16,6 +16,7 @@ #include "glfs-internal.h" #include "protocol-common.h" #include "syncop.h" +#include "syncop-utils.h" #include <string.h> #include <time.h> @@ -124,43 +125,6 @@ glfsh_index_purge (xlator_t *subvol, inode_t *inode, char *name) return ret; } -int -glfsh_gfid_to_path (xlator_t *this, xlator_t *subvol, uuid_t gfid, char **path_p) -{ - int ret = 0; - char *path = NULL; - loc_t loc = {0,}; - dict_t *xattr = NULL; - - uuid_copy (loc.gfid, gfid); - loc.inode = inode_new (this->itable); - - ret = syncop_getxattr (subvol, &loc, &xattr, GFID_TO_PATH_KEY, NULL); - if (ret) - goto out; - - ret = dict_get_str (xattr, GFID_TO_PATH_KEY, &path); - if (ret || !path) { - ret = -EINVAL; - goto out; - } - - *path_p = gf_strdup (path); - if (!*path_p) { - ret = -ENOMEM; - goto out; - } - - ret = 0; - -out: - if (xattr) - dict_unref (xattr); - loc_wipe (&loc); - - return ret; -} - void glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid, uint64_t *num_entries) @@ -275,7 +239,7 @@ glfsh_process_entries (xlator_t *xl, fd_t *fd, gf_dirent_t *entries, if (ret) continue; - ret = glfsh_gfid_to_path (this, xl, gfid, &path); + ret = syncop_gfid_to_path (this->itable, xl, gfid, &path); if (ret == -ENOENT || ret == -ESTALE) { glfsh_index_purge (xl, fd->inode, entry->d_name); |