Signed-off-by: Chris Webb <chris at arachsys.com> --- lib/event.c | 4 ++-- lib/logger.c | 15 +++++++-------- lib/net.c | 2 +- sheep/cluster/corosync.c | 27 +++++++++++++-------------- sheep/group.c | 40 ++++++++++++++++++++-------------------- sheep/journal.c | 14 +++++++------- sheep/sdnet.c | 28 ++++++++++++++-------------- sheep/sheep.c | 4 ++-- sheep/store.c | 36 ++++++++++++++++++------------------ sheep/vdi.c | 14 ++++++++------ 10 files changed, 92 insertions(+), 92 deletions(-) diff --git a/lib/event.c b/lib/event.c index 89e8f2a..8a69dc4 100644 --- a/lib/event.c +++ b/lib/event.c @@ -75,7 +75,7 @@ int init_event(int nr) { efd = epoll_create(nr); if (efd < 0) { - eprintf("can't create epoll fd\n"); + eprintf("failed to create epoll fd\n"); return -1; } return 0; @@ -146,7 +146,7 @@ int modify_event(int fd, unsigned int events) ei = lookup_event(fd); if (!ei) { - eprintf("can't find event info %d\n", fd); + eprintf("event info for fd %d not found\n", fd); return 1; } diff --git a/lib/logger.c b/lib/logger.c index 75147c0..99c68ee 100644 --- a/lib/logger.c +++ b/lib/logger.c @@ -54,7 +54,7 @@ static int logarea_init (int size) { int shmid; - logdbg(stderr,"enter logarea_init\n"); + logdbg(stderr, "entering logarea_init\n"); if ((shmid = shmget(IPC_PRIVATE, sizeof(struct logarea), 0644 | IPC_CREAT | IPC_EXCL)) == -1) { @@ -210,7 +210,7 @@ static int log_enqueue(int prio, const char *func, int line, const char *fmt, /* not enough space on head : drop msg */ if (la->head > la->tail && (len + sizeof(struct logmsg)) > ((char *)la->head - (char *)la->tail)) { - logdbg(stderr, "enqueue: log area overrun, drop msg\n"); + logdbg(stderr, "enqueue: log area overrun, dropping message\n"); if (!la->empty) la->tail = lastmsg; @@ -354,7 +354,7 @@ static void log_flush(void) static void log_sigsegv(void) { - vprintf(SDOG_ERR, "sheep logger exits abnormally, pid:%d\n", getpid()); + vprintf(SDOG_ERR, "logger pid %d exiting abnormally\n", getpid()); log_flush(); closelog(); free_logarea(); @@ -365,7 +365,7 @@ int log_init(char *program_name, int size, int is_daemon, int level, char *outfi { log_level = level; - logdbg(stderr,"enter log_init\n"); + logdbg(stderr, "entering log_init\n"); log_name = program_name; semkey = random(); @@ -396,11 +396,10 @@ int log_init(char *program_name, int size, int is_daemon, int level, char *outfi la->fd = fd; pid = fork(); if (pid < 0) { - syslog(LOG_ERR, "fail to fork the logger\n"); + syslog(LOG_ERR, "failed to fork the logger process: %m\n"); return 1; } else if (pid) { - syslog(LOG_WARNING, - "Target daemon logger with pid=%d started!\n", pid); + syslog(LOG_WARNING, "logger pid %d starting\n", pid); return 0; } @@ -444,7 +443,7 @@ void log_close(void) la->active = 0; waitpid(pid, NULL, 0); - vprintf(SDOG_WARNING, "sheep logger stopped, pid:%d\n", pid); + vprintf(SDOG_WARNING, "logger pid %d stopped\n", pid); log_flush(); closelog(); free_logarea(); diff --git a/lib/net.c b/lib/net.c index da11564..d4a5d9b 100644 --- a/lib/net.c +++ b/lib/net.c @@ -178,7 +178,7 @@ int create_listen_ports(int port, int (*callback)(int fd, void *), void *data) freeaddrinfo(res0); if (!success) - eprintf("can't create a listen fd\n"); + eprintf("failed to create a listening port\n"); return !success; } diff --git a/sheep/cluster/corosync.c b/sheep/cluster/corosync.c index 9ac408e..58e289c 100644 --- a/sheep/cluster/corosync.c +++ b/sheep/cluster/corosync.c @@ -142,12 +142,12 @@ static int nodeid_to_addr(uint32_t nodeid, uint8_t *addr) ret = corosync_cfg_get_node_addrs(cfg_handle, nodeid, 1, &nr, &caddr); if (ret != CS_OK) { - vprintf(SDOG_ERR, "failed to get addr %d\n", ret); + vprintf(SDOG_ERR, "failed to get node addresses (%d)\n", ret); return -1; } if (!nr) { - vprintf(SDOG_ERR, "we got no address\n"); + vprintf(SDOG_ERR, "no node addresses found\n"); return -1; } @@ -197,11 +197,11 @@ retry: case CPG_OK: break; case CPG_ERR_TRY_AGAIN: - dprintf("failed to send message. try again\n"); + dprintf("failed to send message: retrying\n"); sleep(1); goto retry; default: - eprintf("failed to send message, %d\n", ret); + eprintf("failed to send message (%d)\n", ret); return -1; } return 0; @@ -296,7 +296,7 @@ static int __corosync_dispatch_one(struct corosync_event *cevent) cevent->msg, cevent->msg_len); if (res == CJ_RES_MASTER_TRANSFER) { - eprintf("Restart me later when master is up, please. Bye.\n"); + eprintf("failed to join sheepdog cluster: please retry when master is up\n"); exit(1); } @@ -584,20 +584,19 @@ static int corosync_init(struct cdrv_handlers *handlers, uint8_t *myaddr) ret = cpg_initialize(&cpg_handle, &cb); if (ret != CPG_OK) { - eprintf("Failed to initialize cpg, %d\n", ret); - eprintf("Is corosync running?\n"); + eprintf("failed to initialize cpg (%d) - is corosync running?\n", ret); return -1; } ret = corosync_cfg_initialize(&cfg_handle, NULL); if (ret != CS_OK) { - vprintf(SDOG_ERR, "failed to initiazize cfg %d\n", ret); + vprintf(SDOG_ERR, "failed to initialize cfg (%d)\n", ret); return -1; } ret = corosync_cfg_local_get(cfg_handle, &nodeid); if (ret != CS_OK) { - vprintf(SDOG_ERR, "failed to get nodeid %d\n", ret); + vprintf(SDOG_ERR, "failed to get node id (%d)\n", ret); return -1; } @@ -612,7 +611,7 @@ static int corosync_init(struct cdrv_handlers *handlers, uint8_t *myaddr) ret = cpg_fd_get(cpg_handle, &fd); if (ret != CPG_OK) { - eprintf("Failed to retrieve cpg file descriptor, %d\n", ret); + eprintf("failed to get cpg file descriptor (%d)\n", ret); return -1; } @@ -636,14 +635,14 @@ retry: case CPG_OK: break; case CPG_ERR_TRY_AGAIN: - dprintf("Failed to join the sheepdog group, try again\n"); + dprintf("failed to join the sheepdog group: retrying\n"); sleep(1); goto retry; case CPG_ERR_SECURITY: - eprintf("Permission error.\n"); + eprintf("permission denied to join the sheepdog group\n"); return -1; default: - eprintf("Failed to join the sheepdog group, %d\n", ret); + eprintf("failed to join the sheepdog group (%d)\n", ret); return -1; } @@ -661,7 +660,7 @@ static int corosync_leave(void) ret = cpg_leave(cpg_handle, &cpg_group); if (ret != CPG_OK) { - eprintf("failed to leave the sheepdog group\n, %d", ret); + eprintf("failed to leave the sheepdog group (%d)\n", ret); return -1; } diff --git a/sheep/group.c b/sheep/group.c index 3328550..cc367ab 100644 --- a/sheep/group.c +++ b/sheep/group.c @@ -250,7 +250,7 @@ static void group_handler(int listen_fd, int events, void *data) { int ret; if (events & EPOLLHUP) { - eprintf("Receive EPOLLHUP event. Is corosync stopped running?\n"); + eprintf("received EPOLLHUP event: has corosync exited?\n"); goto out; } @@ -258,7 +258,7 @@ static void group_handler(int listen_fd, int events, void *data) if (ret == 0) return; else - eprintf("oops...some error occured inside corosync\n"); + eprintf("oops... an error occurred inside corosync\n"); out: log_close(); exit(1); @@ -320,7 +320,7 @@ static int cluster_sanity_check(struct sheepdog_node_list_entry *entries, if (sys_stat_wait_format() || sys_stat_shutdown()) goto out; - /* When the joinning node is newly created, we need to check nothing. */ + /* When the joining node is newly created, we need not check anything. */ if (nr_entries == 0) goto out; @@ -393,7 +393,7 @@ static int get_cluster_status(struct sheepdog_node_list_entry *from, if (nr != nr_local_entries) { nr_leave_entries = get_nodes_nr_from(&sys->leave_list); if (nr_local_entries == nr + nr_leave_entries) { - /* Even though some nodes leave, we can make do with it. + /* Even though some nodes have left, we can make do without them. * Order cluster to do recovery right now. */ if (inc_epoch) @@ -434,7 +434,7 @@ out: static void join(struct sheepdog_node_list_entry *joining, struct join_message *msg) { if (msg->proto_ver != SD_SHEEP_PROTO_VER) { - eprintf("joining node send a wrong version message\n"); + eprintf("joining node sent a message with the wrong protocol version\n"); msg->result = SD_RES_VER_MISMATCH; return; } @@ -468,7 +468,7 @@ static int get_vdi_bitmap_from(struct sheepdog_node_list_entry *node) goto out; } - vprintf(SDOG_ERR, "get the vdi bitmap from %s\n", host); + vprintf(SDOG_ERR, "getting the vdi bitmap from %s\n", host); memset(&hdr, 0, sizeof(hdr)); hdr.opcode = SD_OP_READ_VDIS; @@ -483,7 +483,7 @@ static int get_vdi_bitmap_from(struct sheepdog_node_list_entry *node) close(fd); if (ret || rsp->result != SD_RES_SUCCESS) { - vprintf(SDOG_ERR, "can't get the vdi bitmap %d %d\n", ret, + vprintf(SDOG_ERR, "unable to get the vdi bitmap (%d, %d)\n", ret, rsp->result); goto out; } @@ -624,7 +624,7 @@ static void sd_notify_handler(struct sheepdog_node_list_entry *sender, cevent = &w->cev; cevent->ctype = CPG_EVENT_NOTIFY; - vprintf(SDOG_DEBUG, "allow new deliver, %p\n", cevent); + vprintf(SDOG_DEBUG, "allow new deliver %p\n", cevent); w->sender = *sender; if (msg_len) { @@ -670,12 +670,12 @@ static int check_majority(struct sheepdog_node_list_entry *nodes, int nr_nodes) close(fd); nr_reachable++; if (nr_reachable >= nr_majority) { - dprintf("majority nodes are alive\n"); + dprintf("the majority of nodes are alive\n"); return 1; } } dprintf("%d, %d, %d\n", nr_nodes, nr_majority, nr_reachable); - eprintf("majority nodes are not alive\n"); + eprintf("the majority of nodes are not alive\n"); return 0; } @@ -701,7 +701,7 @@ static void __sd_leave(struct cpg_event *cevent) struct work_leave *w = container_of(cevent, struct work_leave, cev); if (!check_majority(w->member_list, w->member_list_entries)) { - eprintf("perhaps network partition failure has occurred\n"); + eprintf("perhaps a network partition has occurred?\n"); abort(); } } @@ -754,7 +754,7 @@ static enum cluster_join_result sd_check_join_cb( } else if (jm->result != SD_RES_SUCCESS && jm->epoch > sys->epoch && jm->cluster_status == SD_STATUS_WAIT_FOR_JOIN) { - eprintf("Transfer mastership. %d, %d\n", jm->epoch, sys->epoch); + eprintf("transfer mastership (%d, %d)\n", jm->epoch, sys->epoch); return CJ_RES_MASTER_TRANSFER; } jm->epoch = sys->epoch; @@ -949,11 +949,11 @@ static int check_epoch(struct request *req) if (before(req_epoch, sys->epoch)) { ret = SD_RES_OLD_NODE_VER; - eprintf("old node version %u %u, %x\n", + eprintf("old node version %u, %u, %x\n", sys->epoch, req_epoch, opcode); } else if (after(req_epoch, sys->epoch)) { ret = SD_RES_NEW_NODE_VER; - eprintf("new node version %u %u %x\n", + eprintf("new node version %u, %u, %x\n", sys->epoch, req_epoch, opcode); } return ret; @@ -1149,11 +1149,11 @@ static void sd_join_handler(struct sheepdog_node_list_entry *joined, if (node_cmp(joined, &sys->this_node) == 0) { if (result == CJ_RES_FAIL) { - eprintf("failed to join sheepdog\n"); + eprintf("failed to join sheepdog cluster\n"); sys->cdrv->leave(); exit(1); } else if (result == CJ_RES_JOIN_LATER) { - eprintf("Restart me later when master is up, please .Bye.\n"); + eprintf("failed to join sheepdog cluster: please retry when master is up\n"); sys->cdrv->leave(); exit(1); } @@ -1175,7 +1175,7 @@ static void sd_join_handler(struct sheepdog_node_list_entry *joined, cevent = &w->cev; cevent->ctype = CPG_EVENT_JOIN; - vprintf(SDOG_DEBUG, "allow new confchg, %p\n", cevent); + vprintf(SDOG_DEBUG, "allow new confchg %p\n", cevent); size = sizeof(struct sheepdog_node_list_entry) * nr_members; w->member_list = zalloc(size); @@ -1280,7 +1280,7 @@ static void sd_leave_handler(struct sheepdog_node_list_entry *left, int i, size; if (node_cmp(left, &sys->this_node) == 0) - panic("Network Patition Bug: I should have exited.\n"); + panic("network partition bug: this sheep should have exited\n"); dprintf("leave %s\n", node_to_str(left)); for (i = 0; i < nr_members; i++) @@ -1297,7 +1297,7 @@ static void sd_leave_handler(struct sheepdog_node_list_entry *left, cevent->ctype = CPG_EVENT_LEAVE; - vprintf(SDOG_DEBUG, "allow new confchg, %p\n", cevent); + vprintf(SDOG_DEBUG, "allow new confchg %p\n", cevent); size = sizeof(struct sheepdog_node_list_entry) * nr_members; w->member_list = zalloc(size); @@ -1371,7 +1371,7 @@ int create_cluster(int port, int64_t zone) ret = register_event(fd, group_handler, NULL); if (ret) { - eprintf("Failed to register epoll events, %d\n", ret); + eprintf("failed to register epoll events (%d)\n", ret); return 1; } diff --git a/sheep/journal.c b/sheep/journal.c index 4368f1b..d24f13b 100644 --- a/sheep/journal.c +++ b/sheep/journal.c @@ -260,12 +260,12 @@ int jrnl_recover(const char *jrnl_dir) struct dirent *d; char jrnl_file_path[PATH_MAX]; - eprintf("Openning the directory %s.\n", jrnl_dir); + eprintf("opening the directory %s\n", jrnl_dir); dir = opendir(jrnl_dir); if (!dir) return -1; - vprintf(SDOG_NOTICE, "start jrnl_recovery.\n"); + vprintf(SDOG_NOTICE, "starting journal recovery\n"); while ((d = readdir(dir))) { int ret; struct jrnl_descriptor jd; @@ -277,7 +277,7 @@ int jrnl_recover(const char *jrnl_dir) jrnl_dir, d->d_name); ret = jrnl_open(&jd, jrnl_file_path); if (ret) { - eprintf("Unable to open the journal file, %s, for reading.\n", + eprintf("unable to open the journal file %s for reading\n", jrnl_file_path); goto end_while_3; } @@ -285,13 +285,13 @@ int jrnl_recover(const char *jrnl_dir) goto end_while_2; jd.target_fd = open(jd.head.target_path, O_SYNC | O_RDWR); if (ret) { - eprintf("Unable to open the object file, %s, to recover.\n", + eprintf("unable to open the object file %s for recovery\n", jd.head.target_path); goto end_while_2; } ret = jrnl_apply_to_target_object(&jd); if (ret) - eprintf("Unable to recover the object, %s.\n", + eprintf("unable to recover the object %s\n", jd.head.target_path); close(jd.target_fd); @@ -299,12 +299,12 @@ int jrnl_recover(const char *jrnl_dir) end_while_2: jrnl_close(&jd); end_while_3: - vprintf(SDOG_INFO, "recovered the object in journal, %s\n", + vprintf(SDOG_INFO, "recovered the object %s from the journal\n", jrnl_file_path); jrnl_remove(&jd); } closedir(dir); - vprintf(SDOG_NOTICE, "end jrnl_recovery.\n"); + vprintf(SDOG_NOTICE, "journal recovery complete\n"); return 0; } diff --git a/sheep/sdnet.c b/sheep/sdnet.c index e14cf0c..fac623c 100644 --- a/sheep/sdnet.c +++ b/sheep/sdnet.c @@ -141,7 +141,7 @@ static void __done(struct work *work, int idx) eprintf("failed to allocate memory\n"); goto done; } - dprintf("allocate a new object map\n"); + dprintf("allocating a new object map\n"); bmap->vdi_id = vdi_id; list_add_tail(&bmap->list, &sys->consistent_obj_list); set_bit(data_oid_to_idx(obj_hdr->oid), bmap->dobjs); @@ -155,7 +155,7 @@ static void __done(struct work *work, int idx) } else if (is_access_local(req->entry, req->nr_vnodes, ((struct sd_obj_req *)&req->rq)->oid, copies) && req->rp.result == SD_RES_EIO) { - eprintf("leave from cluster\n"); + eprintf("leaving sheepdog cluster\n"); leave_cluster(); if (req->rq.flags & SD_FLAG_CMD_IO_LOCAL) @@ -188,7 +188,7 @@ static void queue_request(struct request *req) req->op = get_sd_op(hdr->opcode); if (!req->op) { - eprintf("invalid opcode, %d\n", hdr->opcode); + eprintf("invalid opcode %d\n", hdr->opcode); rsp->result = SD_RES_INVALID_PARMS; req->done(req); return; @@ -323,7 +323,7 @@ static void client_rx_handler(struct client_info *ci) struct request *req; if (!ci->rx_req && sys->outstanding_data_size > MAX_OUTSTANDING_DATA_SIZE) { - dprintf("too many requests, %p\n", &ci->conn); + dprintf("too many requests (%p)\n", &ci->conn); conn_rx_off(&ci->conn); list_add(&ci->conn.blocking_siblings, &sys->blocking_conn_list); return; @@ -359,7 +359,7 @@ static void client_rx_handler(struct client_info *ci) ret = rx(conn, C_IO_END); break; default: - eprintf("BUG: unknown state %d\n", conn->c_rx_state); + eprintf("bug: unknown state %d\n", conn->c_rx_state); } if (is_conn_dead(conn) && ci->rx_req) { @@ -424,7 +424,7 @@ again: if (sys->outstanding_data_size < MAX_OUTSTANDING_DATA_SIZE) { list_for_each_entry_safe(conn, n, &sys->blocking_conn_list, blocking_siblings) { - dprintf("rx on, %p\n", conn); + dprintf("rx on %p\n", conn); list_del(&conn->blocking_siblings); conn_rx_on(conn); } @@ -524,7 +524,7 @@ static void client_handler(int fd, int events, void *data) if (!(ci->conn.events & EPOLLIN)) list_del(&ci->conn.blocking_siblings); - dprintf("closed a connection, %d\n", fd); + dprintf("closed connection %d\n", fd); unregister_event(fd); client_decref(ci); } @@ -538,7 +538,7 @@ static void listen_handler(int listen_fd, int events, void *data) struct client_info *ci; if (sys->status == SD_STATUS_SHUTDOWN) { - dprintf("unregister %d\n", listen_fd); + dprintf("unregistering connection %d\n", listen_fd); unregister_event(listen_fd); return; } @@ -574,7 +574,7 @@ static void listen_handler(int listen_fd, int events, void *data) return; } - dprintf("accepted a new connection, %d\n", fd); + dprintf("accepted a new connection: %d\n", fd); } static int create_listen_port_fn(int fd, void *data) @@ -620,7 +620,7 @@ int write_object(struct sheepdog_vnode_list_entry *e, fd = connect_to(name, e[n].port); if (fd < 0) { - eprintf("can't connect to vost %s\n", name); + eprintf("failed to connect to host %s\n", name); return -1; } @@ -642,7 +642,7 @@ int write_object(struct sheepdog_vnode_list_entry *e, ret = exec_req(fd, (struct sd_req *)&hdr, data, &wlen, &rlen); close(fd); if (ret) { - eprintf("can't update vost %s\n", name); + eprintf("failed to update host %s\n", name); return -1; } } @@ -785,8 +785,8 @@ int get_sheep_fd(uint8_t *addr, uint16_t port, int node_idx, } if (before(epoch, cached_epoch)) { - eprintf("requested epoch is smaller than the previous one, %d %d\n", - cached_epoch, epoch); + eprintf("requested epoch is smaller than the previous one: %d < %d\n", + epoch, cached_epoch); return -1; } if (after(epoch, cached_epoch)) { @@ -805,7 +805,7 @@ int get_sheep_fd(uint8_t *addr, uint16_t port, int node_idx, dprintf("%d, %d\n", epoch, fd); if (cached_epoch == epoch && fd >= 0) { - dprintf("use a cached fd %d\n", fd); + dprintf("using the cached fd %d\n", fd); return fd; } diff --git a/sheep/sheep.c b/sheep/sheep.c index 920495a..971d22c 100644 --- a/sheep/sheep.c +++ b/sheep/sheep.c @@ -207,11 +207,11 @@ int main(int argc, char **argv) ret = create_cluster(port, zone); if (ret) { - eprintf("failed to create sheepdog cluster.\n"); + eprintf("failed to create sheepdog cluster\n"); exit(1); } - vprintf(SDOG_NOTICE, "Sheepdog daemon (version %s) started\n", PACKAGE_VERSION); + vprintf(SDOG_NOTICE, "sheepdog daemon (version %s) started\n", PACKAGE_VERSION); while (sys->status != SD_STATUS_SHUTDOWN || sys->nr_outstanding_reqs != 0) event_loop(-1); diff --git a/sheep/store.c b/sheep/store.c index c25949c..e21030a 100644 --- a/sheep/store.c +++ b/sheep/store.c @@ -479,7 +479,7 @@ int update_epoch_log(int epoch) time_t t; char path[PATH_MAX]; - dprintf("update epoch, %d, %d\n", epoch, sys->nr_nodes); + dprintf("update epoch: %d, %d\n", epoch, sys->nr_nodes); snprintf(path, sizeof(path), "%s%08u", epoch_path, epoch); fd = open(path, O_RDWR | O_CREAT | O_SYNC, def_fmode); @@ -604,7 +604,7 @@ static int store_queue_request_local(struct request *req, uint32_t epoch) break; if (!hdr->copies) { - eprintf("zero copies is invalid\n"); + eprintf("the number of copies cannot be zero\n"); ret = SD_RES_INVALID_PARMS; goto out; } @@ -782,7 +782,7 @@ static int fix_object_consistency(struct request *req, int idx) hdr->flags = 0; ret = forward_read_obj_req(req, idx); if (ret != SD_RES_SUCCESS) { - eprintf("failed to read object, %d\n", ret); + eprintf("failed to read object %d\n", ret); goto out; } @@ -791,7 +791,7 @@ static int fix_object_consistency(struct request *req, int idx) hdr->oid = oid; ret = forward_write_obj_req(req, idx); if (ret != SD_RES_SUCCESS) { - eprintf("failed to write object, %d\n", ret); + eprintf("failed to write object %d\n", ret); goto out; } out: @@ -843,7 +843,7 @@ void store_queue_request(struct work *work, int idx) ret = store_queue_request_local(req, epoch); out: if (ret != SD_RES_SUCCESS) - dprintf("failed, %"PRIu32", %x, %" PRIx64" , %u, %"PRIu32"\n", + dprintf("failed: %"PRIu32", %x, %" PRIx64" , %u, %"PRIu32"\n", idx, opcode, oid, epoch, ret); rsp->result = ret; @@ -1249,13 +1249,13 @@ static int __recover_one(struct recovery_work *rw, memcpy(old_entry, _old_entry, sizeof(*old_entry) * old_nr); memcpy(cur_entry, _cur_entry, sizeof(*cur_entry) * cur_nr); next: - dprintf("recover obj %"PRIx64" from epoch %"PRIu32"\n", oid, tgt_epoch); + dprintf("recover object %"PRIx64" from epoch %"PRIu32"\n", oid, tgt_epoch); old_idx = obj_to_sheep(old_entry, old_nr, oid, 0); tgt_idx = find_tgt_node(old_entry, old_nr, old_idx, old_copies, cur_entry, cur_nr, cur_idx, cur_copies, copy_idx); if (tgt_idx < 0) { - eprintf("cannot find target node, %"PRIx64"\n", oid); + eprintf("cannot find target node %"PRIx64"\n", oid); goto err; } e = old_entry + tgt_idx; @@ -1274,7 +1274,7 @@ next: if (errno == ENOENT) { next_nr = epoch_log_read(tgt_epoch - 1, buf, buf_len); if (next_nr <= 0) { - eprintf("no previous epoch, %"PRIu32"\n", tgt_epoch - 1); + eprintf("no previous epoch: %"PRIu32"\n", tgt_epoch - 1); goto err; } next_nr /= sizeof(struct sheepdog_node_list_entry); @@ -1285,7 +1285,7 @@ next: goto not_found; } - eprintf("cannot recover from local, %s, %s\n", old, new); + eprintf("cannot recover from local %s to %s\n", old, new); goto err; } @@ -1358,7 +1358,7 @@ next: if (rsp->result == SD_RES_NEW_NODE_VER || rsp->result == SD_RES_OLD_NODE_VER || rsp->result == SD_RES_NETWORK_ERROR) { - eprintf("try again, %"PRIu32", %"PRIx64"\n", rsp->result, oid); + eprintf("retrying: %"PRIu32", %"PRIx64"\n", rsp->result, oid); rw->retry = 1; goto out; } @@ -1452,7 +1452,7 @@ static void recover_one(struct work *work, int idx) } } if (copy_idx < 0) { - eprintf("shouldn't happen\n"); + eprintf("bug: copy_idx < 0\n"); goto out; } @@ -1609,7 +1609,7 @@ static void recover_done(struct work *work, int idx) return; } - dprintf("recovery done, %"PRIu32"\n", rw->epoch); + dprintf("recovery complete: new epoch %"PRIu32"\n", rw->epoch); recovering_work = NULL; sys->recovered_epoch = rw->epoch; @@ -1664,7 +1664,7 @@ static int __fill_obj_list(struct sheepdog_node_list_entry *e, uint32_t epoch, rsp = (struct sd_list_rsp *)&hdr; if (ret || rsp->result != SD_RES_SUCCESS) { - eprintf("try again, %"PRIu32", %"PRIu32"\n", ret, rsp->result); + eprintf("retrying: %"PRIu32", %"PRIu32"\n", ret, rsp->result); return -1; } @@ -1741,7 +1741,7 @@ static int fill_obj_list(struct recovery_work *rw, eprintf("some objects may be lost\n"); continue; } else { - dprintf("retry get object list\n"); + dprintf("trying to get object list again\n"); sleep(1); goto retry; } @@ -1773,7 +1773,7 @@ static void __start_recovery(struct work *work, int idx) rw->cur_nr_nodes = epoch_log_read(epoch, (char *)rw->cur_nodes, sizeof(rw->cur_nodes)); if (rw->cur_nr_nodes <= 0) { - eprintf("failed to read epoch log, %"PRIu32"\n", epoch); + eprintf("failed to read epoch log for epoch %"PRIu32"\n", epoch); goto fail; } rw->cur_nr_nodes /= sizeof(struct sheepdog_node_list_entry); @@ -1781,7 +1781,7 @@ static void __start_recovery(struct work *work, int idx) rw->old_nr_nodes = epoch_log_read(epoch - 1, (char *)rw->old_nodes, sizeof(rw->old_nodes)); if (rw->old_nr_nodes <= 0) { - eprintf("failed to read epoch log, %"PRIu32"\n", epoch - 1); + eprintf("failed to read epoch log for epoch %"PRIu32"\n", epoch - 1); goto fail; } rw->old_nr_nodes /= sizeof(struct sheepdog_node_list_entry); @@ -1909,7 +1909,7 @@ static int init_epoch_path(const char *base_path) for (epoch = 1; epoch <= latest_epoch; epoch++) { snprintf(path, sizeof(path), "%s/%08u", obj_path, epoch); - vprintf(SDOG_INFO, "found the obj dir, %s\n", path); + vprintf(SDOG_INFO, "found the object directory %s\n", path); dir = opendir(path); if (!dir) { @@ -1930,7 +1930,7 @@ static int init_epoch_path(const char *base_path) if (!is_vdi_obj(oid)) continue; - vprintf(SDOG_DEBUG, "found the vdi obj, %" PRIx64 "\n", oid); + vprintf(SDOG_DEBUG, "found the vdi object %" PRIx64 "\n", oid); set_bit(oid_to_vid(oid), sys->vdi_inuse); } diff --git a/sheep/vdi.c b/sheep/vdi.c index aeea7d6..5c3ac9a 100644 --- a/sheep/vdi.c +++ b/sheep/vdi.c @@ -231,7 +231,7 @@ static int do_lookup_vdi(uint32_t epoch, char *name, int namelen, uint32_t *vid, start_nr = fnv_64a_buf(name, namelen, FNV1A_64_INIT) & (SD_NR_VDIS - 1); - vprintf(SDOG_INFO, "looking for %s %d, %lx\n", name, namelen, start_nr); + vprintf(SDOG_INFO, "looking for %s (%lx)\n", name, start_nr); /* bitmap search from the hash point */ nr = find_next_zero_bit(sys->vdi_inuse, SD_NR_VDIS, start_nr); @@ -296,7 +296,7 @@ int add_vdi(uint32_t epoch, char *data, int data_len, uint64_t size, if (is_snapshot) { if (ret != SD_RES_SUCCESS) { if (ret == SD_RES_NO_VDI) - vprintf(SDOG_CRIT, "we dont's have %s\n", name); + vprintf(SDOG_CRIT, "vdi %s does not exist\n", name); return ret; } nr = right_nr; @@ -318,12 +318,14 @@ int add_vdi(uint32_t epoch, char *data, int data_len, uint64_t size, *new_vid = nr; - vprintf(SDOG_INFO, "we create a new vdi, %d %s (%zd) %" PRIu64 ", vid: %" - PRIx32 ", base %" PRIx32 ", cur %" PRIx32 " \n", - is_snapshot, name, strlen(name), size, *new_vid, base_vid, cur_vid); + vprintf(SDOG_INFO, "creating new %s %s: size %" PRIu64 ", vid %" + PRIx32 ", base %" PRIx32 ", cur %" PRIx32 "\n", + is_snapshot ? "snapshot" : "vdi", name, size, *new_vid, + base_vid, cur_vid); if (!copies) { - vprintf(SDOG_WARNING, "qemu doesn't specify the copies... %d\n", + vprintf(SDOG_WARNING, + "using default replication level of %d copies\n", sys->nr_sobjs); copies = sys->nr_sobjs; } -- 1.7.5.4 |