Commit 1b6cdf89 authored by Rob Latham's avatar Rob Latham

use new bake_perror routine

parent b9cfb4cf
...@@ -143,16 +143,16 @@ void write_op_exec_write(void* u, buffer_u buf, size_t len, uint64_t offset) ...@@ -143,16 +143,16 @@ void write_op_exec_write(void* u, buffer_u buf, size_t len, uint64_t offset)
if(len > SMALL_REGION_THRESHOLD) { if(len > SMALL_REGION_THRESHOLD) {
ret = bake_create(bake_ph, bti, len, &rid); ret = bake_create(bake_ph, bti, len, &rid);
if(ret != 0) { if(ret != 0) {
ERROR fprintf(stderr,"bake_create returned %d\n",ret); ERROR bake_perror("bake_create",ret);
return; return;
} }
ret = bake_proxy_write(bake_ph, rid, 0, remote_bulk, buf.as_offset, remote_addr_str, len); ret = bake_proxy_write(bake_ph, rid, 0, remote_bulk, buf.as_offset, remote_addr_str, len);
if(ret != 0) { if(ret != 0) {
ERROR fprintf(stderr, "bake_proxy_write returned %d\n", ret); ERROR bake_perror( "bake_proxy_write", ret);
} }
ret = bake_persist(bake_ph, rid, offset, len); ret = bake_persist(bake_ph, rid, offset, len);
if(ret != 0) { if(ret != 0) {
ERROR fprintf(stderr, "bake_persist returned %d\n", ret); ERROR bake_perror("bake_persist", ret);
} }
insert_region_log_entry(sdskv_ph, seg_db_id, oid, offset, len, &rid); insert_region_log_entry(sdskv_ph, seg_db_id, oid, offset, len, &rid);
...@@ -215,19 +215,19 @@ void write_op_exec_writesame(void* u, buffer_u buf, size_t data_len, size_t writ ...@@ -215,19 +215,19 @@ void write_op_exec_writesame(void* u, buffer_u buf, size_t data_len, size_t writ
ret = bake_create(bph, bti, data_len, &rid); ret = bake_create(bph, bti, data_len, &rid);
if(ret != 0) { if(ret != 0) {
ERROR fprintf(stderr, "bake_create returned %d\n", ret); ERROR bake_perror("bake_create", ret);
LEAVING; LEAVING;
return; return;
} }
ret = bake_proxy_write(bph, rid, 0, remote_bulk, buf.as_offset, remote_addr_str, data_len); ret = bake_proxy_write(bph, rid, 0, remote_bulk, buf.as_offset, remote_addr_str, data_len);
if(ret != 0) { if(ret != 0) {
ERROR fprintf(stderr, "bake_proxy_write returned %d\n", ret); ERROR bake_perror("bake_proxy_write", ret);
LEAVING; LEAVING;
return; return;
} }
ret = bake_persist(bph, rid, offset, data_len); ret = bake_persist(bph, rid, offset, data_len);
if(ret != 0) { if(ret != 0) {
ERROR fprintf(stderr, "bake_persist returned %d\n", ret); ERROR bake_perror("bake_persist", ret);
LEAVING; LEAVING;
return; return;
} }
...@@ -299,8 +299,11 @@ void write_op_exec_append(void* u, buffer_u buf, size_t len) ...@@ -299,8 +299,11 @@ void write_op_exec_append(void* u, buffer_u buf, size_t len)
bake_region_id_t rid; bake_region_id_t rid;
ret = bake_create(bph, bti, len, &rid); ret = bake_create(bph, bti, len, &rid);
if (ret != 0) bake_perror("bake_create", ret);
ret = bake_proxy_write(bph, rid, 0, remote_bulk, buf.as_offset, remote_addr_str, len); ret = bake_proxy_write(bph, rid, 0, remote_bulk, buf.as_offset, remote_addr_str, len);
if (ret != 0) bake_perror("bake_proxy_write", ret);
ret = bake_persist(bph, rid, offset, len); ret = bake_persist(bph, rid, offset, len);
if (ret != 0) bake_perror("bake_persist", ret);
insert_region_log_entry(sdskv_ph, seg_db_id, oid, offset, len, &rid, ts); insert_region_log_entry(sdskv_ph, seg_db_id, oid, offset, len, &rid, ts);
...@@ -406,8 +409,8 @@ void write_op_exec_remove(void* u) ...@@ -406,8 +409,8 @@ void write_op_exec_remove(void* u)
ret = bake_remove(bake_ph, region); ret = bake_remove(bake_ph, region);
if (ret != BAKE_SUCCESS) { if (ret != BAKE_SUCCESS) {
/* XXX should save the error and keep removing */ /* XXX should save the error and keep removing */
ERROR fprintf(stderr, "write_op_exec_remove: " ERROR bake_perror("write_op_exec_remove: "
"error in bake_remove() (ret = %d)\n", ret); "error in bake_remove()", ret);
LEAVING; LEAVING;
return; return;
} }
......
...@@ -84,21 +84,26 @@ int main(int argc, char *argv[]) ...@@ -84,21 +84,26 @@ int main(int argc, char *argv[])
if(-1 == access(bake_target_name, F_OK)) { if(-1 == access(bake_target_name, F_OK)) {
// XXX creating a pool of 10MB - this should come from a config file // XXX creating a pool of 10MB - this should come from a config file
ret = bake_makepool(bake_target_name, 10*1024*1024, 0664); ret = bake_makepool(bake_target_name, 10*1024*1024, 0664);
if (ret != 0) bake_perror("bake_makepool", ret);
ASSERT(ret == 0, "bake_makepool() failed (ret = %d)\n", ret); ASSERT(ret == 0, "bake_makepool() failed (ret = %d)\n", ret);
} }
bake_provider_t bake_prov; bake_provider_t bake_prov;
bake_target_id_t bake_tid; bake_target_id_t bake_tid;
ret = bake_provider_register(mid, bake_mplex_id, BAKE_ABT_POOL_DEFAULT, &bake_prov); ret = bake_provider_register(mid, bake_mplex_id, BAKE_ABT_POOL_DEFAULT, &bake_prov);
if (ret != 0) bake_perror("bake_provider_register", ret);
ASSERT(ret == 0, "bake_provider_register() failed (ret = %d)\n", ret); ASSERT(ret == 0, "bake_provider_register() failed (ret = %d)\n", ret);
ret = bake_provider_add_storage_target(bake_prov, bake_target_name, &bake_tid); ret = bake_provider_add_storage_target(bake_prov, bake_target_name, &bake_tid);
if (ret != 0) bake_perror("bake_provider_add_storage_target", ret);
ASSERT(ret == 0, "bake_provider_add_storage_target() failed to add target %s (ret = %d)\n", ASSERT(ret == 0, "bake_provider_add_storage_target() failed to add target %s (ret = %d)\n",
bake_target_name, ret); bake_target_name, ret);
/* Bake provider handle initialization from self addr */ /* Bake provider handle initialization from self addr */
bake_client_data bake_clt_data; bake_client_data bake_clt_data;
ret = bake_client_init(mid, &(bake_clt_data.client)); ret = bake_client_init(mid, &(bake_clt_data.client));
if (ret != 0) bake_perror("bake_client_init", ret);
ASSERT(ret == 0, "bake_client_init() failed (ret = %d)\n", ret); ASSERT(ret == 0, "bake_client_init() failed (ret = %d)\n", ret);
ret = bake_provider_handle_create(bake_clt_data.client, self_addr, bake_mplex_id, &(bake_clt_data.provider_handle)); ret = bake_provider_handle_create(bake_clt_data.client, self_addr, bake_mplex_id, &(bake_clt_data.provider_handle));
if (ret != 0) bake_perror("bake_provider_handle_create", ret);
ASSERT(ret == 0, "bake_provider_handle_create() failed (ret = %d)\n", ret); ASSERT(ret == 0, "bake_provider_handle_create() failed (ret = %d)\n", ret);
margo_push_finalize_callback(mid, &finalize_bake_client_cb, (void*)&bake_clt_data); margo_push_finalize_callback(mid, &finalize_bake_client_cb, (void*)&bake_clt_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment