summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/pump.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/afr/src/pump.c')
-rw-r--r--xlators/cluster/afr/src/pump.c53
1 files changed, 14 insertions, 39 deletions
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index 0eb57ac2408..15eee3ee43e 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -336,20 +336,6 @@ pump_save_file_stats (xlator_t *this, const char *path)
}
static void
-_generate_gfid_on_empty (uuid_t gfid)
-{
- if (uuid_is_null (gfid))
- uuid_generate (gfid);
-}
-
-static void
-_empty_gfid_on_set (uuid_t gfid, int lookup_status, struct iatt *iatt)
-{
- if (lookup_status || !uuid_compare (gfid, iatt->ia_gfid))
- uuid_clear (gfid);
-}
-
-static void
_fill_loc_info (loc_t *loc, struct iatt *iatt, struct iatt *parent)
{
afr_update_loc_gfids (loc, iatt, parent);
@@ -368,7 +354,7 @@ _wipe_loc (loc_t *loc)
}
static int
-gf_pump_traverse_directory (loc_t *loc, uuid_t gfid)
+gf_pump_traverse_directory (loc_t *loc)
{
xlator_t *this = NULL;
afr_private_t *priv = NULL;
@@ -383,15 +369,8 @@ gf_pump_traverse_directory (loc_t *loc, uuid_t gfid)
dict_t *xattr_rsp = NULL;
int ret = 0;
gf_boolean_t is_directory_empty = _gf_true;
- dict_t *xattr_req = NULL;
gf_boolean_t free_entries = _gf_false;
- xattr_req = dict_new ();
- if (!xattr_req) {
- ret = -1;
- goto out;
- }
-
INIT_LIST_HEAD (&entries.list);
this = THIS;
priv = this->private;
@@ -429,9 +408,17 @@ gf_pump_traverse_directory (loc_t *loc, uuid_t gfid)
gf_log (this->name, GF_LOG_DEBUG,
"found readdir entry=%s", entry->d_name);
+ offset = entry->d_off;
+ if (uuid_is_null (entry->d_stat.ia_gfid)) {
+ gf_log (this->name, GF_LOG_WARNING, "%s/%s: No "
+ "gfid present skipping the file",
+ loc->path, entry->d_name);
+ continue;
+ }
_wipe_loc (&entry_loc);
- ret = afr_build_child_loc (this, &entry_loc,
- loc, entry->d_name);
+ ret = afr_build_child_loc (this, &entry_loc, loc,
+ entry->d_name,
+ entry->d_stat.ia_gfid);
if (ret)
goto out;
if (!IS_ENTRY_CWD (entry->d_name) &&
@@ -444,17 +431,9 @@ gf_pump_traverse_directory (loc_t *loc, uuid_t gfid)
entry_loc.path,
iatt.ia_ino);
- _generate_gfid_on_empty (gfid);
- ret = dict_reset (xattr_req);
- if (ret)
- goto out;
- ret = afr_set_dict_gfid (xattr_req, gfid);
- if (ret)
- goto out;
- ret = syncop_lookup (this, &entry_loc, xattr_req,
+ ret = syncop_lookup (this, &entry_loc, NULL,
&iatt, &xattr_rsp, &parent);
- _empty_gfid_on_set (gfid, ret, &iatt);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"%s: lookup failed",
@@ -480,11 +459,10 @@ gf_pump_traverse_directory (loc_t *loc, uuid_t gfid)
gf_log (this->name, GF_LOG_TRACE,
"entering dir=%s",
entry->d_name);
- gf_pump_traverse_directory (&entry_loc, gfid);
+ gf_pump_traverse_directory (&entry_loc);
}
}
}
- offset = entry->d_off;
}
gf_dirent_free (&entries);
@@ -502,8 +480,6 @@ gf_pump_traverse_directory (loc_t *loc, uuid_t gfid)
}
out:
- if (xattr_req)
- dict_unref (xattr_req);
if (entry_loc.path)
loc_wipe (&entry_loc);
if (free_entries)
@@ -660,7 +636,6 @@ pump_task (void *data)
struct iatt iatt, parent;
dict_t *xattr_rsp = NULL;
dict_t *xattr_req = NULL;
- uuid_t gfid = {0};
int ret = -1;
@@ -701,7 +676,7 @@ pump_task (void *data)
goto out;
}
- gf_pump_traverse_directory (&loc, gfid);
+ gf_pump_traverse_directory (&loc);
pump_complete_migration (this);
out: