[sheepdog] [PATCH] collie: clean up error messages

Liu Yuan namei.unix at gmail.com
Mon Jul 22 11:40:18 CEST 2013


- don't duplicate error message in collie_exec_req
- print oid in vdi_check failure

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 collie/common.c |    5 +----
 collie/vdi.c    |    8 ++++----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/collie/common.c b/collie/common.c
index e8a6a54..b25c3b8 100644
--- a/collie/common.c
+++ b/collie/common.c
@@ -202,11 +202,8 @@ int collie_exec_req(const char *host, int port, struct sd_req *hdr, void *data)
 	struct sd_rsp *rsp = (struct sd_rsp *)hdr;
 
 	fd = connect_to(host, port);
-	if (fd < 0) {
-		fprintf(stderr, "Failed to connect to %s:%d\n",
-			host, port);
+	if (fd < 0)
 		return -1;
-	}
 
 	/*
 	 * Retry forever for collie because
diff --git a/collie/vdi.c b/collie/vdi.c
index 4dea240..62a73f9 100644
--- a/collie/vdi.c
+++ b/collie/vdi.c
@@ -1371,8 +1371,8 @@ static void *read_object_from(const struct sd_vnode *vnode, uint64_t oid)
 		free(buf);
 		return NULL;
 	default:
-		fprintf(stderr, "FATAL: failed to read, %s\n",
-			sd_strerror(rsp->result));
+		fprintf(stderr, "FATAL: failed to read %"PRIx64", %s\n",
+			oid, sd_strerror(rsp->result));
 		exit(EXIT_FAILURE);
 	}
 	return buf;
@@ -1402,8 +1402,8 @@ static void write_object_to(const struct sd_vnode *vnode, uint64_t oid,
 		exit(EXIT_SYSFAIL);
 
 	if (rsp->result != SD_RES_SUCCESS) {
-		fprintf(stderr, "FATAL: failed to write, %s\n",
-			sd_strerror(rsp->result));
+		fprintf(stderr, "FATAL: failed to write %"PRIx64", %s\n",
+			oid, sd_strerror(rsp->result));
 		exit(EXIT_FAILURE);
 	}
 }
-- 
1.7.9.5




More information about the sheepdog mailing list