Skip to content

Commit

Permalink
sheep: remove SD_MAX{DEFAULT}_REDUNDANCY use SD_MAX{DEFAULT}_COPIES i…
Browse files Browse the repository at this point in the history
…nstead

Signed-off-by: levin li <xingke.lwp@taobao.com>
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
  • Loading branch information
levin108 authored and liuy committed Aug 5, 2012
1 parent a8627f6 commit 68b9fd5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions collie/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions include/internal_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/sheep.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,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);

Expand Down
6 changes: 3 additions & 3 deletions sheep/gateway.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand All @@ -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;
};

Expand Down Expand Up @@ -202,7 +202,7 @@ static int wait_forward_request(struct write_info *wi, struct sd_rsp *rsp)
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;
}
Expand Down
2 changes: 1 addition & 1 deletion sheep/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
/*
Expand Down
2 changes: 1 addition & 1 deletion sheep/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 68b9fd5

Please sign in to comment.