summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2018-09-25 13:22:47 +0200
committerAmar Tumballi <amarts@redhat.com>2018-10-10 05:50:29 +0000
commit2d96ce8faa277809c0c94aca54320483889f577d (patch)
tree999ef8b148b186e6bf74bb22c3ff670fc6e34d38 /xlators/cluster/dht
parent0cda00f08d3d620be89830bad9d0e252648388e9 (diff)
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 <xhernandez@redhat.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c2
-rw-r--r--xlators/cluster/dht/src/dht-helper.c32
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c11
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c5
-rw-r--r--xlators/cluster/dht/src/tier.c6
5 files changed, 29 insertions, 27 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 0f668e67793..a94f904323c 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -440,7 +440,7 @@ dht_inode_ctx_mdsvol_set(inode_t *inode, xlator_t *this, xlator_t *mds_subvol)
{
ret = __inode_ctx_get(inode, this, &ctx_int);
if (ctx_int) {
- ctx = (dht_inode_ctx_t *)ctx_int;
+ ctx = (dht_inode_ctx_t *)(uintptr_t)ctx_int;
ctx->mds_subvol = mds_subvol;
} else {
ctx = GF_CALLOC(1, sizeof(*ctx), gf_dht_mt_inode_ctx_t);
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index e463aad3a0c..4764ac5fdd3 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -34,7 +34,7 @@ dht_fd_ctx_destroy(xlator_t *this, fd_t *fd)
goto out;
}
- fd_ctx = (dht_fd_ctx_t *)value;
+ fd_ctx = (dht_fd_ctx_t *)(uintptr_t)value;
if (fd_ctx) {
GF_REF_PUT(fd_ctx);
}
@@ -58,10 +58,10 @@ __dht_fd_ctx_set(xlator_t *this, fd_t *fd, xlator_t *dst)
goto out;
}
- fd_ctx->opened_on_dst = (uint64_t)dst;
+ fd_ctx->opened_on_dst = (uint64_t)(uintptr_t)dst;
GF_REF_INIT(fd_ctx, dht_free_fd_ctx);
- value = (uint64_t)fd_ctx;
+ value = (uint64_t)(uintptr_t)fd_ctx;
ret = __fd_ctx_set(fd, this, value);
if (ret < 0) {
@@ -87,8 +87,8 @@ dht_fd_ctx_set(xlator_t *this, fd_t *fd, xlator_t *dst)
{
ret = __fd_ctx_get(fd, this, &value);
if (ret && value) {
- fd_ctx = (dht_fd_ctx_t *)value;
- if (fd_ctx->opened_on_dst == (uint64_t)dst) {
+ fd_ctx = (dht_fd_ctx_t *)(uintptr_t)value;
+ if (fd_ctx->opened_on_dst == (uint64_t)(uintptr_t)dst) {
/* This could happen due to racing
* check_progress tasks*/
goto unlock;
@@ -98,7 +98,7 @@ dht_fd_ctx_set(xlator_t *this, fd_t *fd, xlator_t *dst)
"Different dst found in the fd ctx");
/* Overwrite and hope for the best*/
- fd_ctx->opened_on_dst = (uint64_t)dst;
+ fd_ctx->opened_on_dst = (uint64_t)(uintptr_t)dst;
goto unlock;
}
}
@@ -128,7 +128,7 @@ dht_fd_ctx_get(xlator_t *this, fd_t *fd)
goto out;
}
- fd_ctx = (dht_fd_ctx_t *)tmp_val;
+ fd_ctx = (dht_fd_ctx_t *)(uintptr_t)tmp_val;
GF_REF_GET(fd_ctx);
}
UNLOCK(&fd->lock);
@@ -146,7 +146,7 @@ dht_fd_open_on_dst(xlator_t *this, fd_t *fd, xlator_t *dst)
fd_ctx = dht_fd_ctx_get(this, fd);
if (fd_ctx) {
- if (fd_ctx->opened_on_dst == (uint64_t)dst) {
+ if (fd_ctx->opened_on_dst == (uint64_t)(uintptr_t)dst) {
opened = _gf_true;
}
GF_REF_PUT(fd_ctx);
@@ -182,7 +182,7 @@ dht_inode_ctx_set_mig_info(xlator_t *this, inode_t *inode, xlator_t *src_subvol,
miginfo->dst_subvol = dst_subvol;
GF_REF_INIT(miginfo, dht_free_mig_info);
- value = (uint64_t)miginfo;
+ value = (uint64_t)(uintptr_t)miginfo;
ret = inode_ctx_set1(inode, this, &value);
if (ret < 0) {
@@ -209,7 +209,7 @@ dht_inode_ctx_get_mig_info(xlator_t *this, inode_t *inode,
goto out;
}
- miginfo = (dht_migrate_info_t *)tmp_miginfo;
+ miginfo = (dht_migrate_info_t *)(uintptr_t)tmp_miginfo;
GF_REF_GET(miginfo);
}
UNLOCK(&inode->lock);
@@ -1310,7 +1310,7 @@ dht_migration_complete_check_task(void *data)
"%s: Found miginfo in the inode ctx",
tmp_loc.path ? tmp_loc.path : uuid_utoa(tmp_loc.gfid));
- miginfo = (void *)tmp_miginfo;
+ miginfo = (void *)(uintptr_t)tmp_miginfo;
GF_REF_PUT(miginfo);
}
ret = 1;
@@ -1371,7 +1371,7 @@ dht_migration_complete_check_task(void *data)
done on all the fd of inode */
ret = inode_ctx_reset1(inode, this, &tmp_miginfo);
if (tmp_miginfo) {
- miginfo = (void *)tmp_miginfo;
+ miginfo = (void *)(uintptr_t)tmp_miginfo;
GF_REF_PUT(miginfo);
goto out;
}
@@ -1578,7 +1578,7 @@ dht_rebalance_inprogress_task(void *data)
gf_msg(this->name, GF_LOG_WARNING, 0, DHT_MSG_HAS_MIGINFO,
"%s: Found miginfo in the inode ctx",
tmp_loc.path ? tmp_loc.path : uuid_utoa(tmp_loc.gfid));
- miginfo = (void *)tmp_miginfo;
+ miginfo = (void *)(uintptr_t)tmp_miginfo;
GF_REF_PUT(miginfo);
}
ret = 1;
@@ -1830,7 +1830,7 @@ dht_inode_ctx_get(inode_t *inode, xlator_t *this, dht_inode_ctx_t **ctx)
return ret;
if (ctx)
- *ctx = (dht_inode_ctx_t *)ctx_int;
+ *ctx = (dht_inode_ctx_t *)(uintptr_t)ctx_int;
out:
return ret;
}
@@ -2072,7 +2072,7 @@ __dht_lock_subvol_set(inode_t *inode, xlator_t *this, xlator_t *lock_subvol)
return -1;
}
- ctx = (dht_inode_ctx_t *)value;
+ ctx = (dht_inode_ctx_t *)(uintptr_t)value;
ctx->lock_subvol = lock_subvol;
out:
return ret;
@@ -2127,7 +2127,7 @@ dht_get_lock_subvolume(xlator_t *this, struct gf_flock *lock,
LOCK(&inode->lock);
ret = __inode_ctx_get0(inode, this, &value);
if (!ret && value) {
- ctx = (dht_inode_ctx_t *)value;
+ ctx = (dht_inode_ctx_t *)(uintptr_t)value;
subvol = ctx->lock_subvol;
}
if (!subvol && lock->l_type != F_UNLCK && cached_subvol) {
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 7a2539dc5f5..c9f41442f15 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -941,8 +941,8 @@ __dht_check_free_space(xlator_t *this, xlator_t *to, xlator_t *from, loc_t *loc,
}
gf_msg_debug(this->name, 0,
- "min_free_disk - %f , block available - "
- "%lu , block size - %lu ",
+ "min_free_disk - %f , block available - %" PRId64
+ ", block size - %lu",
conf->min_free_disk, dst_statfs.f_bavail, dst_statfs.f_bsize);
dst_statfs_blocks = dst_statfs.f_bavail *
@@ -1018,7 +1018,7 @@ check_avail_space:
gf_msg_debug(this->name, 0,
"file : %s, post_availspacepercent"
- " : %lf f_bavail : %lu min-free-disk: %lf",
+ " : %lf f_bavail : %" PRIu64 " min-free-disk: %lf",
loc->path, dst_post_availspacepercent, dst_statfs.f_bavail,
conf->min_free_disk);
@@ -1039,9 +1039,8 @@ check_avail_space:
if (conf->disk_unit != 'p') {
if ((dst_statfs_blocks * GF_DISK_SECTOR_SIZE) < conf->min_free_disk) {
gf_msg_debug(this->name, 0,
- "file : %s, destination "
- "frsize: %lu f_bavail : %lu "
- "min-free-disk: %lf",
+ "file : %s, destination frsize: %lu "
+ "f_bavail : %" PRIu64 " min-free-disk: %lf",
loc->path, dst_statfs.f_frsize, dst_statfs.f_bavail,
conf->min_free_disk);
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index fab970be394..0e57eab5f7f 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -1899,8 +1899,9 @@ dht_selfheal_layout_new_directory(call_frame_t *frame, loc_t *loc,
if (weight_by_size && total_size) {
/* We know total_size is not zero. */
chunk = ((double)0xffffffff) / ((double)total_size);
- gf_msg_debug(this->name, 0, "chunk size = 0xffffffff / %lu = %f",
- total_size, chunk);
+ gf_msg_debug(this->name, 0,
+ "chunk size = 0xffffffff / %" PRIu64 " = %f", total_size,
+ chunk);
} else {
weight_by_size = _gf_false;
chunk = ((unsigned long)0xffffffff) / bricks_to_use;
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index f7fd6ef22e2..584f1dd76ba 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -478,7 +478,8 @@ tier_can_promote_file(xlator_t *this, char const *file_name,
if (defrag->tier_conf.tier_max_promote_size &&
(current->ia_size > defrag->tier_conf.tier_max_promote_size)) {
gf_msg(this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_STATUS,
- "File %s (gfid:%s) with size (%lu) exceeds maxsize "
+ "File %s (gfid:%s) with size (%" PRIu64
+ ") exceeds maxsize "
"(%d) for promotion. File will not be promoted.",
file_name, uuid_utoa(current->ia_gfid), current->ia_size,
defrag->tier_conf.tier_max_promote_size);
@@ -505,7 +506,8 @@ tier_can_promote_file(xlator_t *this, char const *file_name,
defrag->tier_conf.watermark_hi) {
gf_msg(this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_STATUS,
"Estimated block count consumption on "
- "hot tier (%lu) exceeds hi watermark (%d%%). "
+ "hot tier (%" PRIu64
+ ") exceeds hi watermark (%d%%). "
"File will not be promoted.",
estimated_usage, defrag->tier_conf.watermark_hi);
goto err;