[sheepdog] [PATCH UPDATE] sheep: remove SD_MAX{DEFAULT}_REDUNDANCY use SD_MAX{DEFAULT}_COPIES instead
levin li
levin108 at gmail.com
Sun Aug 5 17:21:14 CEST 2012
From: levin li <xingke.lwp at taobao.com>
Signed-off-by: levin li <xingke.lwp at taobao.com>
---
collie/cluster.c | 4 ++--
include/internal_proto.h | 5 ++---
include/sheep.h | 2 +-
sheep/gateway.c | 6 +++---
sheep/group.c | 2 +-
sheep/ops.c | 2 +-
6 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/collie/cluster.c b/collie/cluster.c
index d94c89a..9302b78 100644
--- a/collie/cluster.c
+++ b/collie/cluster.c
@@ -531,9 +531,9 @@ static int cluster_parser(int ch, char *opt)
if (opt == p || copies < 1) {
fprintf(stderr, "There must be at least one copy of data\n");
exit(EXIT_FAILURE);
- } else if (copies > SD_MAX_REDUNDANCY) {
+ } else if (copies > SD_MAX_COPIES) {
fprintf(stderr, "Redundancy may not exceed %d copies\n",
- SD_MAX_REDUNDANCY);
+ SD_MAX_COPIES);
exit(EXIT_FAILURE);
}
cluster_cmd_data.copies = copies;
diff --git a/include/internal_proto.h b/include/internal_proto.h
index 114f98a..83d98f1 100644
--- a/include/internal_proto.h
+++ b/include/internal_proto.h
@@ -21,10 +21,9 @@
#define SD_SHEEP_PROTO_VER 0x06
-#define SD_DEFAULT_REDUNDANCY 3
-#define SD_MAX_REDUNDANCY 8
+#define SD_DEFAULT_COPIES 3
+#define SD_MAX_COPIES 8
-#define SD_MAX_COPIES 16
#define SD_MAX_NODES 1024
#define SD_DEFAULT_VNODES 64
#define SD_MAX_VNODES 65536
diff --git a/include/sheep.h b/include/sheep.h
index d37aaa2..bf728a6 100644
--- a/include/sheep.h
+++ b/include/sheep.h
@@ -124,7 +124,7 @@ static inline int get_vnode_next_idx(struct sd_vnode *entries, int nr_entries,
static inline int get_vnode_nth_idx(struct sd_vnode *entries,
int nr_entries, uint64_t oid, int nth)
{
- int nr_idxs = 0, idxs[SD_MAX_REDUNDANCY];
+ int nr_idxs = 0, idxs[SD_MAX_COPIES];
idxs[nr_idxs++] = get_vnode_first_idx(entries, nr_entries, oid);
diff --git a/sheep/gateway.c b/sheep/gateway.c
index 382dc7c..bdbd08c 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -105,7 +105,7 @@ struct write_info_entry {
};
struct write_info {
- struct write_info_entry ent[SD_MAX_REDUNDANCY];
+ struct write_info_entry ent[SD_MAX_COPIES];
int nr_sent;
};
@@ -130,7 +130,7 @@ static inline void finish_one_write_err(struct write_info *wi, int i)
}
struct pfd_info {
- struct pollfd pfds[SD_MAX_REDUNDANCY];
+ struct pollfd pfds[SD_MAX_COPIES];
int nr;
};
@@ -202,7 +202,7 @@ finish_write:
static inline void write_info_init(struct write_info *wi)
{
int i;
- for (i = 0; i < SD_MAX_REDUNDANCY; i++)
+ for (i = 0; i < SD_MAX_COPIES; i++)
wi->ent[i].pfd.fd = -1;
wi->nr_sent = 0;
}
diff --git a/sheep/group.c b/sheep/group.c
index c281b65..8ebb3e6 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -57,7 +57,7 @@ static size_t get_join_message_size(struct join_message *jm)
static int get_zones_nr_from(struct sd_node *nodes, int nr_nodes)
{
int nr_zones = 0, i, j;
- uint32_t zones[SD_MAX_REDUNDANCY];
+ uint32_t zones[SD_MAX_COPIES];
for (i = 0; i < nr_nodes; i++) {
/*
diff --git a/sheep/ops.c b/sheep/ops.c
index 945ebff..5789ae5 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -234,7 +234,7 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
sys->nr_copies = hdr->copies;
sys->flags = hdr->flags;
if (!sys->nr_copies)
- sys->nr_copies = SD_DEFAULT_REDUNDANCY;
+ sys->nr_copies = SD_DEFAULT_COPIES;
created_time = hdr->ctime;
set_cluster_ctime(created_time);
--
1.7.10
More information about the sheepdog
mailing list