From 2efb36047aa11838b2cde93a3e95741e7ba40bae Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 5 Feb 2015 21:23:37 +0530 Subject: syncop: Provide syncop_ftw and syncop_dir_scan utils ftw provides file tree walk. dir_scan does just a readdir not readdirp. Also changed Afr's self-heal-daemon's crawling functions to use this. These utils will be used by ec in future to do proactive/full healing. Change-Id: I05715ddb789592c1b79a71e98f1e8cc29aac5c26 BUG: 1177601 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/9485 Tested-by: Gluster Build System Reviewed-by: Ravishankar N Reviewed-by: Krutika Dhananjay Reviewed-by: Vijay Bellur --- heal/src/glfs-heal.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'heal/src/glfs-heal.c') diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index a6208fa052f..3ea3f430e3b 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -92,37 +92,6 @@ out: return ret; } -int -glfsh_get_index_dir_fd (xlator_t *xl, loc_t *loc, fd_t **fd) -{ - int ret = -1; - - *fd = fd_create (loc->inode, GF_CLIENT_PID_GLFS_HEAL); - if (!*fd) { - printf ("fd_create failed: %s", strerror(errno)); - goto out; - } - ret = syncop_opendir (xl, loc, *fd); - if (ret) { - fd_unref(*fd); -#ifdef GF_LINUX_HOST_OS /* See comment in afr_shd_index_opendir() */ - *fd = fd_anonymous (loc->inode); - if (!*fd) { - printf ("fd_anonymous failed: %s", - strerror(errno)); - goto out; - } - ret = 0; -#else - printf ("opendir failed: %s", strerror(errno)); - goto out; -#endif - } - -out: - return ret; -} - static xlator_t* _get_afr_ancestor (xlator_t *xl) { @@ -478,7 +447,7 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc, goto out; } - ret = glfsh_get_index_dir_fd (xl, &dirloc, &fd); + ret = syncop_dirfd (xl, &dirloc, &fd, GF_CLIENT_PID_GLFS_HEAL); if (ret) goto out; @@ -691,7 +660,8 @@ glfsh_heal_from_brick (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc, else { ret = glfsh_get_index_dir_loc (rootloc, client, &dirloc, &op_errno); - ret = glfsh_get_index_dir_fd (client, &dirloc, &fd); + ret = syncop_dirfd (client, &dirloc, &fd, + GF_CLIENT_PID_GLFS_HEAL); if (ret) goto out; ret = glfsh_crawl_directory (fs, top_subvol, rootloc, client, -- cgit