[sheepdog] [PATCH 3/7] sheep: use rintf() to get the vnode calc right
Liu Yuan
namei.unix at gmail.com
Mon Aug 13 10:14:00 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/Makefile.am | 2 +-
sheep/group.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/sheep/Makefile.am b/sheep/Makefile.am
index 16c79f0..fe15d94 100644
--- a/sheep/Makefile.am
+++ b/sheep/Makefile.am
@@ -44,7 +44,7 @@ if BUILD_TRACE
sheep_SOURCES += trace/trace.c trace/mcount.S trace/stabs.c trace/graph.c
endif
-sheep_LDADD = ../lib/libsheepdog.a -lpthread \
+sheep_LDADD = ../lib/libsheepdog.a -lpthread -lm\
$(libcpg_LIBS) $(libcfg_LIBS) $(libacrd_LIBS) $(LIBS)
sheep_DEPENDENCIES = ../lib/libsheepdog.a
diff --git a/sheep/group.c b/sheep/group.c
index 05ffb3e..3f5a8fb 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -17,6 +17,7 @@
#include <sys/time.h>
#include <sys/epoll.h>
#include <urcu/uatomic.h>
+#include <math.h>
#include "sheepdog_proto.h"
#include "sheep_priv.h"
@@ -805,7 +806,7 @@ void recalculate_vnodes(struct sd_node *nodes, int nr_nodes)
for (i = 0; i < nr_nodes; i++) {
factor = (float)nodes[i].space / (float)avg_size;
- nodes[i].nr_vnodes = SD_DEFAULT_VNODES * factor;
+ nodes[i].nr_vnodes = rintf(SD_DEFAULT_VNODES * factor);
dprintf("node %d has %d vnodes, free space %" PRIu64 "\n",
nodes[i].nid.port, nodes[i].nr_vnodes, nodes[i].space);
}
--
1.7.10.2
More information about the sheepdog
mailing list