summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2017-07-25 14:28:00 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-07-31 17:33:19 +0000
commitc394cb71cf422f68c4910c54b8a835f83fe64bc2 (patch)
tree380383778f91330803d08797f166ad12deaa6892 /xlators
parentb81fc4a89b70336607e7734ca30e4152a415d237 (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. > 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> (cherry picked from commit 24ab0ef44a1646223b59e33d0109d8424f8eddd0) Change-Id: I9f338c44da22b856e9fdc6dc558f732ae9a22f15 BUG: 1475192 Signed-off-by: N Balachandran <nbalacha@redhat.com> Reviewed-on: https://review.gluster.org/17873 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators')
-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 f1d32a9a00c..5f9644f3abb 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2521,6 +2521,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) {
@@ -2540,6 +2541,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;
@@ -2595,6 +2597,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) {
@@ -2661,7 +2664,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) {
@@ -2670,7 +2672,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) {
@@ -2681,7 +2682,6 @@ gf_defrag_migrate_single_file (void *opaque)
LOCK (&defrag->lock);
{
defrag->total_failures += 1;
- defrag->size_processed += iatt.ia_size;
}
UNLOCK (&defrag->lock);
@@ -2705,7 +2705,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);
@@ -2724,6 +2723,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;
@@ -4987,8 +4993,6 @@ log:
"Files migrated: %"PRIu64", size: %"
PRIu64", lookups: %"PRIu64", failures: %"PRIu64", skipped: "
"%"PRIu64, files, size, lookup, failures, skipped);
-
-
out:
return 0;
}