nr_sobjs is an extremly confusing name for the number of copies in the cluster, so let's rename it. Signed-off-by: Christoph Hellwig --- sheep/group.c | 20 ++++++++++---------- sheep/object_cache.c | 2 +- sheep/ops.c | 25 +++++++++++++------------ sheep/sheep_priv.h | 2 +- sheep/store.c | 8 ++++---- sheep/vdi.c | 4 ++-- 6 files changed, 31 insertions(+), 30 deletions(-) Index: sheepdog/sheep/group.c =================================================================== --- sheepdog.orig/sheep/group.c 2012-04-27 15:33:47.916055550 +0200 +++ sheepdog/sheep/group.c 2012-04-27 15:38:42.184063083 +0200 @@ -41,7 +41,7 @@ struct vnode_info { struct join_message { uint8_t proto_ver; - uint8_t nr_sobjs; + uint8_t nr_copies; uint16_t nr_nodes; uint16_t nr_leave_nodes; uint16_t cluster_flags; @@ -184,8 +184,8 @@ static int update_vnode_info(void) int get_nr_copies(struct vnode_info *vnode_info) { int nr_copies = vnode_info->nr_zones; - if (nr_copies < sys->nr_sobjs) - nr_copies = sys->nr_sobjs; + if (nr_copies < sys->nr_copies) + nr_copies = sys->nr_copies; return nr_copies; } @@ -441,7 +441,7 @@ static void join(struct sd_node *joining msg->result = get_cluster_status(joining, msg->nodes, msg->nr_nodes, msg->ctime, msg->epoch, &msg->cluster_status, &msg->inc_epoch); - msg->nr_sobjs = sys->nr_sobjs; + msg->nr_copies = sys->nr_copies; msg->cluster_flags = sys->flags; msg->ctime = get_cluster_ctime(); if (sd_store) @@ -521,7 +521,7 @@ static void update_cluster_info(struct j if (sys->join_finished) goto join_finished; - sys->nr_sobjs = msg->nr_sobjs; + sys->nr_copies = msg->nr_copies; sys->epoch = msg->epoch; /* add nodes execept for newly joined one */ @@ -582,7 +582,7 @@ join_finished: } /* Fresh node */ if (!sys_stat_ok() && !sys_stat_halt()) { - set_cluster_copies(sys->nr_sobjs); + set_cluster_copies(sys->nr_copies); set_cluster_flags(sys->flags); set_cluster_ctime(msg->ctime); } @@ -787,7 +787,7 @@ static int send_join_request(struct sd_n panic("failed to allocate memory\n"); msg->proto_ver = SD_SHEEP_PROTO_VER; - get_cluster_copies(&msg->nr_sobjs); + get_cluster_copies(&msg->nr_copies); get_cluster_flags(&msg->cluster_flags); nr_entries = SD_MAX_NODES; @@ -822,7 +822,7 @@ static void __sd_join_done(struct event_ } if (sys_stat_halt()) { - if (current_vnode_info->nr_zones >= sys->nr_sobjs) + if (current_vnode_info->nr_zones >= sys->nr_copies) sys_stat_set(SD_STATUS_OK); } @@ -852,7 +852,7 @@ static void __sd_leave_done(struct event start_recovery(sys->epoch); if (sys_can_halt()) { - if (current_vnode_info->nr_zones < sys->nr_sobjs) + if (current_vnode_info->nr_zones < sys->nr_copies) sys_stat_set(SD_STATUS_HALT); } } @@ -1018,7 +1018,7 @@ static void process_request_queue(void) list_del(&cevent->event_list); if (is_io_op(req->op)) { - int copies = sys->nr_sobjs; + int copies = sys->nr_copies; if (copies > req->vnodes->nr_zones) copies = req->vnodes->nr_zones; Index: sheepdog/sheep/object_cache.c =================================================================== --- sheepdog.orig/sheep/object_cache.c 2012-04-27 15:33:47.916055550 +0200 +++ sheepdog/sheep/object_cache.c 2012-04-27 15:38:42.184063083 +0200 @@ -499,7 +499,7 @@ static int push_cache_object(uint32_t vi hdr->opcode = create ? SD_OP_CREATE_AND_WRITE_OBJ : SD_OP_WRITE_OBJ; hdr->flags = SD_FLAG_CMD_WRITE; hdr->oid = oid; - hdr->copies = sys->nr_sobjs; + hdr->copies = sys->nr_copies; hdr->epoch = sys->epoch; fake_req.data = buf; fake_req.op = get_sd_op(hdr->opcode); Index: sheepdog/sheep/ops.c =================================================================== --- sheepdog.orig/sheep/ops.c 2012-04-27 11:02:03.928135198 +0200 +++ sheepdog/sheep/ops.c 2012-04-27 15:38:42.188063084 +0200 @@ -59,7 +59,7 @@ static int cluster_new_vdi(const struct { const struct sd_vdi_req *hdr = (const struct sd_vdi_req *)req; struct sd_vdi_rsp *vdi_rsp = (struct sd_vdi_rsp *)rsp; - uint32_t vid = 0, nr_copies = sys->nr_sobjs; + uint32_t vid = 0, nr_copies = sys->nr_copies; int ret; ret = add_vdi(hdr->epoch, data, hdr->data_length, hdr->vdi_size, &vid, @@ -90,7 +90,7 @@ static int cluster_del_vdi(const struct { const struct sd_vdi_req *hdr = (const struct sd_vdi_req *)req; struct sd_vdi_rsp *vdi_rsp = (struct sd_vdi_rsp *)rsp; - uint32_t vid = 0, nr_copies = sys->nr_sobjs; + uint32_t vid = 0, nr_copies = sys->nr_copies; int ret; ret = del_vdi(hdr->epoch, data, hdr->data_length, &vid, @@ -109,7 +109,7 @@ static int cluster_get_vdi_info(const st { const struct sd_vdi_req *hdr = (const struct sd_vdi_req *)req; struct sd_vdi_rsp *vdi_rsp = (struct sd_vdi_rsp *)rsp; - uint32_t vid = 0, nr_copies = sys->nr_sobjs; + uint32_t vid = 0, nr_copies = sys->nr_copies; void *tag; int ret; @@ -150,10 +150,10 @@ static int cluster_make_fs(const struct iocb.epoch = latest_epoch; sd_store->format(&iocb); sd_store->init(obj_path); - sys->nr_sobjs = hdr->copies; + sys->nr_copies = hdr->copies; sys->flags = hdr->flags; - if (!sys->nr_sobjs) - sys->nr_sobjs = SD_DEFAULT_REDUNDANCY; + if (!sys->nr_copies) + sys->nr_copies = SD_DEFAULT_REDUNDANCY; ctime = hdr->ctime; set_cluster_ctime(ctime); @@ -172,7 +172,7 @@ static int cluster_make_fs(const struct update_epoch_store(sys->epoch); - set_cluster_copies(sys->nr_sobjs); + set_cluster_copies(sys->nr_copies); set_cluster_flags(sys->flags); if (sys_flag_nohalt()) @@ -180,7 +180,7 @@ static int cluster_make_fs(const struct else { int nr_zones = get_zones_nr_from(sys->nodes, sys->nr_nodes); - if (nr_zones >= sys->nr_sobjs) + if (nr_zones >= sys->nr_copies) sys_stat_set(SD_STATUS_OK); else sys_stat_set(SD_STATUS_HALT); @@ -202,7 +202,7 @@ static int cluster_get_vdi_attr(const st { const struct sd_vdi_req *hdr = (const struct sd_vdi_req *)req; struct sd_vdi_rsp *vdi_rsp = (struct sd_vdi_rsp *)rsp; - uint32_t vid = 0, attrid = 0, nr_copies = sys->nr_sobjs; + uint32_t vid = 0, attrid = 0, nr_copies = sys->nr_copies; uint64_t ctime = 0; int ret; struct sheepdog_vdi_attr *vattr; @@ -403,17 +403,18 @@ static int cluster_manual_recover(const if (ret) goto out; - sys->nr_sobjs = c; + sys->nr_copies = c; sys->flags = f; s = SD_STATUS_OK; if (!sys_flag_nohalt()) { nr_zones = get_zones_nr_from(sys->nodes, sys->nr_nodes); - if (nr_zones < sys->nr_sobjs) + if (nr_zones < sys->nr_copies) s = SD_STATUS_HALT; } - dprintf("flags %d, nr_zones %d, copies %d\n", sys->flags, nr_zones, sys->nr_sobjs); + dprintf("flags %d, nr_zones %d, copies %d\n", sys->flags, nr_zones, + sys->nr_copies); sys->epoch++; /* some nodes are left, so we get a new epoch */ ret = update_epoch_log(sys->epoch); Index: sheepdog/sheep/sheep_priv.h =================================================================== --- sheepdog.orig/sheep/sheep_priv.h 2012-04-27 15:33:47.920055548 +0200 +++ sheepdog/sheep/sheep_priv.h 2012-04-27 15:38:42.188063084 +0200 @@ -136,7 +136,7 @@ struct cluster_info { struct list_head consistent_obj_list; struct list_head blocking_conn_list; - uint32_t nr_sobjs; + uint32_t nr_copies; struct list_head request_queue; struct list_head event_queue; Index: sheepdog/sheep/store.c =================================================================== --- sheepdog.orig/sheep/store.c 2012-04-27 15:33:47.916055550 +0200 +++ sheepdog/sheep/store.c 2012-04-27 15:38:42.188063084 +0200 @@ -636,7 +636,7 @@ int store_read_obj(const struct sd_req * goto out; rsps->data_length = hdr->data_length; - rsps->copies = sys->nr_sobjs; + rsps->copies = sys->nr_copies; out: sd_store->close(hdr->oid, &iocb); return ret; @@ -1147,7 +1147,7 @@ int get_max_copies(struct sd_node *entri zones[nr_zones++] = entries[i].zone; } - return min(sys->nr_sobjs, nr_zones); + return min(sys->nr_copies, nr_zones); } /* @@ -1517,7 +1517,7 @@ static void recover_object(struct work * int i, copy_idx, copy_nr, ret; struct siocb iocb = { 0 }; - if (!sys->nr_sobjs) + if (!sys->nr_copies) return; eprintf("done:%"PRIu32" count:%"PRIu32", oid:%"PRIx64"\n", rw->done, rw->count, oid); @@ -1897,7 +1897,7 @@ static void do_recovery_work(struct work dprintf("%u\n", rw->epoch); - if (!sys->nr_sobjs) + if (!sys->nr_copies) return; if (rw->cur_nr_nodes == 0) Index: sheepdog/sheep/vdi.c =================================================================== --- sheepdog.orig/sheep/vdi.c 2012-04-27 15:38:25.124062648 +0200 +++ sheepdog/sheep/vdi.c 2012-04-27 15:38:42.188063084 +0200 @@ -323,8 +323,8 @@ int add_vdi(uint32_t epoch, char *data, if (!copies) { vprintf(SDOG_WARNING, "using default replication level of %d copies\n", - sys->nr_sobjs); - copies = sys->nr_sobjs; + sys->nr_copies); + copies = sys->nr_copies; } ret = create_vdi_obj(epoch, name, *new_vid, size, base_vid, cur_vid, copies,