From 2d96ce8faa277809c0c94aca54320483889f577d Mon Sep 17 00:00:00 2001 From: Xavi Hernandez Date: Tue, 25 Sep 2018 13:22:47 +0200 Subject: all: fix warnings on non 64-bits architectures When compiling in other architectures there appear many warnings. Some of them are actual problems that prevent gluster to work correctly on those architectures. Change-Id: Icdc7107a2bc2da662903c51910beddb84bdf03c0 fixes: bz#1632717 Signed-off-by: Xavi Hernandez --- xlators/cluster/afr/src/afr-common.c | 31 ++++++++++++++------------ xlators/cluster/afr/src/afr-self-heal-common.c | 25 +++++++++++---------- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index a0ff6acd9dd..8d50144c046 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -148,7 +148,7 @@ __afr_inode_ctx_get(xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx) ret = __inode_ctx_get(inode, this, &ctx_int); if (ret == 0) { - *ctx = (afr_inode_ctx_t *)ctx_int; + *ctx = (afr_inode_ctx_t *)(uintptr_t)ctx_int; return 0; } @@ -174,7 +174,7 @@ __afr_inode_ctx_get(xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx) INIT_LIST_HEAD(&lock->owners); } - ctx_int = (uint64_t)ictx; + ctx_int = (uint64_t)(uintptr_t)ictx; ret = __inode_ctx_set(inode, this, &ctx_int); if (ret) { goto out; @@ -4842,7 +4842,7 @@ afr_forget(xlator_t *this, inode_t *inode) if (!ctx_int) return 0; - ctx = (afr_inode_ctx_t *)ctx_int; + ctx = (afr_inode_ctx_t *)(uintptr_t)ctx_int; afr_inode_ctx_destroy(ctx); return 0; } @@ -5042,8 +5042,7 @@ find_best_down_child(xlator_t *this) } if (best_child >= 0) { gf_msg_debug(this->name, 0, - "Found best down child (%d) " - "@ %ld ms latency", + "Found best down child (%d) @ %" PRId64 " ms latency", best_child, best_latency); } return best_child; @@ -5068,8 +5067,7 @@ find_worst_up_child(xlator_t *this) } if (worst_child >= 0) { gf_msg_debug(this->name, 0, - "Found worst up child (%d)" - " @ %ld ms latency", + "Found worst up child (%d) @ %" PRId64 " ms latency", worst_child, worst_latency); } return worst_child; @@ -5086,7 +5084,7 @@ __afr_handle_ping_event(xlator_t *this, xlator_t *child_xlator, const int idx, priv = this->private; priv->child_latency[idx] = child_latency_msec; - gf_msg_debug(child_xlator->name, 0, "Client ping @ %ld ms", + gf_msg_debug(child_xlator->name, 0, "Client ping @ %" PRId64 " ms", child_latency_msec); if (priv->shd.iamshd) return; @@ -5102,8 +5100,10 @@ __afr_handle_ping_event(xlator_t *this, xlator_t *child_xlator, const int idx, priv->halo_min_replicas); } else { gf_log(child_xlator->name, GF_LOG_INFO, - "Child latency (%ld ms) " - "exceeds halo threshold (%ld), " + "Child latency (%" PRId64 + " ms) " + "exceeds halo threshold (%" PRId64 + "), " "marking child down.", child_latency_msec, halo_max_latency_msec); *event = GF_EVENT_CHILD_DOWN; @@ -5112,8 +5112,10 @@ __afr_handle_ping_event(xlator_t *this, xlator_t *child_xlator, const int idx, priv->child_up[idx] == 0) { if (up_children < priv->halo_max_replicas) { gf_log(child_xlator->name, GF_LOG_INFO, - "Child latency (%ld ms) " - "below halo threshold (%ld), " + "Child latency (%" PRId64 + " ms) " + "below halo threshold (%" PRId64 + "), " "marking child up.", child_latency_msec, halo_max_latency_msec); *event = GF_EVENT_CHILD_UP; @@ -5141,7 +5143,7 @@ afr_get_halo_latency(xlator_t *this) } else { halo_max_latency_msec = priv->halo_max_latency_msec; } - gf_msg_debug(this->name, 0, "Using halo latency %ld", + gf_msg_debug(this->name, 0, "Using halo latency %" PRId64, halo_max_latency_msec); return halo_max_latency_msec; } @@ -5196,7 +5198,8 @@ __afr_handle_child_up_event(xlator_t *this, xlator_t *child_xlator, priv->child_latency[worst_up_child] > halo_max_latency_msec) { gf_msg_debug(this->name, 0, "Marking child %d down, " - "doesn't meet halo threshold (%ld), and > " + "doesn't meet halo threshold (%" PRId64 + "), and > " "halo_min_replicas (%d)", worst_up_child, halo_max_latency_msec, priv->halo_min_replicas); diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 402f5ea5888..8635b3e9e06 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1040,8 +1040,8 @@ afr_sh_fav_by_majority(xlator_t *this, struct afr_reply *replies, for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "mtime_sec = %ld, size = %lu for gfid %s", + "Child:%s mtime_sec = %" PRId64 ", size = %" PRIu64 + " for gfid %s", priv->children[i]->name, replies[i].poststat.ia_mtime, replies[i].poststat.ia_size, uuid_utoa(inode->gfid)); vote_count = 0; @@ -1079,8 +1079,9 @@ afr_sh_fav_by_mtime(xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "mtime = %ld, mtime_nsec = %d for gfid %s", + "Child:%s mtime = %" PRId64 + ", mtime_nsec = %d for " + "gfid %s", priv->children[i]->name, replies[i].poststat.ia_mtime, replies[i].poststat.ia_mtime_nsec, uuid_utoa(inode->gfid)); @@ -1116,8 +1117,9 @@ afr_sh_fav_by_ctime(xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "ctime = %ld, ctime_nsec = %d for gfid %s", + "Child:%s ctime = %" PRId64 + ", ctime_nsec = %d for " + "gfid %s", priv->children[i]->name, replies[i].poststat.ia_ctime, replies[i].poststat.ia_ctime_nsec, uuid_utoa(inode->gfid)); @@ -1152,8 +1154,7 @@ afr_sh_fav_by_size(xlator_t *this, struct afr_reply *replies, inode_t *inode) for (i = 0; i < priv->child_count; i++) { if (replies[i].valid == 1) { gf_msg_debug(this->name, 0, - "Child:%s " - "file size = %lu for gfid %s", + "Child:%s file size = %" PRIu64 " for gfid %s", priv->children[i]->name, replies[i].poststat.ia_size, uuid_utoa(inode->gfid)); if (replies[i].poststat.ia_size > cmp_sz) { @@ -1241,10 +1242,10 @@ afr_mark_split_brain_source_sinks_by_policy( strftime(ctime_str, sizeof(ctime_str), "%Y-%m-%d %H:%M:%S", tm_ptr); gf_msg(this->name, GF_LOG_WARNING, 0, AFR_MSG_SBRAIN_FAV_CHILD_POLICY, - "Source %s " - "selected as authentic to resolve conflicting " - "data in file (gfid:%s) by %s (%lu bytes @ %s mtime, " - "%s ctime).", + "Source %s selected as authentic to resolve conflicting data " + "in file (gfid:%s) by %s (%" PRIu64 + " bytes @ %s mtime, %s " + "ctime).", priv->children[fav_child]->name, uuid_utoa(inode->gfid), policy_str, replies[fav_child].poststat.ia_size, mtime_str, ctime_str); -- cgit