summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2017-07-25 14:28:00 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-07-25 21:52:48 +0000
commit24ab0ef44a1646223b59e33d0109d8424f8eddd0 (patch)
tree526bdd272e8e7ae799ea229bfefe906c9a48e195
parent6e41b17d855cf680efb93414083cf1490007d3ce (diff)
cluster/dht: Update size processed for non-migrated files
The size of non-migrated files was not added to the size_processed causing incorrect rebalance estimate calculations. This has been fixed. Change-Id: I9f338c44da22b856e9fdc6dc558f732ae9a22f15 BUG: 1467209 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: https://review.gluster.org/17867 Reviewed-by: Amar Tumballi <amarts@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 35e19e5af7c..e89c7e24202 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2520,6 +2520,7 @@ gf_defrag_migrate_single_file (void *opaque)
int fop_errno = 0;
gf_dht_migrate_data_type_t rebal_type = GF_DHT_MIGRATE_DATA;
char value[MAX_REBAL_TYPE_SIZE] = {0,};
+ struct iatt *iatt_ptr = NULL;
rebal_entry = (struct dht_container *)opaque;
if (!rebal_entry) {
@@ -2539,6 +2540,7 @@ gf_defrag_migrate_single_file (void *opaque)
migrate_data = rebal_entry->migrate_data;
entry = rebal_entry->df_entry;
+ iatt_ptr = &entry->d_stat;
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
ret = -1;
@@ -2594,6 +2596,7 @@ gf_defrag_migrate_single_file (void *opaque)
goto out;
}
+ iatt_ptr = &iatt;
hashed_subvol = dht_subvol_get_hashed (this, &entry_loc);
if (!hashed_subvol) {
@@ -2660,7 +2663,6 @@ gf_defrag_migrate_single_file (void *opaque)
LOCK (&defrag->lock);
{
defrag->skipped += 1;
- defrag->size_processed += iatt.ia_size;
}
UNLOCK (&defrag->lock);
} else if (fop_errno == ENOTSUP) {
@@ -2669,7 +2671,6 @@ gf_defrag_migrate_single_file (void *opaque)
LOCK (&defrag->lock);
{
defrag->skipped += 1;
- defrag->size_processed += iatt.ia_size;
}
UNLOCK (&defrag->lock);
} else if (fop_errno != EEXIST) {
@@ -2680,7 +2681,6 @@ gf_defrag_migrate_single_file (void *opaque)
LOCK (&defrag->lock);
{
defrag->total_failures += 1;
- defrag->size_processed += iatt.ia_size;
}
UNLOCK (&defrag->lock);
@@ -2704,7 +2704,6 @@ gf_defrag_migrate_single_file (void *opaque)
{
defrag->total_files += 1;
defrag->total_data += iatt.ia_size;
- defrag->size_processed += iatt.ia_size;
}
UNLOCK (&defrag->lock);
@@ -2723,6 +2722,13 @@ out:
STACK_DESTROY (statfs_frame->root);
}
+ if (iatt_ptr) {
+ LOCK (&defrag->lock);
+ {
+ defrag->size_processed += iatt_ptr->ia_size;
+ }
+ UNLOCK (&defrag->lock);
+ }
loc_wipe (&entry_loc);
return ret;
@@ -4977,8 +4983,6 @@ log:
"Files migrated: %"PRIu64", size: %"
PRIu64", lookups: %"PRIu64", failures: %"PRIu64", skipped: "
"%"PRIu64, files, size, lookup, failures, skipped);
-
-
out:
return 0;
}