[Sheepdog] [PATCH] add SD_DEFAULT_REDUNDANCY
FUJITA Tomonori
fujita.tomonori at lab.ntt.co.jp
Mon May 10 13:22:10 CEST 2010
set SD_DEFAULT_REDUNDANCY to 3.
Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
collie/collie_priv.h | 1 +
collie/group.c | 2 ++
shepherd/shepherd.c | 3 +--
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/collie/collie_priv.h b/collie/collie_priv.h
index 35f0a54..adfa5bc 100644
--- a/collie/collie_priv.h
+++ b/collie/collie_priv.h
@@ -21,6 +21,7 @@
#include "net.h"
#include "collie.h"
+#define SD_DEFAULT_REDUNDANCY 3
#define SD_MAX_REDUNDANCY 8
#define SD_OP_REMOVE_OBJ 0x91
diff --git a/collie/group.c b/collie/group.c
index 91b0f4e..8955457 100644
--- a/collie/group.c
+++ b/collie/group.c
@@ -778,6 +778,8 @@ static void vdi_op_done(struct vdi_op_message *msg)
break;
case SD_OP_MAKE_FS:
sys->nr_sobjs = ((struct sd_so_req *)hdr)->copies;
+ if (!sys->nr_sobjs)
+ sys->nr_sobjs = SD_DEFAULT_REDUNDANCY;
ctime = ((struct sd_so_req *)hdr)->ctime;
set_cluster_ctime(ctime);
diff --git a/shepherd/shepherd.c b/shepherd/shepherd.c
index 51401e3..5082fe6 100644
--- a/shepherd/shepherd.c
+++ b/shepherd/shepherd.c
@@ -186,7 +186,6 @@ static int cluster_format(int argc, char **argv)
struct sd_so_rsp *rsp = (struct sd_so_rsp *)&hdr;
unsigned rlen, wlen;
struct timeval tv;
- int copies = cluster_cmd_data.copies ? cluster_cmd_data.copies : 3;
fd = connect_to("localhost", sdport);
if (fd < 0)
@@ -197,7 +196,7 @@ static int cluster_format(int argc, char **argv)
memset(&hdr, 0, sizeof(hdr));
hdr.opcode = SD_OP_MAKE_FS;
- hdr.copies = copies;
+ hdr.copies = cluster_cmd_data.copies;
hdr.epoch = node_list_version;
hdr.ctime = (uint64_t) tv.tv_sec << 32 | tv.tv_usec * 1000;
--
1.6.5
More information about the sheepdog
mailing list