From 24ab0ef44a1646223b59e33d0109d8424f8eddd0 Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Tue, 25 Jul 2017 14:28:00 +0530 Subject: 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 Reviewed-on: https://review.gluster.org/17867 Reviewed-by: Amar Tumballi Smoke: Gluster Build System Reviewed-by: Raghavendra G CentOS-regression: Gluster Build System --- xlators/cluster/dht/src/dht-rebalance.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/dht/src') 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; } -- cgit