summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-common.h1
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c11
2 files changed, 10 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index 61687aacca0..cf7b93c1ed3 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -204,6 +204,7 @@ struct gf_defrag_info_ {
uint64_t total_files;
uint64_t total_data;
uint64_t num_files_lookedup;
+ uint64_t total_failures;
gf_lock_t lock;
int cmd;
pthread_t th;
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 5e46a80a127..819ec1daeb6 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1202,9 +1202,11 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
ret = syncop_setxattr (this, &entry_loc, migrate_data,
0);
- if (ret)
+ if (ret) {
gf_log (this->name, GF_LOG_ERROR, "migrate-data"
" failed for %s", entry_loc.path);
+ defrag->total_failures +=1;
+ }
if (ret == -1) {
op_errno = errno;
@@ -1548,6 +1550,7 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
uint64_t files = 0;
uint64_t size = 0;
uint64_t lookup = 0;
+ uint64_t failures = 0;
if (!defrag)
goto out;
@@ -1559,6 +1562,7 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
files = defrag->total_files;
size = defrag->total_data;
lookup = defrag->num_files_lookedup;
+ failures = defrag->total_failures;
if (!dict)
goto log;
@@ -1582,9 +1586,12 @@ gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict)
if (ret)
gf_log (THIS->name, GF_LOG_WARNING,
"failed to set status");
+
+ ret = dict_set_uint64 (dict, "failures", failures);
log:
gf_log (THIS->name, GF_LOG_INFO, "Files migrated: %"PRIu64", size: %"
- PRIu64", lookups: %"PRIu64, files, size, lookup);
+ PRIu64", lookups: %"PRIu64", failures: %"PRIu64, files, size,
+ lookup, failures);
out: