summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-selfheal.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src/dht-selfheal.c')
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index d7ee74224c6..1eef4bdb59e 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -442,7 +442,9 @@ dht_distribution_type (xlator_t *this, dht_layout_t *layout)
}
range = layout->list[i].stop - layout->list[i].start;
- diff = abs (range - start_range);
+ diff = (range >= start_range)
+ ? range - start_range
+ : start_range - range;
if ((range != 0) && (diff > layout->cnt)) {
type = GF_DHT_WEIGHTED_DISTRIBUTION;