summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-10-29 12:06:57 +0530
committerDan Lambright <dlambrig@redhat.com>2015-11-04 13:13:07 -0800
commitdab82c7ba3901cfdf94db0cd69a46ea396cf920a (patch)
tree252c51e70c8372ad0d5a3633dc5ee93792c6da21
parent698038f67c00bd528a7be89a0fccdd52914e01ce (diff)
tier/dht: Ignoring replica for migration counting
We used to count replica files for migration counting even though they were ignore for migration as the replica brick didnt have the ownership (as per the replication xlator either AFR/EC). As a result the number of files migrated would show a wrong count, i.e each replicated file would be counted 1 + number of replica. This patch ignores such cases. Change-Id: I91aa352ee3b0a5029790653266e9333f3947d0ac BUG: 1276141 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/12453 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
-rw-r--r--xlators/cluster/dht/src/tier.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 5f3752c2efb..010e43c4107 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -101,14 +101,14 @@ tier_check_same_node (xlator_t *this, loc_t *loc, gf_defrag_info_t *defrag)
}
if (gf_uuid_parse (uuid_str, node_uuid)) {
- gf_msg (this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_LOG_TIER_ERROR,
"uuid_parse failed for %s", loc->path);
goto out;
}
if (gf_uuid_compare (node_uuid, defrag->node_uuid)) {
- gf_msg_trace (this->name, 0,
- "%s does not belong to this node", loc->path);
+ gf_msg_trace (this->name, 0,
+ "%s does not belong to this node", loc->path);
ret = 1;
goto out;
}
@@ -255,6 +255,12 @@ tier_migrate_using_query_file (void *_args)
loc_t loc = {0,};
dict_t *migrate_data = NULL;
inode_t *linked_inode = NULL;
+ /*
+ * per_file_status and per_link_status
+ * 0 : success
+ * -1 : failure
+ * 1 : ignore the status and dont count for migration
+ * */
int per_file_status = 0;
int per_link_status = 0;
int total_status = 0;
@@ -493,9 +499,18 @@ tier_migrate_using_query_file (void *_args)
src_subvol->name,
loc.name);
- if (tier_check_same_node (this, &loc, defrag)) {
- if (ret < 0)
+
+ ret = tier_check_same_node (this, &loc, defrag);
+ if (ret != 0) {
+ if (ret < 0) {
per_link_status = -1;
+ goto abort;
+ }
+ ret = 0;
+ /* By setting per_linl_status to 1 we are
+ * ignoring this status and will not be counting
+ * this file for migration */
+ per_link_status = 1;
goto abort;
}
@@ -568,14 +583,16 @@ abort:
}
per_file_status = per_link_status;
per_file_out:
- if (per_file_status) {
+ if (per_file_status < 0) {/* Failure */
pthread_mutex_lock (&dm_stat_mutex);
defrag->total_failures++;
pthread_mutex_unlock (&dm_stat_mutex);
- } else {
+ } else if (per_file_status == 0) {/* Success */
pthread_mutex_lock (&dm_stat_mutex);
defrag->total_files++;
pthread_mutex_unlock (&dm_stat_mutex);
+ } else if (per_file_status == 1) {/* Ignore */
+ per_file_status = 0;
}
total_status = total_status + per_file_status;
per_link_status = 0;