summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/gf-dirent.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-02-05 21:23:37 +0530
committerVijay Bellur <vbellur@redhat.com>2015-02-06 14:04:32 -0800
commit2efb36047aa11838b2cde93a3e95741e7ba40bae (patch)
treeb5a06756058974d9d390b1781f8c920cf28859d4 /libglusterfs/src/gf-dirent.c
parentf75bb4a9ca14b50c7f828ee3fe4ba73dd78f094c (diff)
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 <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/9485 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src/gf-dirent.c')
-rw-r--r--libglusterfs/src/gf-dirent.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/libglusterfs/src/gf-dirent.c b/libglusterfs/src/gf-dirent.c
index 3b42a0813d5..f6fd3ab54ee 100644
--- a/libglusterfs/src/gf-dirent.c
+++ b/libglusterfs/src/gf-dirent.c
@@ -67,6 +67,25 @@ gf_dirent_free (gf_dirent_t *entries)
}
}
+void
+gf_link_inode_from_dirent (xlator_t *this, inode_t *parent, gf_dirent_t *entry)
+{
+ inode_t *link_inode = NULL;
+ inode_t *tmp = NULL;
+
+ if (!entry->inode)
+ return;
+ link_inode = inode_link (entry->inode, parent,
+ entry->d_name, &entry->d_stat);
+ if (!link_inode)
+ return;
+
+ inode_lookup (link_inode);
+ tmp = entry->inode;
+ entry->inode = link_inode;
+ inode_unref (tmp);
+}
+
/* TODO: Currently, with this function, we will be breaking the
policy of 1-1 mapping of kernel nlookup refs with our inode_t's
nlookup count.
@@ -77,20 +96,9 @@ gf_link_inodes_from_dirent (xlator_t *this, inode_t *parent,
gf_dirent_t *entries)
{
gf_dirent_t *entry = NULL;
- inode_t *link_inode = NULL;
- inode_t *tmp = NULL;
list_for_each_entry (entry, &entries->list, list) {
- if (entry->inode) {
- link_inode = inode_link (entry->inode, parent,
- entry->d_name, &entry->d_stat);
- if (!link_inode)
- continue;
- inode_lookup (link_inode);
- tmp = entry->inode;
- entry->inode = link_inode;
- inode_unref (tmp);
- }
+ gf_link_inode_from_dirent (this, parent, entry);
}
return 0;