From e3592d7fab0dc9d3f304d3eda34ba862f2c657a6 Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Mon, 29 Jul 2019 15:20:22 +0530 Subject: cluster/dht: Log hashes in hex Log layout hash ranges in hex to make it easier to compare them to the on disk xattrs. Change-Id: Ib75c2508bf8e0ab7f5ae26d0443ef02b792b7307 Fixes: bz#1697293 Signed-off-by: N Balachandran --- xlators/cluster/dht/src/dht-common.c | 6 ++---- xlators/cluster/dht/src/dht-layout.c | 14 +++++++------- xlators/cluster/dht/src/dht-selfheal.c | 4 ++-- xlators/cluster/dht/src/dht-shared.c | 4 ++-- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 8a1ec2baa7a..04abe008e17 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -10940,8 +10940,7 @@ dht_log_new_layout_for_dir_selfheal(xlator_t *this, loc_t *loc, for (i = 0; i < layout->cnt; i++) { ret = snprintf(string, sizeof(string), "[Subvol_name: %s, Err: %d , Start: " - "%" PRIu32 " , Stop: %" PRIu32 " , Hash: %" PRIu32 - " ], ", + "0x%x, Stop: 0x%x, Hash: 0x%x], ", layout->list[i].xlator->name, layout->list[i].err, layout->list[i].start, layout->list[i].stop, layout->list[i].commit_hash); @@ -10970,8 +10969,7 @@ dht_log_new_layout_for_dir_selfheal(xlator_t *this, loc_t *loc, for (i = 0; i < layout->cnt; i++) { ret = snprintf(output_string + off, len - off, "[Subvol_name: %s, Err: %d , Start: " - "%" PRIu32 " , Stop: %" PRIu32 " , Hash: %" PRIu32 - " ], ", + "0x%x, Stop: 0x%x, Hash: 0x%x], ", layout->list[i].xlator->name, layout->list[i].err, layout->list[i].start, layout->list[i].stop, layout->list[i].commit_hash); diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index 9cbb0f72171..dc14d72c1ff 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -146,7 +146,7 @@ dht_layout_search(xlator_t *this, dht_layout_t *layout, const char *name) if (!subvol) { gf_msg(this->name, GF_LOG_WARNING, 0, DHT_MSG_HASHED_SUBVOL_GET_FAILED, - "no subvolume for hash (value) = %u", hash); + "no subvolume for hash (value) = 0x%x", hash); } out: @@ -299,9 +299,10 @@ dht_disk_layout_merge(xlator_t *this, dht_layout_t *layout, int pos, layout->list[pos].start = start_off; layout->list[pos].stop = stop_off; - gf_msg_trace( - this->name, 0, "merged to layout: %u - %u (type %d, hash %d) from %s", - start_off, stop_off, commit_hash, type, layout->list[pos].xlator->name); + gf_msg_trace(this->name, 0, + "merged to layout: 0x%x - 0x%x (hash 0x%x, type %d) from %s", + start_off, stop_off, commit_hash, type, + layout->list[pos].xlator->name); return 0; } @@ -751,9 +752,8 @@ dht_layout_dir_mismatch(xlator_t *this, dht_layout_t *layout, xlator_t *subvol, (layout->list[pos].stop != stop_off) || (layout->list[pos].commit_hash != commit_hash)) { gf_msg(this->name, GF_LOG_INFO, 0, DHT_MSG_LAYOUT_INFO, - "subvol: %s; inode layout - %" PRIu32 " - %" PRIu32 " - %" PRIu32 - "; " - "disk layout - %" PRIu32 " - %" PRIu32 " - %" PRIu32, + "subvol: %s; inode layout: 0x%x - 0x%x, 0x%x; " + "disk layout: 0x%x - 0x%x, 0x%x", layout->list[pos].xlator->name, layout->list[pos].start, layout->list[pos].stop, layout->list[pos].commit_hash, start_off, stop_off, commit_hash); diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 11e4a34175c..e7d8028f7f8 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -19,7 +19,7 @@ layout->list[i].commit_hash = layout->commit_hash; \ \ gf_msg_trace(this->name, 0, \ - "gave fix: %u - %u, with commit-hash %u" \ + "gave fix: 0x%x - 0x%x, with commit-hash 0x%x" \ " on %s for %s", \ layout->list[i].start, layout->list[i].stop, \ layout->list[i].commit_hash, \ @@ -778,7 +778,7 @@ dht_selfheal_dir_xattr_persubvol(call_frame_t *frame, loc_t *loc, disk_layout = NULL; gf_msg_trace(this->name, 0, - "setting hash range %u - %u (type %d) on subvolume %s" + "setting hash range 0x%x - 0x%x (type %d) on subvolume %s" " for %s", layout->list[i].start, layout->list[i].stop, layout->type, subvol->name, loc->path); diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c index e4c9d5c3dec..0b73121b15a 100644 --- a/xlators/cluster/dht/src/dht-shared.c +++ b/xlators/cluster/dht/src/dht-shared.c @@ -72,9 +72,9 @@ dht_layout_dump(dht_layout_t *layout, const char *prefix) gf_proc_dump_build_key(key, prefix, "list[%d].err", i); gf_proc_dump_write(key, "%d", layout->list[i].err); gf_proc_dump_build_key(key, prefix, "list[%d].start", i); - gf_proc_dump_write(key, "%u", layout->list[i].start); + gf_proc_dump_write(key, "0x%x", layout->list[i].start); gf_proc_dump_build_key(key, prefix, "list[%d].stop", i); - gf_proc_dump_write(key, "%u", layout->list[i].stop); + gf_proc_dump_write(key, "0x%x", layout->list[i].stop); if (layout->list[i].xlator) { gf_proc_dump_build_key(key, prefix, "list[%d].xlator.type", i); gf_proc_dump_write(key, "%s", layout->list[i].xlator->type); -- cgit