summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2017-07-21 16:38:14 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-10-10 08:58:39 +0000
commitc4a608799a577a4f38139f6bb8a47da8efb0fec3 (patch)
tree802a7a12349accd458bea79d5e43e7afad3a1802 /xlators/cluster/dht/src/dht-common.c
parentd4eb4ef28073fc8f5430802d9de9344e551711bb (diff)
cluster/dht: Don't store the entire uuid for subvols
Comparing the uuid string of the local node against that stored in the local_subvol information is inefficient, especially as it is done for every file to be migrated. The code has now been changed to set the value of info to 1 if the nodeuuid is that of the node making the comparison so this becomes an integer comparison. Change-Id: I7491d59caad3b71dbf5facc94dcde0cd53962775 BUG: 1451434 Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 1cc2f08..c7069a9 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -3938,7 +3938,7 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int i = 0;
int index = 0;
int found = 0;
-
+ nodeuuid_info_t *tmp_ptr = NULL;
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (frame->local, out);
@@ -4023,8 +4023,8 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
conf->local_nodeuuids[index].count = count;
- conf->local_nodeuuids[index].uuids
- = GF_CALLOC (count, sizeof (uuid_t), 1);
+ conf->local_nodeuuids[index].elements
+ = GF_CALLOC (count, sizeof (nodeuuid_info_t), 1);
/* The node-uuids are guaranteed to be returned in the same
* order as the bricks
@@ -4039,9 +4039,15 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uuid_str = next_uuid_str) {
next_uuid_str = strtok_r (NULL, " ", &saveptr);
- gf_uuid_parse (uuid_str,
- conf->local_nodeuuids[index].uuids[i]);
+ tmp_ptr = &(conf->local_nodeuuids[index].elements[i]);
+ gf_uuid_parse (uuid_str, tmp_ptr->uuid);
+
+ if (!gf_uuid_compare (tmp_ptr->uuid,
+ conf->defrag->node_uuid)) {
+ tmp_ptr->info = REBAL_NODEUUID_MINE;
+ }
i++;
+ tmp_ptr = NULL;
}
}
@@ -4061,8 +4067,8 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unwind:
- GF_FREE (conf->local_nodeuuids[index].uuids);
- conf->local_nodeuuids[index].uuids = NULL;
+ GF_FREE (conf->local_nodeuuids[index].elements);
+ conf->local_nodeuuids[index].elements = NULL;
DHT_STACK_UNWIND (getxattr, frame, -1, local->op_errno, NULL, xdata);
out: