diff options
-rw-r--r-- | examples/Makefile.am | 2 | ||||
-rw-r--r-- | examples/Makefile.in | 2 | ||||
-rw-r--r-- | examples/test_client.c | 24 | ||||
-rw-r--r-- | src/H5EQ.c | 34 | ||||
-rw-r--r-- | src/H5EQpublic.h | 3 | ||||
-rw-r--r-- | src/H5FF.c | 6 | ||||
-rw-r--r-- | src/H5G.c | 3 | ||||
-rw-r--r-- | src/H5VLiod.c | 559 | ||||
-rw-r--r-- | src/H5VLiod_client.c | 303 | ||||
-rw-r--r-- | src/H5VLiod_client.h | 31 | ||||
-rw-r--r-- | src/H5VLiod_common.h | 87 | ||||
-rw-r--r-- | src/H5VLiod_encdec.c | 10 | ||||
-rw-r--r-- | src/H5VLiod_server.c | 1779 | ||||
-rw-r--r-- | src/H5VLiod_server.h | 221 |
14 files changed, 1968 insertions, 1096 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index 290e89f..128bd4f 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -30,7 +30,7 @@ endif if BUILD_EFF_CONDITIONAL INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test LDADD = $(LIBH5TEST) $(LIBHDF5) $(MYAXE_LIBS) $(MYIOD_LIBS) $(MYMERCURY_LIBS) - EXAMPLE_PROG_EFF = test_server test_client + EXAMPLE_PROG_EFF = test_server test_client test_client_old_api endif # Example programs. diff --git a/examples/Makefile.in b/examples/Makefile.in index 246926b..54acaed 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -392,7 +392,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog $(EXTLINK_DIRS) *.h5 @BUILD_EFF_CONDITIONAL_TRUE@LDADD = $(LIBH5TEST) $(LIBHDF5) $(MYAXE_LIBS) $(MYIOD_LIBS) $(MYMERCURY_LIBS) @BUILD_PARALLEL_CONDITIONAL_TRUE@LDADD = $(LIBH5TEST) $(LIBHDF5) @BUILD_PARALLEL_CONDITIONAL_TRUE@EXAMPLE_PROG_PARA = ph5example -@BUILD_EFF_CONDITIONAL_TRUE@EXAMPLE_PROG_EFF = test_server test_client +@BUILD_EFF_CONDITIONAL_TRUE@EXAMPLE_PROG_EFF = test_server test_client test_client_old_api # Example programs. # Don't tell automake about them, because if it knew they were programs, diff --git a/examples/test_client.c b/examples/test_client.c index 8a0e35c..fe7625a 100644 --- a/examples/test_client.c +++ b/examples/test_client.c @@ -14,7 +14,7 @@ int main(int argc, char **argv) {
const char file_name[]="eff_file.h5";
hid_t file_id;
- hid_t gid1, gid2;
+ hid_t gid1, gid2, gid3;
hid_t dataspaceId;
hid_t did1, did2, did3;
hid_t aid1, aid2, aid3;
@@ -82,22 +82,24 @@ int main(int argc, char **argv) { /* create the file. This is asynchronous. */
file_id = H5Fcreate_ff(file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id, event_q);
+ {
+ char temp_name[50];
+ H5Fget_name(file_id, temp_name, 50);
+ fprintf(stderr, "File name %s %s\n", temp_name, file_name);
+ }
+
/* create a group G1 on the file. We creat it here synchronously just to
show that we can intermix the original HDF5 API with the new
Async API.
Internally there is a built in wait on the file_id, which has already been
completed when we called H5AOwait on the file create request earlier*/
gid1 = H5Gcreate2(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate_ff(file_id, "G1/G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, 0, event_q);
+ gid3 = H5Gcreate_ff(file_id, "G1/G2/G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, 0, event_q);
- /* this comment block shows how we could create G1 asynchronously and wait
- *
- * gid1 = H5Gcreate_ff(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT,
- * 0, &req2);
- *
- * assert(H5AOwait(&req2, &status2) == 0);
- * assert (status2);
- */
assert(gid1);
+ assert(gid2);
+ assert(gid3);
/* Create a datatype and commit it to the file. This is asynchronous.
* Other Local H5T type operations can be issued before completing this call
@@ -283,6 +285,8 @@ int main(int argc, char **argv) { assert(H5Tclose_ff(int_id, event_q) == 0);
assert(H5Gclose_ff(gid1, event_q) == 0);
+ assert(H5Gclose_ff(gid2, event_q) == 0);
+ assert(H5Gclose_ff(gid3, event_q) == 0);
/* flush all the contents of file to disk. This is asynchronous. */
assert(H5Fflush_ff(file_id, H5F_SCOPE_GLOBAL, event_q) == 0);
@@ -302,7 +306,7 @@ int main(int argc, char **argv) { assert(H5Fclose_ff(file_id, event_q) == 0);
H5EQwait(event_q, &num_requests, &status);
- fprintf(stderr, "%d requests in event queue. Expecting 15. Completions: ", num_requests);
+ fprintf(stderr, "%d requests in event queue. Expecting 19. Completions: ", num_requests);
for(i=0 ; i<num_requests; i++)
fprintf(stderr, "%d ",status[i]);
fprintf(stderr, "\n");
@@ -391,6 +391,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5AOcancel + * + * Purpose: Cancel an asynchronous operation + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * May, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AOcancel(H5_request_t req, H5_status_t *status) +{ + H5_priv_request_t *request = (H5_priv_request_t *)req; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(H5VL_request_cancel(&request->req, request->vol_plugin, status) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to cancel request"); + + request->req = NULL; + request->vol_plugin = NULL; + request->next = NULL; + request = (H5_priv_request_t *)H5MM_xfree(request); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5AOcancel() */ + + +/*------------------------------------------------------------------------- * Function: H5AOtest * * Purpose: Test for an asynchronous operation's completion diff --git a/src/H5EQpublic.h b/src/H5EQpublic.h index 0bf5cf3..2992d4e 100644 --- a/src/H5EQpublic.h +++ b/src/H5EQpublic.h @@ -47,7 +47,7 @@ typedef enum { H5AO_PENDING, /* Operation has not yet completed */ H5AO_SUCCEEDED, /* Operation has completed, successfully */ H5AO_FAILED, /* Operation has completed, but failed */ - H5AO_CANCELLED /* Operation has no completed and has been cancelled */ + H5AO_CANCELLED /* Operation has not completed and has been cancelled */ } H5_status_t; #define H5_REQUEST_NULL NULL @@ -66,6 +66,7 @@ H5_DLL herr_t H5EQtest(hid_t event_q, int *num_remaining); H5_DLL herr_t H5EQclose(hid_t event_q); /* Asynchronous test & wait operations */ +H5_DLL herr_t H5AOcancel(H5_request_t req, H5_status_t *status); H5_DLL herr_t H5AOtest(H5_request_t req, H5_status_t *status); H5_DLL herr_t H5AOwait(H5_request_t req, H5_status_t *status); @@ -27,6 +27,7 @@ /****************/ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5G_PACKAGE /*suppress error about including H5Gpkg */ #define H5T_PACKAGE /*suppress error about including H5Tpkg */ /* Interface initialization */ @@ -39,6 +40,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FFprivate.h" /* FastForward wrappers */ +#include "H5Gpkg.h" /* Group access */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ @@ -362,7 +364,7 @@ H5Gcreate_ff(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* get the file object */ + /* get the location object */ if(NULL == (obj = (void *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* get the plugin pointer */ @@ -376,7 +378,7 @@ H5Gcreate_ff(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t /* Get an atom for the group */ if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize group handle") done: if (ret_value < 0 && grp) @@ -325,7 +325,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, gcpl_id, gapl_id, H5AC_dxpl_id, H5_EVENT_QUEUE_NULL))) + if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, gcpl_id, gapl_id, + H5AC_dxpl_id, H5_EVENT_QUEUE_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") /* Get an atom for the group */ diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 52c0feb..57d93af 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -63,6 +63,7 @@ static hg_id_t H5VL_DSET_CLOSE_ID; static hg_id_t H5VL_DTYPE_COMMIT_ID; static hg_id_t H5VL_DTYPE_OPEN_ID; static hg_id_t H5VL_DTYPE_CLOSE_ID; +static hg_id_t H5VL_CANCEL_OP_ID; /* Prototypes */ static void *H5VL_iod_fapl_copy(const void *_old_fa); @@ -132,6 +133,7 @@ static herr_t H5VL_iod_object_misc(void *obj, H5VL_loc_params_t loc_params, H5VL static herr_t H5VL_iod_object_optional(void *obj, H5VL_loc_params_t loc_params, H5VL_object_optional_t optional_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_iod_object_close(void *obj, H5VL_loc_params_t loc_params, hid_t dxpl_id, void **req); +static herr_t H5VL_iod_cancel(void **req, H5_status_t *status); static herr_t H5VL_iod_test(void **req, H5_status_t *status); static herr_t H5VL_iod_wait(void **req, H5_status_t *status); @@ -150,6 +152,7 @@ H5FL_DEFINE(H5VL_iod_dtype_t); static na_addr_t PEER; uint32_t write_checksum; static na_class_t *network_class = NULL; + static uint64_t axe_id; static uint64_t axe_bound; @@ -217,7 +220,7 @@ static H5VL_class_t H5VL_iod_g = { NULL//H5VL_iod_object_close /* close */ }, { - NULL, + H5VL_iod_cancel, H5VL_iod_test, H5VL_iod_wait } @@ -301,7 +304,7 @@ EFF_init(MPI_Comm comm, MPI_Info info) MPI_Comm_rank(comm, &my_rank); axe_seed = (pow(2,64) - 1) / num_procs; - axe_id = axe_seed * my_rank; + axe_id = axe_seed * my_rank + 1; axe_bound = axe_seed * (my_rank + 1); if ((config = fopen("port.cfg", "r")) != NULL) { @@ -353,11 +356,56 @@ EFF_init(MPI_Comm comm, MPI_Info info) H5VL_DTYPE_OPEN_ID = MERCURY_REGISTER("dtype_open", dtype_open_in_t, dtype_open_out_t); H5VL_DTYPE_CLOSE_ID = MERCURY_REGISTER("dtype_close", dtype_close_in_t, ret_t); + H5VL_CANCEL_OP_ID = MERCURY_REGISTER("cancel_op", uint64_t, uint8_t); + /* forward the init call to the IONs */ if(HG_Forward(PEER, H5VL_EFF_INIT_ID, &num_procs, &ret_value, &hg_req) < 0) return FAIL; HG_Wait(hg_req, HG_MAX_IDLE_TIME, HG_STATUS_IGNORE); + +#if 0 + { + int i; + uint64_t id; + + for(i=0; i<10; i++) { + H5VL_iod_gen_obj_id(my_rank, num_procs, i, IOD_OBJ_KV, &id); + fprintf(stderr,"%d ID %d = %llu\n", my_rank, i, id); + while (id) { + if (id & 1) + fprintf(stderr,"1"); + else + fprintf(stderr,"0"); + + id >>= 1; + } + fprintf(stderr,"\n"); + H5VL_iod_gen_obj_id(my_rank, num_procs, i, IOD_OBJ_BLOB, &id); + fprintf(stderr,"%d ID %d = %llu\n", my_rank, i, id); + while (id) { + if (id & 1) + fprintf(stderr,"1"); + else + fprintf(stderr,"0"); + + id >>= 1; + } + fprintf(stderr,"\n"); + H5VL_iod_gen_obj_id(my_rank, num_procs, i, IOD_OBJ_ARRAY, &id); + fprintf(stderr,"%d ID %d = %llu\n", my_rank, i, id); + while (id) { + if (id & 1) + fprintf(stderr,"1"); + else + fprintf(stderr,"0"); + + id >>= 1; + } + fprintf(stderr,"\n"); + } + } +#endif return ret_value; } /* end EFF_init() */ @@ -614,6 +662,14 @@ H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl /* allocate the file object that is returned to the user */ if(NULL == (file = H5FL_CALLOC(H5VL_iod_file_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate IOD file struct"); + file->remote_file.root_oh.cookie = IOD_OH_UNDEFINED; + file->remote_file.root_id = IOD_ID_UNDEFINED; + MPI_Comm_rank(fa->comm, &file->my_rank); + MPI_Comm_size(fa->comm, &file->num_procs); + + /* Generate an IOD ID for the root group to be created */ + H5VL_iod_gen_obj_id(file->my_rank, file->num_procs, 0, IOD_OBJ_KV, &input.root_id); + file->remote_file.root_id = input.root_id; /* set the input structure for the HG encode routine */ input.name = name; @@ -630,6 +686,11 @@ H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl else hg_req = &_hg_req; +#if H5VL_IOD_DEBUG + printf("File Create %s IOD ROOT ID %llu, axe id %llu\n", + name, input.root_id, input.axe_id); +#endif + /* forward the call to the ION */ if(HG_Forward(PEER, H5VL_FILE_CREATE_ID, &input, &file->remote_file, hg_req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to ship file create"); @@ -667,6 +728,7 @@ H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl request->data = file; request->req = hg_req; request->obj = file; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(file, request); @@ -753,11 +815,17 @@ H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_i else hg_req = &_hg_req; +#if H5VL_IOD_DEBUG + printf("File Open %s axe id %llu\n", name, input.axe_id); +#endif + /* forward the call to the server */ if(HG_Forward(PEER, H5VL_FILE_OPEN_ID, &input, &file->remote_file, hg_req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to ship file create"); /* create the file object that is passed to the API layer */ + MPI_Comm_rank(fa->comm, &file->my_rank); + MPI_Comm_size(fa->comm, &file->num_procs); file->file_name = HDstrdup(name); file->flags = flags; if((file->fapl_id = H5Pcopy(fapl_id)) < 0) @@ -788,6 +856,7 @@ H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_i request->data = file; request->req = hg_req; request->obj = file; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(file, request); @@ -851,10 +920,6 @@ H5VL_iod_file_flush(void *_obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, FUNC_ENTER_NOAPI_NOINIT - /* wait for all pending requests before closing the file */ - if(H5VL_iod_request_wait_all(file) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG requests"); - /* set the input structure for the HG encode routine */ input.coh = file->remote_file.coh; input.scope = scope; @@ -889,6 +954,7 @@ H5VL_iod_file_flush(void *_obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, request->data = status; request->req = hg_req; request->obj = file; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(file, request); @@ -906,7 +972,7 @@ H5VL_iod_file_flush(void *_obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, else { /* Synchronously wait on the request */ if(H5VL_iod_request_wait(file, request) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't wait on HG request"); + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't wait on HG request"); /* Sanity check */ HDassert(request == &_request); } /* end else */ @@ -1148,10 +1214,6 @@ H5VL_iod_file_close(void *_file, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI_NOINIT - /* wait for all pending requests before closing the file */ - if(H5VL_iod_request_wait_all(file) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG requests"); - /* allocate an integer to receive the return value if the file close succeeded or not */ status = (int *)malloc(sizeof(int)); @@ -1166,10 +1228,12 @@ H5VL_iod_file_close(void *_file, hid_t dxpl_id, void **req) input.coh = file->remote_file.coh; input.root_oh = file->remote_file.root_oh; input.root_id = file->remote_file.root_id; - input.scratch_oh = file->remote_file.scratch_oh; - input.scratch_id = file->remote_file.scratch_id; input.axe_id = axe_id ++; +#if H5VL_IOD_DEBUG + printf("File Close Root ID %llu axe id %llu\n", input.root_id, input.axe_id); +#endif + /* forward the call to the ION */ if(HG_Forward(PEER, H5VL_FILE_CLOSE_ID, &input, status, hg_req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to ship file close"); @@ -1188,6 +1252,7 @@ H5VL_iod_file_close(void *_file, hid_t dxpl_id, void **req) request->data = status; request->req = hg_req; request->obj = file; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(file, request); @@ -1239,6 +1304,7 @@ H5VL_iod_group_create(void *_obj, H5VL_loc_params_t loc_params, const char *name hid_t lcpl_id; iod_obj_id_t iod_id; iod_handle_t iod_oh; + uint64_t parent_axe_id; char *new_name; /* resolved path to where we need to start traversal at the server */ hg_request_t _hg_req; /* Local function shipper request, for sync. operations */ hg_request_t *hg_req = NULL; @@ -1257,26 +1323,43 @@ H5VL_iod_group_create(void *_obj, H5VL_loc_params_t loc_params, const char *name if(H5P_get(plist, H5VL_GRP_LCPL_ID, &lcpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id"); - /* resolve the location where to create the group by fetching the iod id and object handle - for the last open group in the path hierarchy. This is where we will start the traversal - at the server side */ - if(H5VL_iod_local_traverse(obj, loc_params, name, &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + group should be created. */ + if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the group object that is returned to the user */ if(NULL == (grp = H5FL_CALLOC(H5VL_iod_group_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + grp->remote_group.iod_oh.cookie = IOD_OH_UNDEFINED; + grp->remote_group.iod_id = IOD_ID_UNDEFINED; + + /* Generate an IOD ID for the group to be created */ + H5VL_iod_gen_obj_id(obj->file->my_rank, obj->file->num_procs, + obj->file->remote_file.kv_oid_index, + IOD_OBJ_KV, &input.grp_id); + grp->remote_group.iod_id = input.grp_id; + + /* increment the index of KV objects created on the container */ + obj->file->remote_file.kv_oid_index ++; /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.name = new_name; input.gcpl_id = gcpl_id; input.gapl_id = gapl_id; input.lcpl_id = lcpl_id; input.axe_id = axe_id ++; +#if H5VL_IOD_DEBUG + printf("Group Create %s IOD ID %llu, axe id %llu, parent %llu\n", + name, input.grp_id, input.axe_id, input.parent_axe_id); +#endif + /* Get the group access plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); @@ -1326,6 +1409,7 @@ H5VL_iod_group_create(void *_obj, H5VL_loc_params_t loc_params, const char *name request->data = grp; request->req = hg_req; request->obj = grp; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -1382,6 +1466,7 @@ H5VL_iod_group_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, H5P_genplist_t *plist; iod_obj_id_t iod_id; iod_handle_t iod_oh; + uint64_t parent_axe_id; char *new_name; /* resolved path to where we need to start traversal at the server */ hg_request_t _hg_req; /* Local function shipper request, for sync. operations */ hg_request_t *hg_req = NULL; @@ -1393,20 +1478,24 @@ H5VL_iod_group_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, FUNC_ENTER_NOAPI_NOINIT - /* resolve the location where to open the group by fetching the iod id and object handle - for the last open group in the path hierarchy. This is where we will start the traversal - at the server side. */ - if(H5VL_iod_local_traverse(obj, loc_params, name, &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + group should be opened. */ + if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the group object that is returned to the user */ if(NULL == (grp = H5FL_CALLOC(H5VL_iod_group_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + grp->remote_group.iod_oh.cookie = IOD_OH_UNDEFINED; + grp->remote_group.iod_id = IOD_ID_UNDEFINED; + /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.name = new_name; input.gapl_id = gapl_id; input.axe_id = axe_id ++; @@ -1423,6 +1512,11 @@ H5VL_iod_group_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, else hg_req = &_hg_req; +#if H5VL_IOD_DEBUG + printf("Group Open %s LOC ID %llu, axe id %llu, parent %llu\n", + name, input.loc_id, input.axe_id, input.parent_axe_id); +#endif + /* forward the call to the IONs */ if(HG_Forward(PEER, H5VL_GROUP_OPEN_ID, &input, &grp->remote_group, hg_req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to ship group open"); @@ -1458,6 +1552,7 @@ H5VL_iod_group_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, request->data = grp; request->req = hg_req; request->obj = grp; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -1567,18 +1662,6 @@ H5VL_iod_group_close(void *_grp, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI_NOINIT - /* wait for the actual create or open operation on the group to complete */ - if(NULL != grp->common.request) { - if(H5VL_iod_request_wait(grp->common.file, grp->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - grp->common.request = NULL; - } - /* allocate an integer to receive the return value if the group close succeeded or not */ status = (int *)malloc(sizeof(int)); @@ -1590,12 +1673,22 @@ H5VL_iod_group_close(void *_grp, hid_t dxpl_id, void **req) else hg_req = &_hg_req; + /* set the parent axe id */ + if(grp->common.request) + input.parent_axe_id = grp->common.request->axe_id; + else { + input.parent_axe_id = 0; + } + input.iod_oh = grp->remote_group.iod_oh; input.iod_id = grp->remote_group.iod_id; - input.scratch_oh = grp->remote_group.scratch_oh; - input.scratch_id = grp->remote_group.scratch_id; input.axe_id = axe_id ++; +#if H5VL_IOD_DEBUG + printf("Group Close IOD ID %llu, axe id %llu\n", + input.iod_id, input.axe_id); +#endif + /* forward the call to the IONs */ if(HG_Forward(PEER, H5VL_GROUP_CLOSE_ID, &input, status, hg_req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to ship group close"); @@ -1614,6 +1707,7 @@ H5VL_iod_group_close(void *_grp, hid_t dxpl_id, void **req) request->data = status; request->req = hg_req; request->obj = grp; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(grp->common.file, request); @@ -1664,6 +1758,7 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t loc_params, const char *na H5P_genplist_t *plist; iod_obj_id_t iod_id; iod_handle_t iod_oh; + uint64_t parent_axe_id; char *new_name; /* resolved path to where we need to start traversal at the server */ hg_request_t _hg_req; /* Local function shipper request, for sync. operations */ hg_request_t *hg_req = NULL; @@ -1687,20 +1782,33 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t loc_params, const char *na if(H5P_get(plist, H5VL_DSET_LCPL_ID, &lcpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for lcpl id"); - /* resolve the location where to create the dataset by fetching the iod id and object handle - for the last open group in the path hierarchy. This is where we will start the traversal - at the server side */ - if(H5VL_iod_local_traverse(obj, loc_params, name, &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + dataset should be created. */ + if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the dataset object that is returned to the user */ if(NULL == (dset = H5FL_CALLOC(H5VL_iod_dset_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + dset->remote_dset.iod_oh.cookie = IOD_OH_UNDEFINED; + dset->remote_dset.iod_id = IOD_ID_UNDEFINED; + + /* Generate an IOD ID for the dset to be created */ + H5VL_iod_gen_obj_id(obj->file->my_rank, obj->file->num_procs, + obj->file->remote_file.array_oid_index, + IOD_OBJ_ARRAY, &input.dset_id); + dset->remote_dset.iod_id = input.dset_id; + + /* increment the index of ARRAY objects created on the container */ + obj->file->remote_file.array_oid_index ++; + /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.name = new_name; input.dcpl_id = dcpl_id; input.dapl_id = dapl_id; @@ -1717,6 +1825,11 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t loc_params, const char *na else hg_req = &_hg_req; +#if H5VL_IOD_DEBUG + printf("Dataset Create %s IOD ID %llu, axe id %llu, parent %llu\n", + name, input.dset_id, input.axe_id, input.parent_axe_id); +#endif + /* forward the call to the IONs */ if(HG_Forward(PEER, H5VL_DSET_CREATE_ID, &input, &dset->remote_dset, hg_req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to ship dataset create"); @@ -1759,6 +1872,7 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t loc_params, const char *na request->data = dset; request->req = hg_req; request->obj = dset; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -1815,6 +1929,7 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t loc_params, const char *name dset_open_in_t input; iod_obj_id_t iod_id; iod_handle_t iod_oh; + uint64_t parent_axe_id; char *new_name; /* resolved path to where we need to start traversal at the server */ hg_request_t _hg_req; /* Local function shipper request, for sync. operations */ hg_request_t *hg_req = NULL; @@ -1825,24 +1940,33 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t loc_params, const char *name FUNC_ENTER_NOAPI_NOINIT - /* resolve the location where to open the dataset by fetching the iod id and object handle - for the last open group in the path hierarchy. This is where we will start the traversal - at the server side. */ - if(H5VL_iod_local_traverse(obj, loc_params, name, &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + dataset should be opened. */ + if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the dataset object that is returned to the user */ if(NULL == (dset = H5FL_CALLOC(H5VL_iod_dset_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + dset->remote_dset.iod_oh.cookie = IOD_OH_UNDEFINED; + dset->remote_dset.iod_id = IOD_ID_UNDEFINED; + /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.name = new_name; input.dapl_id = dapl_id; input.axe_id = axe_id ++; +#if H5VL_IOD_DEBUG + printf("Dataset Open %s LOC ID %llu, axe id %llu, parent %llu\n", + name, input.loc_id, input.axe_id, input.parent_axe_id); +#endif + /* get a function shipper request */ if(do_async) { if(NULL == (hg_req = (hg_request_t *)H5MM_malloc(sizeof(hg_request_t)))) @@ -1886,6 +2010,7 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t loc_params, const char *name request->data = dset; request->req = hg_req; request->obj = dset; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -1951,6 +2076,7 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, char fake_char; size_t size; H5VL_iod_io_info_t *info; + uint64_t parent_axe_id; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ herr_t ret_value = SUCCEED; @@ -1984,16 +2110,11 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, if(!buf) buf = &fake_char; - /* wait for the dataset create or open to complete */ - if(NULL != dset->common.request && H5VL_IOD_PENDING == dset->common.request->state) { - if(H5VL_iod_request_wait(dset->common.file, dset->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - dset->common.request = NULL; + /* set the parent axe id */ + if(dset->common.request) + input.parent_axe_id = dset->common.request->axe_id; + else { + input.parent_axe_id = 0; } /* calculate the size of the buffer needed - MSC we are assuming everything is contiguous now */ @@ -2008,8 +2129,9 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't create Bulk Data Handle"); /* Fill input structure */ + input.coh = dset->common.file->remote_file.coh; input.iod_oh = dset->remote_dset.iod_oh; - input.scratch_oh = dset->remote_dset.scratch_oh; + input.iod_id = dset->remote_dset.iod_id; input.bulk_handle = *bulk_handle; input.checksum = 0; input.dxpl_id = dxpl_id; @@ -2055,6 +2177,7 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, request->obj = dset; request->status = 0; request->state = 0; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(dset->common.file, request); @@ -2111,6 +2234,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, int *status = NULL; size_t size; H5VL_iod_io_info_t *info; + uint64_t parent_axe_id; uint32_t cs; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ herr_t ret_value = SUCCEED; @@ -2145,15 +2269,11 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, if(!buf) buf = &fake_char; - if(NULL != dset->common.request && H5VL_IOD_PENDING == dset->common.request->state) { - if(H5VL_iod_request_wait(dset->common.file, dset->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - dset->common.request = NULL; + /* set the parent axe id */ + if(dset->common.request) + input.parent_axe_id = dset->common.request->axe_id; + else { + input.parent_axe_id = 0; } /* calculate the size of the buffer needed - MSC we are assuming everything is contiguous now */ @@ -2174,8 +2294,9 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't create Bulk Data Handle"); /* Fill input structure */ + input.coh = dset->common.file->remote_file.coh; input.iod_oh = dset->remote_dset.iod_oh; - input.scratch_oh = dset->remote_dset.scratch_oh; + input.iod_id = dset->remote_dset.iod_id; input.bulk_handle = *bulk_handle; input.checksum = cs; input.dxpl_id = dxpl_id; @@ -2218,6 +2339,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, request->data = info; request->req = hg_req; request->obj = dset; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(dset->common.file, request); @@ -2269,28 +2391,22 @@ H5VL_iod_dataset_set_extent(void *_dset, const hsize_t size[], hid_t dxpl_id, vo H5VL_iod_request_t *request = NULL; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ int *status = NULL; + uint64_t parent_axe_id; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - /* wait for the dataset create or open to complete */ - if(NULL != dset->common.request && H5VL_IOD_PENDING == dset->common.request->state) { - if(H5VL_iod_request_wait(dset->common.file, dset->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - dset->common.request = NULL; + /* set the parent axe id */ + if(dset->common.request) + input.parent_axe_id = dset->common.request->axe_id; + else { + input.parent_axe_id = 0; } - /* wait for pending I/O requests on the dataset */ - if(H5VL_iod_request_wait_some(dset->common.file, dset) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG requests"); - /* Fill input structure */ + input.coh = dset->common.file->remote_file.coh; input.iod_oh = dset->remote_dset.iod_oh; + input.iod_id = dset->remote_dset.iod_id; input.dims.rank = H5Sget_simple_extent_ndims(dset->remote_dset.space_id); input.dims.size = size; input.axe_id = axe_id ++; @@ -2323,6 +2439,7 @@ H5VL_iod_dataset_set_extent(void *_dset, const hsize_t size[], hid_t dxpl_id, vo request->data = status; request->req = hg_req; request->obj = dset; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(dset->common.file, request); @@ -2449,25 +2566,19 @@ H5VL_iod_dataset_close(void *_dset, hid_t dxpl_id, void **req) hg_request_t *hg_req = NULL; H5VL_iod_request_t _request; /* Local request, for sync. operations */ H5VL_iod_request_t *request = NULL; + uint64_t parent_axe_id; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - if(NULL != dset->common.request && H5VL_IOD_PENDING == dset->common.request->state) { - if(H5VL_iod_request_wait(dset->common.file, dset->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - dset->common.request = NULL; + /* set the parent axe id */ + if(dset->common.request) + input.parent_axe_id = dset->common.request->axe_id; + else { + input.parent_axe_id = 0; } - if(H5VL_iod_request_wait_some(dset->common.file, dset) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG requests"); - status = (int *)malloc(sizeof(int)); /* get a function shipper request */ @@ -2480,8 +2591,6 @@ H5VL_iod_dataset_close(void *_dset, hid_t dxpl_id, void **req) input.iod_oh = dset->remote_dset.iod_oh; input.iod_id = dset->remote_dset.iod_id; - input.scratch_oh = dset->remote_dset.scratch_oh; - input.scratch_id = dset->remote_dset.scratch_id; input.axe_id = axe_id ++; /* forward the call to the IONs */ @@ -2502,6 +2611,7 @@ H5VL_iod_dataset_close(void *_dset, hid_t dxpl_id, void **req) request->data = status; request->req = hg_req; request->obj = dset; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(dset->common.file, request); @@ -2558,25 +2668,39 @@ H5VL_iod_datatype_commit(void *_obj, H5VL_loc_params_t loc_params, const char *n hg_request_t *hg_req = NULL; H5VL_iod_request_t _request; /* Local request, for sync. operations */ H5VL_iod_request_t *request = NULL; + uint64_t parent_axe_id; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* resolve the location where to commit the datatype by fetching the iod id and object handle - for the last open group in the path hierarchy. This is where we will start the traversal - at the server side */ - if(H5VL_iod_local_traverse(obj, loc_params, name, &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + dtype should be created. */ + if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the datatype object that is returned to the user */ if(NULL == (dtype = H5FL_CALLOC(H5VL_iod_dtype_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + dtype->remote_dtype.iod_oh.cookie = IOD_OH_UNDEFINED; + dtype->remote_dtype.iod_id = IOD_ID_UNDEFINED; + + /* Generate an IOD ID for the group to be created */ + H5VL_iod_gen_obj_id(obj->file->my_rank, obj->file->num_procs, + obj->file->remote_file.blob_oid_index, + IOD_OBJ_BLOB, &input.dtype_id); + dtype->remote_dtype.iod_id = input.dtype_id; + + /* increment the index of KV objects created on the container */ + obj->file->remote_file.blob_oid_index ++; + /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.name = new_name; input.tcpl_id = tcpl_id; input.tapl_id = tapl_id; @@ -2592,6 +2716,11 @@ H5VL_iod_datatype_commit(void *_obj, H5VL_loc_params_t loc_params, const char *n else hg_req = &_hg_req; +#if H5VL_IOD_DEBUG + printf("Datatype Commit %s IOD ID %llu, axe id %llu, parent %llu\n", + name, input.dtype_id, input.axe_id, input.parent_axe_id); +#endif + /* forward the call to the IONs */ if(HG_Forward(PEER, H5VL_DTYPE_COMMIT_ID, &input, &dtype->remote_dtype, hg_req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to ship dataset create"); @@ -2632,6 +2761,7 @@ H5VL_iod_datatype_commit(void *_obj, H5VL_loc_params_t loc_params, const char *n request->data = dtype; request->req = hg_req; request->obj = dtype; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -2691,29 +2821,39 @@ H5VL_iod_datatype_open(void *_obj, H5VL_loc_params_t loc_params, const char *nam hg_request_t *hg_req = NULL; H5VL_iod_request_t _request; /* Local request, for sync. operations */ H5VL_iod_request_t *request = NULL; + uint64_t parent_axe_id; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* resolve the location where to open the datatype by fetching the iod id and object handle - for the last open group in the path hierarchy. This is where we will start the traversal - at the server side. */ - if(H5VL_iod_local_traverse(obj, loc_params, name, &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + dtype should be opened. */ + if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the datatype object that is returned to the user */ if(NULL == (dtype = H5FL_CALLOC(H5VL_iod_dtype_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + dtype->remote_dtype.iod_oh.cookie = IOD_OH_UNDEFINED; + dtype->remote_dtype.iod_id = IOD_ID_UNDEFINED; + /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.name = new_name; input.tapl_id = tapl_id; input.axe_id = axe_id ++; +#if H5VL_IOD_DEBUG + printf("Datatype Open %s LOC ID %llu, axe id %llu, parent %llu\n", + name, input.loc_id, input.axe_id, input.parent_axe_id); +#endif + /* get a function shipper request */ if(do_async) { if(NULL == (hg_req = (hg_request_t *)H5MM_malloc(sizeof(hg_request_t)))) @@ -2757,6 +2897,7 @@ H5VL_iod_datatype_open(void *_obj, H5VL_loc_params_t loc_params, const char *nam request->data = dtype; request->req = hg_req; request->obj = dtype; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -2846,25 +2987,19 @@ H5VL_iod_datatype_close(void *obj, hid_t dxpl_id, void **req) hg_request_t *hg_req = NULL; H5VL_iod_request_t _request; /* Local request, for sync. operations */ H5VL_iod_request_t *request = NULL; + uint64_t parent_axe_id; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - if(NULL != dtype->common.request && H5VL_IOD_PENDING == dtype->common.request->state) { - if(H5VL_iod_request_wait(dtype->common.file, dtype->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - dtype->common.request = NULL; + /* set the parent axe id */ + if(dtype->common.request) + input.parent_axe_id = dtype->common.request->axe_id; + else { + input.parent_axe_id = 0; } - if(H5VL_iod_request_wait_some(dtype->common.file, dtype) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG requests"); - status = (int *)malloc(sizeof(int)); /* get a function shipper request */ @@ -2877,8 +3012,6 @@ H5VL_iod_datatype_close(void *obj, hid_t dxpl_id, void **req) input.iod_oh = dtype->remote_dtype.iod_oh; input.iod_id = dtype->remote_dtype.iod_id; - input.scratch_oh = dtype->remote_dtype.scratch_oh; - input.scratch_id = dtype->remote_dtype.scratch_id; input.axe_id = axe_id ++; /* forward the call to the IONs */ @@ -2899,6 +3032,7 @@ H5VL_iod_datatype_close(void *obj, hid_t dxpl_id, void **req) request->data = status; request->req = hg_req; request->obj = dtype; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(dtype->common.file, request); @@ -2956,6 +3090,7 @@ H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char * H5VL_iod_request_t _request; /* Local request, for sync. operations */ H5VL_iod_request_t *request = NULL; hid_t type_id, space_id; + uint64_t parent_axe_id; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ void *ret_value = NULL; @@ -2971,21 +3106,33 @@ H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char * if(H5P_get(plist, H5VL_ATTR_SPACE_ID, &space_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for space id"); - /* resolve the location where to create the attribute by fetching - the iod id and object handle for the last open group in the - path hierarchy. This is where we will start the traversal at - the server side */ - if(H5VL_iod_local_traverse(obj, loc_params, ".", &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + attribute should be created. */ + if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the attribute object that is returned to the user */ if(NULL == (attr = H5FL_CALLOC(H5VL_iod_attr_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + attr->remote_attr.iod_oh.cookie = IOD_OH_UNDEFINED; + attr->remote_attr.iod_id = IOD_ID_UNDEFINED; + + /* Generate an IOD ID for the attr to be created */ + H5VL_iod_gen_obj_id(obj->file->my_rank, obj->file->num_procs, + obj->file->remote_file.array_oid_index, + IOD_OBJ_ARRAY, &input.attr_id); + attr->remote_attr.iod_id = input.attr_id; + + /* increment the index of ARRAY objects created on the container */ + obj->file->remote_file.array_oid_index ++; + /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.path = new_name; input.attr_name = attr_name; input.acpl_id = acpl_id; @@ -2993,6 +3140,11 @@ H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char * input.space_id = space_id; input.axe_id = axe_id ++; +#if H5VL_IOD_DEBUG + printf("Attribute Create %s IOD ID %llu, axe id %llu, parent %llu\n", + attr_name, input.attr_id, input.axe_id, input.parent_axe_id); +#endif + /* get a function shipper request */ if(do_async) { if(NULL == (hg_req = (hg_request_t *)H5MM_malloc(sizeof(hg_request_t)))) @@ -3052,6 +3204,7 @@ H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char * request->data = attr; request->req = hg_req; request->obj = attr; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -3114,29 +3267,39 @@ H5VL_iod_attribute_open(void *_obj, H5VL_loc_params_t loc_params, const char *at hg_request_t *hg_req = NULL; H5VL_iod_request_t _request; /* Local request, for sync. operations */ H5VL_iod_request_t *request = NULL; + uint64_t parent_axe_id; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* resolve the location where to open the attribute by fetching the iod id and object handle - for the last open group in the path hierarchy. This is where we will start the traversal - at the server side. */ - if(H5VL_iod_local_traverse(obj, loc_params, ".", &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + attribute should be opened. */ + if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, + &parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); /* allocate the attribute object that is returned to the user */ if(NULL == (attr = H5FL_CALLOC(H5VL_iod_attr_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + attr->remote_attr.iod_oh.cookie = IOD_OH_UNDEFINED; + attr->remote_attr.iod_id = IOD_ID_UNDEFINED; + /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; + input.parent_axe_id = parent_axe_id; input.path = new_name; input.attr_name = attr_name; input.axe_id = axe_id ++; +#if H5VL_IOD_DEBUG + printf("Attribute Open %s LOC ID %llu, axe id %llu, parent %llu\n", + attr_name, input.loc_id, input.axe_id, input.parent_axe_id); +#endif + /* get a function shipper request */ if(do_async) { if(NULL == (hg_req = (hg_request_t *)H5MM_malloc(sizeof(hg_request_t)))) @@ -3188,6 +3351,7 @@ H5VL_iod_attribute_open(void *_obj, H5VL_loc_params_t loc_params, const char *at request->data = attr; request->req = hg_req; request->obj = attr; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -3254,11 +3418,11 @@ H5VL_iod_attribute_read(void *_attr, hid_t type_id, void *buf, hid_t dxpl_id, vo FUNC_ENTER_NOAPI_NOINIT - /* wait for the attribute create or open to complete */ - if(NULL != attr->common.request && H5VL_IOD_PENDING == attr->common.request->state) { - if(H5VL_iod_request_wait(attr->common.file, attr->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - attr->common.request = NULL; + /* set the parent axe id */ + if(attr->common.request) + input.parent_axe_id = attr->common.request->axe_id; + else { + input.parent_axe_id = 0; } /* calculate the size of the buffer needed */ @@ -3273,8 +3437,9 @@ H5VL_iod_attribute_read(void *_attr, hid_t type_id, void *buf, hid_t dxpl_id, vo HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't create Bulk Data Handle"); /* Fill input structure */ + input.coh = attr->common.file->remote_file.coh; input.iod_oh = attr->remote_attr.iod_oh; - input.scratch_oh = attr->remote_attr.scratch_oh; + input.iod_id = attr->remote_attr.iod_id; input.bulk_handle = *bulk_handle; input.type_id = type_id; input.axe_id = axe_id ++; @@ -3317,6 +3482,7 @@ H5VL_iod_attribute_read(void *_attr, hid_t type_id, void *buf, hid_t dxpl_id, vo request->obj = attr; request->status = 0; request->state = 0; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(attr->common.file, request); @@ -3375,10 +3541,11 @@ H5VL_iod_attribute_write(void *_attr, hid_t type_id, const void *buf, hid_t dxpl FUNC_ENTER_NOAPI_NOINIT - if(NULL != attr->common.request && H5VL_IOD_PENDING == attr->common.request->state) { - if(H5VL_iod_request_wait(attr->common.file, attr->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - attr->common.request = NULL; + /* set the parent axe id */ + if(attr->common.request) + input.parent_axe_id = attr->common.request->axe_id; + else { + input.parent_axe_id = 0; } /* calculate the size of the buffer needed */ @@ -3399,8 +3566,9 @@ H5VL_iod_attribute_write(void *_attr, hid_t type_id, const void *buf, hid_t dxpl HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "can't create Bulk Data Handle"); /* Fill input structure */ + input.coh = attr->common.file->remote_file.coh; input.iod_oh = attr->remote_attr.iod_oh; - input.scratch_oh = attr->remote_attr.scratch_oh; + input.iod_id = attr->remote_attr.iod_id; input.bulk_handle = *bulk_handle; input.type_id = type_id; input.axe_id = axe_id ++; @@ -3444,6 +3612,7 @@ H5VL_iod_attribute_write(void *_attr, hid_t type_id, const void *buf, hid_t dxpl request->data = info; request->req = hg_req; request->obj = attr; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(attr->common.file, request); @@ -3501,11 +3670,10 @@ H5VL_iod_attribute_remove(void *_obj, H5VL_loc_params_t loc_params, const char * FUNC_ENTER_NOAPI_NOINIT - /* resolve the location where to delete the attribute by fetching - the iod id and object handle for the last open group in the - path hierarchy. This is where we will start the traversal at - the server side */ - if(H5VL_iod_local_traverse(obj, loc_params, ".", &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + attribute should be removed. */ + if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, + &input.parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); /* set the input structure for the HG encode routine */ @@ -3544,6 +3712,7 @@ H5VL_iod_attribute_remove(void *_obj, H5VL_loc_params_t loc_params, const char * request->data = status; request->req = hg_req; request->obj = obj; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -3692,11 +3861,10 @@ H5VL_iod_attribute_get(void *_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, char *new_name; attr_op_in_t input; - /* resolve the location where to lookup the attribute by fetching - the iod id and object handle for the last open group in the - path hierarchy. This is where we will start the traversal at - the server side */ - if(H5VL_iod_local_traverse(obj, loc_params, ".", &iod_id, &iod_oh, &new_name) < 0) + /* Retrieve the parent AXE id by traversing the path where the + attribute should be checked. */ + if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, + &input.parent_axe_id, &new_name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); /* set the input structure for the HG encode routine */ @@ -3736,6 +3904,7 @@ H5VL_iod_attribute_get(void *_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, request->data = value; request->req = hg_req; request->obj = obj; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(obj->file, request); @@ -3825,20 +3994,13 @@ H5VL_iod_attribute_close(void *_attr, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI_NOINIT - if(NULL != attr->common.request && H5VL_IOD_PENDING == attr->common.request->state) { - if(H5VL_iod_request_wait(attr->common.file, attr->common.request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - attr->common.request = NULL; + /* set the parent axe id */ + if(attr->common.request) + input.parent_axe_id = attr->common.request->axe_id; + else { + input.parent_axe_id = 0; } - if(H5VL_iod_request_wait_some(attr->common.file, attr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG requests"); - status = (int *)malloc(sizeof(int)); /* get a function shipper request */ @@ -3851,8 +4013,6 @@ H5VL_iod_attribute_close(void *_attr, hid_t dxpl_id, void **req) input.iod_oh = attr->remote_attr.iod_oh; input.iod_id = attr->remote_attr.iod_id; - input.scratch_oh = attr->remote_attr.scratch_oh; - input.scratch_id = attr->remote_attr.scratch_id; input.axe_id = axe_id ++; /* forward the call to the IONs */ @@ -3873,6 +4033,7 @@ H5VL_iod_attribute_close(void *_attr, hid_t dxpl_id, void **req) request->data = status; request->req = hg_req; request->obj = attr; + request->axe_id = input.axe_id; request->next = request->prev = NULL; /* add request to container's linked list */ H5VL_iod_request_add(attr->common.file, request); @@ -3901,6 +4062,88 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_iod_cancel + * + * Purpose: Cancel an asynchronous operation + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Mohamad Chaarawi + * April 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_iod_cancel(void **req, H5_status_t *status) +{ + H5VL_iod_request_t *request = *((H5VL_iod_request_t **)req); + hg_status_t hg_status; + int ret; + H5VL_iod_state_t state; + hg_request_t hg_req; /* Local function shipper request, for sync. operations */ + H5VL_iod_request_t cancel_req; /* Local request, for sync. operations */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* request has completed already, can not cancel */ + if(request->state == H5VL_IOD_COMPLETED) { + if(H5VL_iod_request_wait(request->obj->file, request) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to wait for request"); + *status = request->status; + request->req = H5MM_xfree(request->req); + request = H5MM_xfree(request); + } + + /* forward the cancel call to the IONs */ + if(HG_Forward(PEER, H5VL_CANCEL_OP_ID, &request->axe_id, &state, &hg_req) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to ship attribute write"); + + /* Wait on the cancel request to return */ + ret = HG_Wait(hg_req, HG_MAX_IDLE_TIME, &hg_status); + /* If the actual wait Fails, then the status of the cancel + operation is unknown */ + if(HG_FAIL == ret) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to wait on cancel request") + else { + if(hg_status) { + /* If the operation to be canceled has already completed, + mark it so and complete it locally */ + if(state == H5VL_IOD_COMPLETED) { + if(H5VL_IOD_PENDING == request->state) { + if(H5VL_iod_request_wait(request->obj->file, request) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to wait for request"); + } + + *status = request->status; + request->req = H5MM_xfree(request->req); + request = H5MM_xfree(request); + } + + /* if the status returned is cancelled, then cancel it + locally too */ + else if (state == H5VL_IOD_CANCELLED) { + request->status = H5AO_CANCELLED; + request->state = H5VL_IOD_CANCELLED; + if(H5VL_iod_request_cancel(request->obj->file, request) < 0) + fprintf(stderr, "Operation Failed!\n"); + + *status = request->status; + request->req = H5MM_xfree(request->req); + request = H5MM_xfree(request); + } + } + else + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Cancel Operation taking too long. Aborting"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_cancel() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_iod_test * * Purpose: Test for an asynchronous operation's completion diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index 656ef4a..66c13c3 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -536,8 +536,218 @@ done: } herr_t -H5VL_iod_local_traverse(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, const char *name, - iod_obj_id_t *id, iod_handle_t *oh, char **new_name) +H5VL_iod_request_cancel(H5VL_iod_file_t *file, H5VL_iod_request_t *req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(req->state == H5VL_IOD_CANCELLED); + + switch(req->type) { + case HG_DSET_WRITE: + case HG_DSET_READ: + case HG_ATTR_WRITE: + case HG_ATTR_READ: + { + H5VL_iod_io_info_t *info = (H5VL_iod_io_info_t *)req->data; + + /* Free memory handle */ + if(HG_SUCCESS != HG_Bulk_handle_free(*info->bulk_handle)) { + fprintf(stderr, "failed to free bulk handle\n"); + } + free(info->status); + info->status = NULL; + info->bulk_handle = (hg_bulk_t *)H5MM_xfree(info->bulk_handle); + info = (H5VL_iod_io_info_t *)H5MM_xfree(info); + req->data = NULL; + H5VL_iod_request_delete(file, req); + break; + } + case HG_FILE_FLUSH: + { + int *status = (int *)req->data; + + free(status); + req->data = NULL; + file->common.request = NULL; + H5VL_iod_request_delete(file, req); + break; + } + case HG_FILE_CREATE: + case HG_FILE_OPEN: + case HG_FILE_CLOSE: + { + int *status = (int *)req->data; + + free(status); + req->data = NULL; + file->common.request = NULL; + H5VL_iod_request_delete(file, req); + + /* free everything */ + free(file->file_name); + free(file->common.obj_name); + if(file->fapl_id != H5P_FILE_ACCESS_DEFAULT && H5Pclose(file->fapl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + if(file->remote_file.fcpl_id != 0 && + file->remote_file.fcpl_id != H5P_FILE_CREATE_DEFAULT && + H5Pclose(file->remote_file.fcpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + file = H5FL_FREE(H5VL_iod_file_t, file); + break; + } + case HG_ATTR_REMOVE: + { + int *status = (int *)req->data; + H5VL_iod_object_t *obj = (H5VL_iod_object_t *)req->obj; + + free(status); + req->data = NULL; + obj->request = NULL; + H5VL_iod_request_delete(obj, req); + break; + } + case HG_ATTR_EXISTS: + { + htri_t *ret = (htri_t *)req->data; + H5VL_iod_object_t *obj = (H5VL_iod_object_t *)req->obj; + + req->data = NULL; + obj->request = NULL; + H5VL_iod_request_delete(file, req); + break; + } + case HG_ATTR_CREATE: + case HG_ATTR_OPEN: + case HG_ATTR_CLOSE: + { + int *status = (int *)req->data; + H5VL_iod_attr_t *attr = (H5VL_iod_attr_t *)req->obj; + + free(status); + req->data = NULL; + attr->common.request = NULL; + H5VL_iod_request_delete(file, req); + + /* free attr components */ + free(attr->common.obj_name); + if(attr->remote_attr.acpl_id != 0 && + attr->remote_attr.acpl_id != H5P_ATTRIBUTE_CREATE_DEFAULT && + H5Pclose(attr->remote_attr.acpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + if(attr->remote_attr.type_id != 0 && + H5Tclose(attr->remote_attr.type_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close dtype"); + if(attr->remote_attr.space_id != 0 && + H5Sclose(attr->remote_attr.space_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close dspace"); + attr = H5FL_FREE(H5VL_iod_attr_t, attr); + break; + } + case HG_GROUP_CREATE: + case HG_GROUP_OPEN: + case HG_GROUP_CLOSE: + { + int *status = (int *)req->data; + H5VL_iod_group_t *grp = (H5VL_iod_group_t *)req->obj; + + free(status); + req->data = NULL; + grp->common.request = NULL; + H5VL_iod_request_delete(file, req); + + /* free group components */ + free(grp->common.obj_name); + if(grp->gapl_id != H5P_GROUP_ACCESS_DEFAULT && H5Pclose(grp->gapl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + if(grp->remote_group.gcpl_id != 0 && + grp->remote_group.gcpl_id != H5P_GROUP_CREATE_DEFAULT && + H5Pclose(grp->remote_group.gcpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + grp = H5FL_FREE(H5VL_iod_group_t, grp); + break; + } + case HG_DSET_SET_EXTENT: + { + int *status = (int *)req->data; + H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)req->obj; + + free(status); + req->data = NULL; + dset->common.request = NULL; + H5VL_iod_request_delete(file, req); + break; + } + case HG_DSET_CREATE: + case HG_DSET_OPEN: + case HG_DSET_CLOSE: + { + int *status = (int *)req->data; + H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)req->obj; + + free(status); + req->data = NULL; + dset->common.request = NULL; + H5VL_iod_request_delete(file, req); + + /* free dset components */ + free(dset->common.obj_name); + if(dset->remote_dset.dcpl_id != 0 && + dset->remote_dset.dcpl_id != H5P_DATASET_CREATE_DEFAULT && + H5Pclose(dset->remote_dset.dcpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + if(dset->dapl_id != H5P_DATASET_ACCESS_DEFAULT && + H5Pclose(dset->dapl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + if(dset->remote_dset.type_id != 0 && + H5Tclose(dset->remote_dset.type_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close dtype"); + if(dset->remote_dset.space_id != 0 && + H5Sclose(dset->remote_dset.space_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close dspace"); + dset = H5FL_FREE(H5VL_iod_dset_t, dset); + break; + } + case HG_DTYPE_COMMIT: + case HG_DTYPE_OPEN: + case HG_DTYPE_CLOSE: + { + int *status = (int *)req->data; + H5VL_iod_dtype_t *dtype = (H5VL_iod_dtype_t *)req->obj; + + free(status); + req->data = NULL; + dtype->common.request = NULL; + H5VL_iod_request_delete(file, req); + + /* free dtype components */ + free(dtype->common.obj_name); + if(dtype->remote_dtype.tcpl_id != 0 && + dtype->remote_dtype.tcpl_id != H5P_DATATYPE_CREATE_DEFAULT && + H5Pclose(dtype->remote_dtype.tcpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + if(dtype->tapl_id != H5P_DATATYPE_ACCESS_DEFAULT && + H5Pclose(dtype->tapl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist"); + if(dtype->remote_dtype.type_id != 0 && + H5Tclose(dtype->remote_dtype.type_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close dtype"); + dtype = H5FL_FREE(H5VL_iod_dtype_t, dtype); + break; + } + default: + H5VL_iod_request_delete(file, req); + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "Request Type not supported"); + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +herr_t +H5VL_iod_get_parent_info(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, + const char *name, iod_obj_id_t *iod_id, iod_handle_t *iod_oh, + uint64_t *axe_id, char **new_name) { iod_obj_id_t cur_id; iod_handle_t cur_oh; @@ -554,17 +764,6 @@ H5VL_iod_local_traverse(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, co FUNC_ENTER_NOAPI_NOINIT - if(NULL != obj->request) { - if(H5VL_iod_request_wait(obj->file, obj->request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - obj->request = NULL; - } - switch(obj->obj_type) { case H5I_FILE: cur_oh = obj->file->remote_file.root_oh; @@ -586,6 +785,14 @@ H5VL_iod_local_traverse(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, co HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "bad location object"); } + if(obj->request && obj->request->status == H5AO_PENDING){ + *axe_id = obj->request->axe_id; + } + else { + *axe_id = 0; + HDassert(cur_oh.cookie != IOD_OH_UNDEFINED); + } + if(loc_params.type == H5VL_OBJECT_BY_SELF) path = name; else if (loc_params.type == H5VL_OBJECT_BY_NAME) @@ -636,22 +843,14 @@ H5VL_iod_local_traverse(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, co //&& NULL == (cur_obj = (H5VL_iod_object_t *)H5I_search_name(cur_name, H5I_DATATYPE))) break; } - else + else { break; + } } +#if H5VL_IOD_DEBUG printf("Found %s Locally\n", comp); - - if(NULL != cur_obj->request) { - if(H5VL_iod_request_wait(obj->file, cur_obj->request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wait on HG request"); - - /* Reset object's pointer to request */ - /* (Request is owned by the request object and will be freed when the - * application calls test or wait on it.) - */ - cur_obj->request = NULL; - } +#endif switch(cur_obj->obj_type) { case H5I_GROUP: @@ -670,12 +869,22 @@ H5VL_iod_local_traverse(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, co HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "bad location object"); } + if(cur_obj->request && cur_obj->request->status == H5AO_PENDING) { + *axe_id = cur_obj->request->axe_id; + } + else { + *axe_id = 0; + HDassert(cur_oh.cookie != IOD_OH_UNDEFINED); + } + /* Advance to next component in string */ path += nchars; + HDstrcat(cur_name, "/"); + cur_size += 1; } - *id = cur_id; - *oh = cur_oh; + *iod_id = cur_id; + *iod_oh = cur_oh; if(*path) *new_name = strdup(path); else @@ -687,7 +896,43 @@ done: if(wb && H5WB_unwrap(wb) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't release wrapped buffer") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_iod_local_traverse */ +} /* end H5VL_iod_get_parent_info */ + +herr_t +H5VL_iod_gen_obj_id(int myrank, int nranks, uint64_t cur_index, + iod_obj_type_t type, uint64_t *id) +{ + herr_t ret_value = SUCCEED; + uint64_t tmp_id; + + FUNC_ENTER_NOAPI_NOINIT + + /* determine first the rank of the object with the first 59 + bits */ + tmp_id = myrank + (nranks * cur_index); + + /* toggle the object type bits */ + switch(type) { + case IOD_OBJ_ARRAY: + tmp_id |= IOD_OBJ_TYPE_ARRAY; + break; + case IOD_OBJ_KV: + tmp_id |= IOD_OBJ_TYPE_KV; + break; + case IOD_OBJ_BLOB: + tmp_id |= IOD_OBJ_TYPE_BLOB; + break; + default: + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "bad object type"); + } + + /* toggle the owner bit */ + tmp_id |= IOD_OBJID_APP; + + *id = tmp_id; +done: + FUNC_LEAVE_NOAPI(ret_value) +} #if 0 static herr_t @@ -706,7 +951,7 @@ done: } static herr_t -H5VL_iod_get_axe_id(int myrank, int nranks, int index, uint64_t *id) +H5VL_iod_get_axe_id(int myrank, int nranks, int cur_index, uint64_t *id) { herr_t ret_value = SUCCEED; diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index 3468926..6b708d3 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -55,11 +55,6 @@ typedef enum H5RQ_type_t { HG_DTYPE_CLOSE } H5RQ_type_t; -typedef enum H5VL_iod_state_t { - H5VL_IOD_PENDING, - H5VL_IOD_COMPLETED -} H5VL_iod_state_t; - /* the client IOD VOL request struct */ typedef struct H5VL_iod_request_t { H5RQ_type_t type; @@ -68,6 +63,7 @@ typedef struct H5VL_iod_request_t { struct H5VL_iod_object_t *obj; H5VL_iod_state_t state; H5_status_t status; + uint64_t axe_id; struct H5VL_iod_request_t *prev; struct H5VL_iod_request_t *next; } H5VL_iod_request_t; @@ -77,9 +73,10 @@ typedef struct H5VL_iod_remote_file_t { /* Do NOT change the order of the parameters */ iod_handle_t coh; iod_handle_t root_oh; + uint64_t kv_oid_index; + uint64_t array_oid_index; + uint64_t blob_oid_index; iod_obj_id_t root_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; hid_t fcpl_id; } H5VL_iod_remote_file_t; @@ -88,8 +85,6 @@ typedef struct H5VL_iod_remote_attr_t { /* Do NOT change the order of the parameters */ iod_handle_t iod_oh; iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; hid_t acpl_id; hid_t type_id; hid_t space_id; @@ -100,8 +95,6 @@ typedef struct H5VL_iod_remote_group_t { /* Do NOT change the order of the parameters */ iod_handle_t iod_oh; iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; hid_t gcpl_id; } H5VL_iod_remote_group_t; @@ -110,8 +103,6 @@ typedef struct H5VL_iod_remote_dset_t { /* Do NOT change the order of the parameters */ iod_handle_t iod_oh; iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; hid_t dcpl_id; hid_t type_id; hid_t space_id; @@ -122,8 +113,6 @@ typedef struct H5VL_iod_remote_dtype_t { /* Do NOT change the order of the parameters */ iod_handle_t iod_oh; iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; hid_t tcpl_id; hid_t type_id; } H5VL_iod_remote_dtype_t; @@ -143,6 +132,8 @@ typedef struct H5VL_iod_file_t { char *file_name; unsigned flags; hid_t fapl_id; + int my_rank; + int num_procs; unsigned nopen_objs; H5VL_iod_request_t *request_list_head; H5VL_iod_request_t *request_list_tail; @@ -189,9 +180,11 @@ H5_DLL herr_t H5VL_iod_request_wait(H5VL_iod_file_t *file, H5VL_iod_request_t *r H5_DLL herr_t H5VL_iod_request_wait_all(H5VL_iod_file_t *file); H5_DLL herr_t H5VL_iod_request_wait_some(H5VL_iod_file_t *file, const void *object); H5_DLL herr_t H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req); -H5_DLL herr_t H5VL_iod_local_traverse(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, - const char *name, iod_obj_id_t *id, iod_handle_t *oh, - char **new_name); - +H5_DLL herr_t H5VL_iod_request_cancel(H5VL_iod_file_t *file, H5VL_iod_request_t *req); +H5_DLL herr_t H5VL_iod_get_parent_info(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, + const char *name, iod_obj_id_t *iod_id, iod_handle_t *iod_oh, + uint64_t *axe_id, char **new_name); +H5_DLL herr_t H5VL_iod_gen_obj_id(int myrank, int nranks, uint64_t cur_index, + iod_obj_type_t type, uint64_t *id); #endif /* H5_HAVE_EFF */ #endif /* _H5VLiod_client_H */ diff --git a/src/H5VLiod_common.h b/src/H5VLiod_common.h index 56b3052..5a02143 100644 --- a/src/H5VLiod_common.h +++ b/src/H5VLiod_common.h @@ -26,6 +26,15 @@ #ifdef H5_HAVE_EFF #define NA_UNDEFINED NULL +#define IOD_OH_UNDEFINED (pow(2,64) - 1) +#define IOD_ID_UNDEFINED (pow(2,64) - 1) +#define H5VL_IOD_DEBUG 1 + +typedef enum H5VL_iod_state_t { + H5VL_IOD_PENDING, + H5VL_IOD_COMPLETED, + H5VL_IOD_CANCELLED +} H5VL_iod_state_t; typedef struct H5VL_iod_read_status_t { int ret; @@ -48,90 +57,90 @@ H5_DLL int hg_proc_dims_t(hg_proc_t proc, void *data); MERCURY_GEN_PROC(eff_init_in_t, ((uint32_t)(proc_num))) MERCURY_GEN_PROC(file_create_in_t, ((hg_string_t)(name)) ((uint32_t)(flags)) + ((iod_obj_id_t)(root_id)) ((hid_t)(fapl_id)) ((hid_t)(fcpl_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(file_create_out_t, ((iod_handle_t)(coh)) ((iod_handle_t)(root_oh)) - ((iod_obj_id_t)(root_id)) ((iod_handle_t)(scratch_oh)) - ((iod_obj_id_t)(scratch_id))) + ((uint64_t)(kv_oid_index)) ((uint64_t)(array_oid_index)) + ((uint64_t)(blob_oid_index))) MERCURY_GEN_PROC(file_open_in_t, ((hg_string_t)(name)) ((uint32_t)(flags)) ((hid_t)(fapl_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(file_open_out_t, ((iod_handle_t)(coh)) ((iod_handle_t)(root_oh)) - ((iod_obj_id_t)(root_id)) ((iod_handle_t)(scratch_oh)) - ((iod_obj_id_t)(scratch_id)) ((hid_t)(fcpl_id))) + ((uint64_t)(kv_oid_index)) ((uint64_t)(array_oid_index)) + ((uint64_t)(blob_oid_index)) + ((iod_obj_id_t)(root_id)) ((hid_t)(fcpl_id))) MERCURY_GEN_PROC(file_flush_in_t, ((iod_handle_t)(coh)) ((int32_t)(scope)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(file_close_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(root_oh)) - ((iod_obj_id_t)(root_id)) ((iod_handle_t)(scratch_oh)) - ((iod_obj_id_t)(scratch_id)) ((uint64_t)(axe_id))) + ((iod_obj_id_t)(root_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(attr_create_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) + ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(attr_id)) + ((uint64_t)(parent_axe_id)) ((hg_string_t)(path)) ((hg_string_t)(attr_name)) ((hid_t)(acpl_id)) ((hid_t)(type_id)) ((hid_t)(space_id)) ((uint64_t)(axe_id))) -MERCURY_GEN_PROC(attr_create_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id))) +MERCURY_GEN_PROC(attr_create_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(attr_open_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) + ((iod_obj_id_t)(loc_id)) ((uint64_t)(parent_axe_id)) ((hg_string_t)(path)) ((hg_string_t)(attr_name)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(attr_open_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((hid_t)(acpl_id)) ((hid_t)(type_id)) ((hid_t)(space_id))) MERCURY_GEN_PROC(attr_op_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) - ((hg_string_t)(attr_name)) ((uint64_t)(axe_id))) -MERCURY_GEN_PROC(attr_io_in_t, ((iod_handle_t)(iod_oh)) ((iod_handle_t)(scratch_oh)) + ((iod_obj_id_t)(loc_id)) ((uint64_t)(parent_axe_id)) + ((hg_string_t)(path)) ((hg_string_t)(attr_name)) ((uint64_t)(axe_id))) +MERCURY_GEN_PROC(attr_io_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) + ((iod_obj_id_t)(iod_id)) ((uint64_t)(parent_axe_id)) ((hid_t)(type_id)) ((hg_bulk_t)(bulk_handle)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(attr_close_in_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((uint64_t)(axe_id))) + ((uint64_t)(parent_axe_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(group_create_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) - ((hid_t)(gapl_id)) ((hid_t)(gcpl_id)) ((hid_t)(lcpl_id)) ((uint64_t)(axe_id))) -MERCURY_GEN_PROC(group_create_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id))) + ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(grp_id)) + ((uint64_t)(parent_axe_id)) ((hg_string_t)(name)) ((hid_t)(gapl_id)) + ((hid_t)(gcpl_id)) ((hid_t)(lcpl_id)) ((uint64_t)(axe_id))) +MERCURY_GEN_PROC(group_create_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(group_open_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) + ((iod_obj_id_t)(loc_id)) ((uint64_t)(parent_axe_id)) ((hg_string_t)(name)) ((hid_t)(gapl_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(group_open_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((hid_t)(gcpl_id))) MERCURY_GEN_PROC(group_close_in_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((uint64_t)(axe_id))) + ((uint64_t)(parent_axe_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(dset_create_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) + ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(dset_id)) + ((uint64_t)(parent_axe_id)) ((hg_string_t)(name)) ((hid_t)(dapl_id)) ((hid_t)(dcpl_id)) ((hid_t)(lcpl_id)) ((hid_t)(type_id)) ((hid_t)(space_id)) ((uint64_t)(axe_id))) -MERCURY_GEN_PROC(dset_create_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id))) +MERCURY_GEN_PROC(dset_create_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(dset_open_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) - ((hid_t)(dapl_id)) ((uint64_t)(axe_id))) + ((iod_obj_id_t)(loc_id)) ((uint64_t)(parent_axe_id)) + ((hg_string_t)(name)) ((hid_t)(dapl_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(dset_open_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((hid_t)(dcpl_id)) ((hid_t)(type_id)) ((hid_t)(space_id))) -MERCURY_GEN_PROC(dset_set_extent_in_t, ((iod_handle_t)(iod_oh)) ((dims_t)(dims)) - ((uint64_t)(axe_id))) -MERCURY_GEN_PROC(dset_io_in_t, ((iod_handle_t)(iod_oh)) ((iod_handle_t)(scratch_oh)) +MERCURY_GEN_PROC(dset_set_extent_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) + ((iod_obj_id_t)(iod_id)) ((uint64_t)(parent_axe_id)) + ((dims_t)(dims)) ((uint64_t)(axe_id))) +MERCURY_GEN_PROC(dset_io_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) + ((iod_obj_id_t)(iod_id)) ((uint64_t)(parent_axe_id)) ((hid_t)(space_id)) ((hid_t)(dxpl_id)) ((uint32_t)(checksum)) ((hg_bulk_t)(bulk_handle)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(dset_read_out_t, ((int32_t)(ret)) ((uint32_t)(cs))) MERCURY_GEN_PROC(dset_close_in_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((uint64_t)(axe_id))) + ((uint64_t)(parent_axe_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(dtype_commit_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) + ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(dtype_id)) + ((uint64_t)(parent_axe_id)) ((hg_string_t)(name)) ((hid_t)(tapl_id)) ((hid_t)(tcpl_id)) ((hid_t)(lcpl_id)) ((hid_t)(type_id)) ((uint64_t)(axe_id))) -MERCURY_GEN_PROC(dtype_commit_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id))) +MERCURY_GEN_PROC(dtype_commit_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(dtype_open_in_t, ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) - ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) - ((hid_t)(tapl_id)) ((uint64_t)(axe_id))) + ((iod_obj_id_t)(loc_id)) ((uint64_t)(parent_axe_id)) + ((hg_string_t)(name)) ((hid_t)(tapl_id)) ((uint64_t)(axe_id))) MERCURY_GEN_PROC(dtype_open_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((hid_t)(tcpl_id)) ((hid_t)(type_id))) MERCURY_GEN_PROC(dtype_close_in_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) - ((iod_handle_t)(scratch_oh)) ((iod_obj_id_t)(scratch_id)) ((uint64_t)(axe_id))) + ((uint64_t)(parent_axe_id)) ((uint64_t)(axe_id))) #if 0 H5_DLL int hg_proc_eff_init_in_t(hg_proc_t proc, void *data); diff --git a/src/H5VLiod_encdec.c b/src/H5VLiod_encdec.c index e30f4a3..b298b2a 100644 --- a/src/H5VLiod_encdec.c +++ b/src/H5VLiod_encdec.c @@ -73,20 +73,12 @@ int hg_proc_iod_obj_id_t(hg_proc_t proc, void *data) int ret = HG_SUCCESS; iod_obj_id_t *struct_data = (iod_obj_id_t *)data; - ret = hg_proc_uint64_t(proc, &struct_data->oid_hi); + ret = hg_proc_uint64_t(proc, &struct_data); if (ret != HG_SUCCESS) { HG_ERROR_DEFAULT("Proc error"); ret = HG_FAIL; return ret; } - - ret = hg_proc_uint64_t(proc, &struct_data->oid_lo); - if (ret != HG_SUCCESS) { - HG_ERROR_DEFAULT("Proc error"); - ret = HG_FAIL; - return ret; - } - return ret; } diff --git a/src/H5VLiod_server.c b/src/H5VLiod_server.c index fc68472..0abfe84 100644 --- a/src/H5VLiod_server.c +++ b/src/H5VLiod_server.c @@ -49,79 +49,78 @@ static hbool_t shutdown = FALSE; #define EEXISTS 1 -static herr_t H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *path, - hbool_t create_interm_grps, hbool_t break_on_last_comp, - char **last_comp, iod_obj_id_t *iod_id, iod_handle_t *iod_oh, - iod_obj_id_t *scratch_id, iod_handle_t *scratch_oh); +static herr_t H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handle_t loc_handle, + const char *path, hbool_t create_interm_grps, + char **last_comp, iod_obj_id_t *iod_id, iod_handle_t *iod_oh); -static herr_t H5VL_iod_server_file_create_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_file_create_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_file_open_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_file_open_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_file_close_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_file_close_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_file_flush_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_file_flush_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_attr_create_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_attr_create_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_attr_open_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_attr_open_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_attr_read_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_attr_read_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_attr_write_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_attr_write_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_attr_exists_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_attr_exists_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_attr_remove_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_attr_remove_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_attr_close_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_attr_close_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_group_create_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_group_create_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_group_open_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_group_open_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_group_close_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_group_close_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dset_create_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dset_create_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dset_open_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dset_open_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dset_write_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dset_write_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dset_set_extent_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dset_set_extent_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dset_close_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dset_close_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dtype_commit_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dtype_commit_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dtype_open_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dtype_open_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); -static herr_t H5VL_iod_server_dtype_close_cb(AXE_engine_t axe_engine, size_t num_necessary_parents, AXE_task_t necessary_parents[], - size_t num_sufficient_parents, AXE_task_t sufficient_parents[], +static herr_t H5VL_iod_server_dtype_close_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], void *op_data); herr_t H5VLiod_start_handler(MPI_Comm comm, MPI_Info UNUSED info) @@ -199,6 +198,9 @@ H5VLiod_start_handler(MPI_Comm comm, MPI_Info UNUSED info) MERCURY_HANDLER_REGISTER("dtype_close", H5VL_iod_server_dtype_close, dtype_close_in_t, ret_t); + MERCURY_HANDLER_REGISTER("cancel_op", H5VL_iod_server_cancel_op, + uint64_t, uint8_t); + /* Initialize engine attribute */ if(AXEengine_attr_init(&engine_attr) != AXE_SUCCEED) return FAIL; @@ -308,6 +310,53 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_iod_server_cancel_op + * + * Purpose: Function to cancel an AXE operation + * + * Return: Success: HG_SUCCESS + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * May, 2013 + * + *------------------------------------------------------------------------- + */ +int +H5VL_iod_server_cancel_op(hg_handle_t handle) +{ + AXE_task_t axe_id; + AXE_remove_status_t remove_status; + H5_status_t ret_value = H5AO_PENDING; + + FUNC_ENTER_NOAPI_NOINIT + + if(HG_FAIL == HG_Handler_get_input(handle, &axe_id)) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, HG_FAIL, "can't get input parameters"); + + /* Try to remove the task. */ + if(AXEremove(engine, axe_id, &remove_status) != AXE_SUCCEED) + HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, HG_FAIL, "can't remove AXE task; it has children"); + + if(remove_status == AXE_CANCELED) + HGOTO_DONE(H5VL_IOD_CANCELLED) + else if(remove_status == AXE_ALL_DONE) + HGOTO_DONE(H5VL_IOD_COMPLETED) + else if(remove_status == AXE_NOT_CANCELED) { + void *op_data; + + fprintf(stderr, "Task is running. Attempting to cancel Manually\n"); + if(AXEget_op_data(engine, axe_id, op_data) != AXE_SUCCEED) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, HG_FAIL, "can't get op data"); + /* Attempt to cancel the task manually */ + } +done: + HG_Handler_start_output(handle, &ret_value); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_server_cancel_op() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_iod_server_file_create * * Purpose: Function shipper registered call for File Create. @@ -324,13 +373,16 @@ done: int H5VL_iod_server_file_create(hg_handle_t handle) { - H5VL_iod_file_create_input_t *input = NULL; + op_data_t *op_data = NULL; + file_create_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_file_create_input_t *) - H5MM_malloc(sizeof(H5VL_iod_file_create_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (file_create_in_t *)H5MM_malloc(sizeof(file_create_in_t)))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -339,9 +391,11 @@ H5VL_iod_server_file_create(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; + op_data->hg_handle = handle; + op_data->input = (void *)input; + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_file_create_cb, input, NULL)) + H5VL_iod_server_file_create_cb, op_data, NULL)) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); done: @@ -366,13 +420,16 @@ done: int H5VL_iod_server_file_open(hg_handle_t handle) { - H5VL_iod_file_open_input_t *input = NULL; + op_data_t *op_data = NULL; + file_open_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_file_open_input_t *) - H5MM_malloc(sizeof(H5VL_iod_file_open_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (file_open_in_t *) H5MM_malloc(sizeof(file_open_in_t)))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -381,9 +438,11 @@ H5VL_iod_server_file_open(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; + op_data->hg_handle = handle; + op_data->input = (void *)input; + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_file_open_cb, input, NULL)) + H5VL_iod_server_file_open_cb, op_data, NULL)) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); done: @@ -408,13 +467,16 @@ done: int H5VL_iod_server_file_flush(hg_handle_t handle) { - H5VL_iod_file_flush_input_t *input = NULL; + op_data_t *op_data = NULL; + file_flush_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_file_flush_input_t *) - H5MM_malloc(sizeof(H5VL_iod_file_flush_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (file_flush_in_t *) H5MM_malloc(sizeof(file_flush_in_t)))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -423,9 +485,11 @@ H5VL_iod_server_file_flush(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_file_flush_cb, input, NULL)) + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if (AXE_SUCCEED != AXEcreate_barrier_task(engine, input->axe_id, + H5VL_iod_server_file_flush_cb, op_data, NULL)) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); done: @@ -450,13 +514,17 @@ done: int H5VL_iod_server_file_close(hg_handle_t handle) { - H5VL_iod_file_close_input_t *input = NULL; + op_data_t *op_data = NULL; + file_close_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_file_close_input_t *) - H5MM_malloc(sizeof(H5VL_iod_file_close_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (file_close_in_t *) + H5MM_malloc(sizeof(file_close_in_t)))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -465,9 +533,11 @@ H5VL_iod_server_file_close(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_file_close_cb, input, NULL)) + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if (AXE_SUCCEED != AXEcreate_barrier_task(engine, input->axe_id, + H5VL_iod_server_file_close_cb, op_data, NULL)) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); done: @@ -492,13 +562,17 @@ done: int H5VL_iod_server_attr_create(hg_handle_t handle) { - H5VL_iod_attr_create_input_t *input = NULL; + op_data_t *op_data = NULL; + attr_create_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_attr_create_input_t *) - H5MM_malloc(sizeof(H5VL_iod_attr_create_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (attr_create_in_t *) + H5MM_malloc(sizeof(attr_create_in_t)))) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -507,10 +581,20 @@ H5VL_iod_server_attr_create(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_attr_create_cb, input, NULL)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_attr_create_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_attr_create_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -534,13 +618,17 @@ done: int H5VL_iod_server_attr_open(hg_handle_t handle) { - H5VL_iod_attr_open_input_t *input = NULL; + op_data_t *op_data = NULL; + attr_open_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_attr_open_input_t *) - H5MM_malloc(sizeof(H5VL_iod_attr_open_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (attr_open_in_t *) + H5MM_malloc(sizeof(attr_open_in_t)))) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -549,10 +637,20 @@ H5VL_iod_server_attr_open(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_attr_open_cb, input, NULL)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_attr_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_attr_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -576,13 +674,17 @@ done: int H5VL_iod_server_attr_read(hg_handle_t handle) { - H5VL_iod_attr_io_input_t *input = NULL; + op_data_t *op_data = NULL; + attr_io_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_attr_io_input_t *) - H5MM_malloc(sizeof(H5VL_iod_attr_io_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (attr_io_in_t *) + H5MM_malloc(sizeof(attr_io_in_t)))) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -591,10 +693,20 @@ H5VL_iod_server_attr_read(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_attr_read_cb, input, NULL)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_attr_read_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_attr_read_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -618,13 +730,17 @@ done: int H5VL_iod_server_attr_write(hg_handle_t handle) { - H5VL_iod_attr_io_input_t *input = NULL; + op_data_t *op_data = NULL; + attr_io_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_attr_io_input_t *) - H5MM_malloc(sizeof(H5VL_iod_attr_io_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (attr_io_in_t *) + H5MM_malloc(sizeof(attr_io_in_t)))) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -633,10 +749,20 @@ H5VL_iod_server_attr_write(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_attr_write_cb, input, NULL)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_attr_write_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_attr_write_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -660,13 +786,17 @@ done: int H5VL_iod_server_attr_exists(hg_handle_t handle) { - H5VL_iod_attr_op_input_t *input = NULL; + op_data_t *op_data = NULL; + attr_op_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_attr_op_input_t *) - H5MM_malloc(sizeof(H5VL_iod_attr_op_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (attr_op_in_t *) + H5MM_malloc(sizeof(attr_op_in_t)))) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -675,10 +805,20 @@ H5VL_iod_server_attr_exists(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_attr_exists_cb, input, NULL)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_attr_exists_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_attr_exists_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -702,13 +842,17 @@ done: int H5VL_iod_server_attr_remove(hg_handle_t handle) { - H5VL_iod_attr_op_input_t *input = NULL; + op_data_t *op_data = NULL; + attr_op_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_attr_op_input_t *) - H5MM_malloc(sizeof(H5VL_iod_attr_op_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (attr_op_in_t *) + H5MM_malloc(sizeof(attr_op_in_t)))) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -717,10 +861,20 @@ H5VL_iod_server_attr_remove(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_attr_remove_cb, input, NULL)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_attr_remove_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_attr_remove_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -744,13 +898,17 @@ done: int H5VL_iod_server_attr_close(hg_handle_t handle) { - H5VL_iod_attr_close_input_t *input = NULL; + op_data_t *op_data = NULL; + attr_close_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_attr_close_input_t *) - H5MM_malloc(sizeof(H5VL_iod_attr_close_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (attr_close_in_t *) + H5MM_malloc(sizeof(attr_close_in_t)))) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -759,10 +917,20 @@ H5VL_iod_server_attr_close(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_attr_close_cb, input, NULL)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_attr_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_attr_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -786,14 +954,17 @@ done: int H5VL_iod_server_group_create(hg_handle_t handle) { - H5VL_iod_group_create_input_t *input = NULL; + op_data_t *op_data = NULL; + group_create_in_t *input; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_group_create_input_t *) - H5MM_malloc(sizeof(H5VL_iod_group_create_input_t)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (group_create_in_t *)H5MM_malloc(sizeof(group_create_in_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); if(HG_FAIL == HG_Handler_get_input(handle, input)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, HG_FAIL, "can't get input parameters"); @@ -801,10 +972,20 @@ H5VL_iod_server_group_create(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_group_create_cb, input, NULL)) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_group_create_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_group_create_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -828,14 +1009,17 @@ done: int H5VL_iod_server_group_open(hg_handle_t handle) { - H5VL_iod_group_open_input_t *input = NULL; + op_data_t *op_data = NULL; + group_open_in_t *input; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_group_open_input_t *) - H5MM_malloc(sizeof(H5VL_iod_group_open_input_t)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (group_open_in_t *)H5MM_malloc(sizeof(group_open_in_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); if(HG_FAIL == HG_Handler_get_input(handle, input)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, HG_FAIL, "can't get input parameters"); @@ -843,10 +1027,20 @@ H5VL_iod_server_group_open(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_group_open_cb, input, NULL)) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_group_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_group_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -870,14 +1064,17 @@ done: int H5VL_iod_server_group_close(hg_handle_t handle) { - H5VL_iod_group_close_input_t *input = NULL; + op_data_t *op_data = NULL; + group_close_in_t *input; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_group_close_input_t *) - H5MM_malloc(sizeof(H5VL_iod_group_close_input_t)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (group_close_in_t *)H5MM_malloc(sizeof(group_close_in_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); if(HG_FAIL == HG_Handler_get_input(handle, input)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, HG_FAIL, "can't get input parameters"); @@ -885,10 +1082,20 @@ H5VL_iod_server_group_close(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_group_close_cb, input, NULL)) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_group_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_group_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -912,13 +1119,17 @@ done: int H5VL_iod_server_dset_create(hg_handle_t handle) { - H5VL_iod_dset_create_input_t *input = NULL; + op_data_t *op_data = NULL; + dset_create_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dset_create_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dset_create_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dset_create_in_t *) + H5MM_malloc(sizeof(dset_create_in_t)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -927,10 +1138,20 @@ H5VL_iod_server_dset_create(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dset_create_cb, input, NULL)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dset_create_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dset_create_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -954,13 +1175,17 @@ done: int H5VL_iod_server_dset_open(hg_handle_t handle) { - H5VL_iod_dset_open_input_t *input = NULL; + op_data_t *op_data = NULL; + dset_open_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dset_open_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dset_open_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dset_open_in_t *) + H5MM_malloc(sizeof(dset_open_in_t)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -969,10 +1194,20 @@ H5VL_iod_server_dset_open(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dset_open_cb, input, NULL)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dset_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dset_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -996,13 +1231,17 @@ done: int H5VL_iod_server_dset_read(hg_handle_t handle) { - H5VL_iod_dset_io_input_t *input = NULL; + op_data_t *op_data = NULL; + dset_io_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dset_io_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dset_io_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dset_io_in_t *) + H5MM_malloc(sizeof(dset_io_in_t)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -1011,10 +1250,20 @@ H5VL_iod_server_dset_read(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dset_read_cb, input, NULL)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dset_read_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dset_read_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1038,13 +1287,17 @@ done: int H5VL_iod_server_dset_write(hg_handle_t handle) { - H5VL_iod_dset_io_input_t *input = NULL; + op_data_t *op_data = NULL; + dset_io_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dset_io_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dset_io_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dset_io_in_t *) + H5MM_malloc(sizeof(dset_io_in_t)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -1053,10 +1306,20 @@ H5VL_iod_server_dset_write(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dset_write_cb, input, NULL)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dset_write_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dset_write_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1080,13 +1343,17 @@ done: int H5VL_iod_server_dset_set_extent(hg_handle_t handle) { - H5VL_iod_dset_set_extent_input_t *input = NULL; + op_data_t *op_data = NULL; + dset_set_extent_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dset_set_extent_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dset_set_extent_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dset_set_extent_in_t *) + H5MM_malloc(sizeof(dset_set_extent_in_t)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -1095,10 +1362,20 @@ H5VL_iod_server_dset_set_extent(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dset_set_extent_cb, input, NULL)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dset_set_extent_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dset_set_extent_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1122,13 +1399,17 @@ done: int H5VL_iod_server_dset_close(hg_handle_t handle) { - H5VL_iod_dset_close_input_t *input = NULL; + op_data_t *op_data = NULL; + dset_close_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dset_close_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dset_close_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dset_close_in_t *) + H5MM_malloc(sizeof(dset_close_in_t)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -1137,10 +1418,20 @@ H5VL_iod_server_dset_close(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dset_close_cb, input, NULL)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dset_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dset_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1164,13 +1455,17 @@ done: int H5VL_iod_server_dtype_commit(hg_handle_t handle) { - H5VL_iod_dtype_commit_input_t *input = NULL; + op_data_t *op_data = NULL; + dtype_commit_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dtype_commit_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dtype_commit_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dtype_commit_in_t *) + H5MM_malloc(sizeof(dtype_commit_in_t)))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -1179,10 +1474,20 @@ H5VL_iod_server_dtype_commit(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dtype_commit_cb, input, NULL)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dtype_commit_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dtype_commit_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1206,13 +1511,17 @@ done: int H5VL_iod_server_dtype_open(hg_handle_t handle) { - H5VL_iod_dtype_open_input_t *input = NULL; + op_data_t *op_data = NULL; + dtype_open_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dtype_open_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dtype_open_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dtype_open_in_t *) + H5MM_malloc(sizeof(dtype_open_in_t)))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -1221,10 +1530,20 @@ H5VL_iod_server_dtype_open(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dtype_open_cb, input, NULL)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dtype_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dtype_open_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1248,13 +1567,17 @@ done: int H5VL_iod_server_dtype_close(hg_handle_t handle) { - H5VL_iod_dtype_close_input_t *input = NULL; + op_data_t *op_data = NULL; + dtype_close_in_t *input = NULL; int ret_value = HG_SUCCESS; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (input = (H5VL_iod_dtype_close_input_t *) - H5MM_malloc(sizeof(H5VL_iod_dtype_close_input_t)))) + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (dtype_close_in_t *) + H5MM_malloc(sizeof(dtype_close_in_t)))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, HG_FAIL, "can't allocate input struct for decoding"); if(HG_FAIL == HG_Handler_get_input(handle, input)) @@ -1263,10 +1586,20 @@ H5VL_iod_server_dtype_close(hg_handle_t handle) if(NULL == engine) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - input->hg_handle = handle; - if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, - H5VL_iod_server_dtype_close_cb, input, NULL)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if(input->parent_axe_id) { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, + 1, &input->parent_axe_id, 0, NULL, + H5VL_iod_server_dtype_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } + else { + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_id, 0, NULL, 0, NULL, + H5VL_iod_server_dtype_close_cb, op_data, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1287,17 +1620,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_file_create_input_t *input = (H5VL_iod_file_create_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + file_create_in_t *input = (file_create_in_t *)op_data->input; file_create_out_t output; unsigned int mode; iod_handle_t coh; - iod_handle_t root_handle, scratch_oh; + iod_handle_t root_oh, scratch_oh; iod_obj_id_t root_id, scratch_pad; - iod_ret_t status; + iod_ret_t ret; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -1309,78 +1644,70 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num if (input->flags&H5F_ACC_CREAT) mode |= IOD_CONT_CREATE; - status = iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/); - - if (EEXISTS != status && status == 0) { - /* create root group KV store */ - if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_KV, NULL, NULL, - &root_id, NULL /*event*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create root object"); - - ROOT_ID = root_id; - - /* create scratch pad for root group */ - if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_KV, NULL, NULL, - &scratch_pad, NULL /*event*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create scratch pad"); - - /* open the root group */ - if (iod_obj_open_write(coh, root_id, NULL /*hints*/, &root_handle, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open root object"); - - /* add the scratch pad to the root group */ - if (iod_obj_set_scratch(root_handle, IOD_TID_UNKNOWN, &scratch_pad, NULL /*cs*/, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't set scratch pad for root object"); - - /* open the scratch pad */ - if (iod_obj_open_write(coh, scratch_pad, NULL /*hints*/, &scratch_oh, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); + /* Create the Container */ + if(iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create container"); + + /* create the root group */ + ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, NULL, NULL, + &input->root_id, NULL); + if(ret >= 0 || ret == EEXISTS) { + /* root group has been created, open it */ + if (iod_obj_open_write(coh, input->root_id, NULL, &root_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + } + else { + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create root group"); } - else if (EEXISTS == status) { - /* spin trying to open the root group */ - while (1) { - if ((status = iod_obj_open_write(coh, root_id, NULL /*hints*/, &root_handle, NULL)) < 0) - continue; - else - break; - } - /* spin trying to get scratch pad for the root group */ - while (1) { - if((status = iod_obj_get_scratch(root_handle, IOD_TID_UNKNOWN, &scratch_pad, - NULL, NULL)) < 0) - continue; - else - break; - } - /* open the scratch pad */ - if (iod_obj_open_write(coh, scratch_pad, NULL /*hints*/, &scratch_oh, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); + /* create the scratch pad for the root group */ + ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, NULL, NULL, + &scratch_pad, NULL); + if(ret >= 0 || ret == EEXISTS) { + /* scratch pad has been created, set it in root group */ + if (iod_obj_set_scratch(root_oh, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); + } + else { + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create current object handle"); } - else - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create file"); + +#if 0 + /* Store Metadata in scratch pad */ + if (iod_obj_open_write(coh, input->scratch_id, NULL, &scratch_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); + if(iod_obj_close(scratch_oh, NULL, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); +#endif #if H5_DO_NATIVE coh.cookie = H5Fcreate(input->name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); HDassert(coh.cookie); - root_handle.cookie = coh.cookie; - fprintf(stderr, "Created Native file %s with ID %d\n", input->name, root_handle.cookie); + root_oh.cookie = coh.cookie; + fprintf(stderr, "Created Native file %s with ID %d\n", input->name, root_oh.cookie); #endif output.coh = coh; - output.root_id = root_id; - output.root_oh = root_handle; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; + output.root_oh = root_oh; + output.kv_oid_index = 1; + output.array_oid_index = 1; + output.blob_oid_index = 1; - fprintf(stderr, "Done with file create, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + fprintf(stderr, "Done with file create, sending response to client \n"); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + if(ret_value < 0) { + output.coh.cookie = IOD_OH_UNDEFINED; + output.root_oh.cookie = IOD_OH_UNDEFINED; + output.kv_oid_index = 0; + output.array_oid_index = 0; + output.blob_oid_index = 0; + HG_Handler_start_output(op_data->hg_handle, &ret_value); + } input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_file_create_cb() */ @@ -1400,64 +1727,79 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_file_open_input_t *input = (H5VL_iod_file_open_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + file_open_in_t *input = (file_open_in_t *)op_data->input; file_open_out_t output; unsigned int mode = input->flags; iod_handle_t coh; - iod_handle_t root_handle, scratch_oh; + iod_handle_t root_oh, scratch_oh; iod_obj_id_t scratch_pad; - iod_ret_t status; + iod_ret_t ret; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start file open %s %d %d\n", input->name, input->flags, input->fapl_id); - if((status = iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/)) < 0) + if(iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/)) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open file"); /* open the root group */ - if (iod_obj_open_write(coh, ROOT_ID, NULL /*hints*/, &root_handle, NULL) < 0) + if (iod_obj_open_write(coh, ROOT_ID, NULL /*hints*/, &root_oh, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open root object"); + /* get metadata */ +#if 0 /* get scratch pad of root group */ - if(iod_obj_get_scratch(root_handle, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) + if(iod_obj_get_scratch(root_oh, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for root object"); - /* open the scratch pad */ if (iod_obj_open_write(coh, scratch_pad, NULL /*hints*/, &scratch_oh, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); + if(iod_obj_close(scratch_oh, NULL, NULL)) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); +#endif #if H5_DO_NATIVE { - int file_id; - file_id = H5Fopen(input->name, H5F_ACC_RDWR, H5P_DEFAULT); - HDassert(file_id); - coh.cookie = file_id; - root_handle.cookie = file_id; + coh.cookie = H5Fopen(input->name, H5F_ACC_RDWR, H5P_DEFAULT); + HDassert(coh.cookie); + root_oh.cookie = coh.cookie; + fprintf(stderr, "Opened Native file %s with ID %d\n", input->name, root_oh.cookie); } #endif output.coh = coh; output.root_id = ROOT_ID; - output.root_oh = root_handle; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; + output.root_oh = root_oh; output.fcpl_id = H5P_FILE_CREATE_DEFAULT; + output.kv_oid_index = 1; + output.array_oid_index = 1; + output.blob_oid_index = 1; fprintf(stderr, "Done with file open, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + if(ret_value < 0) { + output.coh.cookie = IOD_OH_UNDEFINED; + output.root_id = IOD_ID_UNDEFINED; + output.root_oh.cookie = IOD_OH_UNDEFINED; + output.fcpl_id = H5P_FILE_CREATE_DEFAULT; + output.kv_oid_index = 0; + output.array_oid_index = 0; + output.blob_oid_index = 0; + HG_Handler_start_output(op_data->hg_handle, &output); + } input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_file_open_cb() */ @@ -1477,11 +1819,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_file_flush_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_file_flush_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_file_flush_input_t *input = (H5VL_iod_file_flush_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + file_flush_in_t *input = (file_flush_in_t *)op_data->input; iod_handle_t coh = input->coh; H5F_scope_t scope = input->scope; herr_t ret_value = SUCCEED; @@ -1496,10 +1840,12 @@ H5VL_iod_server_file_flush_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ done: fprintf(stderr, "Done with file flush, sending response to client\n"); - if(HG_SUCCESS != HG_Handler_start_output(input->hg_handle, &ret_value)) + if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value)) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't send result of file flush to client"); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_file_flush_cb() */ @@ -1518,14 +1864,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_file_close_input_t *input = (H5VL_iod_file_close_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + file_close_in_t *input = (file_close_in_t *)op_data->input; iod_handle_t coh = input->coh; iod_handle_t root_oh = input->root_oh; - iod_handle_t scratch_oh = input->scratch_oh; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -1536,8 +1883,6 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ H5Fclose(coh.cookie); #endif - if(iod_obj_close(scratch_oh, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close scratch object handle"); if(iod_obj_close(root_oh, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close root object handle"); if(iod_container_close(coh, NULL, NULL) < 0) @@ -1545,10 +1890,12 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ done: fprintf(stderr, "Done with file close, sending response to client\n"); - if(HG_SUCCESS != HG_Handler_start_output(input->hg_handle, &ret_value)) + if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value)) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't send result of file close to client"); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_file_close_cb() */ @@ -1567,47 +1914,85 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_group_create_input_t *input = (H5VL_iod_group_create_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + group_create_in_t *input = (group_create_in_t *)op_data->input; group_create_out_t output; - iod_handle_t coh = input->coh; - iod_handle_t loc_handle = input->loc_oh; + iod_handle_t coh = input->coh; /* the container handle */ + iod_handle_t loc_handle = input->loc_oh; /* The handle for current object - could be undefined */ + iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ + iod_obj_id_t grp_id = input->grp_id; /* The ID of the group that needs to be created */ + const char *name = input->name; /* path relative to loc_id and loc_oh */ iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; - const char *name = input->name; + char *last_comp; /* the name of the group obtained from traversal function */ + iod_kv_t kv; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start group create %s\n", name); - /* the traversal will count the created group as an intermediate - group and create it in the process */ - if(H5VL_iod_server_get_loc(coh, loc_handle, name, TRUE, FALSE, NULL, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the group needs + to be created. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); + /* create the group */ + if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, NULL, NULL, &grp_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create current object handle"); + + /* insert new group in kv store of parent object */ + kv.key = HDstrdup(last_comp); + kv.value = &grp_id; + kv.value_len = sizeof(iod_obj_id_t); + if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent"); + HDfree(kv.key); + + /* close parent group and its scratch pad if it is not the + location we started the traversal into */ + if(loc_handle.cookie != cur_oh.cookie) { + iod_obj_close(cur_oh, NULL, NULL); + } + + /* create scratch pad for new group */ + if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_KV, NULL, NULL, + &scratch_pad, NULL /*event*/) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); + + /* set the scratch pad in group */ + if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); + #if H5_DO_NATIVE cur_oh.cookie = H5Gcreate2(loc_handle.cookie, name, input->lcpl_id, - input->gcpl_id, input->gapl_id); + input->gcpl_id, input->gapl_id); HDassert(cur_oh.cookie); #endif - output.iod_id = cur_id; - output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; - fprintf(stderr, "Done with group create, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + + /* return the object handle for the group to the client */ + output.iod_oh = cur_oh; + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + /* return an UNDEFINED oh to the client if the operation failed */ + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + HG_Handler_start_output(op_data->hg_handle, &output); + } + + free(last_comp); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_group_create_cb() */ @@ -1627,28 +2012,50 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_group_open_input_t *input = (H5VL_iod_group_open_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + group_open_in_t *input = (group_open_in_t *)op_data->input; group_open_out_t output; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; + const char *name = input->name; + iod_obj_id_t grp_id; /* The ID of the group that needs to be opened */ iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; - const char *name = input->name; + char *last_comp; /* the name of the group obtained from traversal function */ + iod_size_t kv_size; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start group open %s\n", name); - if(H5VL_iod_server_get_loc(coh, loc_handle, name, FALSE, FALSE, NULL, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the group needs + to be created. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); + kv_size = sizeof(iod_obj_id_t); + + /* lookup group in the current location */ + if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &grp_id, &kv_size, NULL, NULL) < 0) { + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist"); + } /* end if */ + + /* open the group */ + if (iod_obj_open_write(coh, grp_id, NULL, &cur_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + #if 0 + /* When we have a real IOD, open the scratch pad and read the + group's metadata */ if(iod_kv_get_value(scratch_oh, IOD_TID_UNKNOWN, "dataset_gcpl", NULL, &output.gcpl_size, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset gcpl lookup failed"); @@ -1664,19 +2071,24 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ HDassert(cur_oh.cookie); #endif - output.iod_id = cur_id; + output.iod_id = grp_id; output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; output.gcpl_id = H5P_GROUP_CREATE_DEFAULT; fprintf(stderr, "Done with group open, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + output.iod_id = IOD_ID_UNDEFINED; + output.gcpl_id = H5P_GROUP_CREATE_DEFAULT; + HG_Handler_start_output(op_data->hg_handle, &output); + } + + free(last_comp); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_group_open_cb() */ @@ -1696,33 +2108,39 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_group_close_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_group_close_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_group_close_input_t *input = (H5VL_iod_group_close_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + group_close_in_t *input = (group_close_in_t *)op_data->input; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start group close\n"); + if(iod_oh.cookie != IOD_OH_UNDEFINED) { #if H5_DO_NATIVE - ret_value = H5Gclose(iod_oh.cookie); + ret_value = H5Gclose(iod_oh.cookie); #endif - if((ret_value = iod_obj_close(scratch_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close scratch object handle"); - if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); - + if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); + } + else { + /* need a way to kill object handle for this group */ + fprintf(stderr, "I do not have the OH of this group to close it\n"); + } done: fprintf(stderr, "Done with group close, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &ret_value); + HG_Handler_start_output(op_data->hg_handle, &ret_value); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_group_close_cb() */ @@ -1741,14 +2159,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dset_create_input_t *input = (H5VL_iod_dset_create_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dset_create_in_t *input = (dset_create_in_t *)op_data->input; dset_create_out_t output; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ + iod_obj_id_t dset_id = input->dset_id; /* The ID of the dataset that needs to be created */ iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; const char *name = input->name; @@ -1763,9 +2185,11 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num fprintf(stderr, "Start dataset Create %s\n", name); - /* traverse and break at the last component in the path, i.e. the dataset */ - if(H5VL_iod_server_get_loc(coh, loc_handle, name, TRUE, TRUE, &last_comp, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the dataset needs + to be created. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); /* Set the IOD array creation parameters */ @@ -1779,6 +2203,7 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes"); array.firstdim_max = max_dims[0]; array.chunk_dims = NULL; + /* MSC - NEED TO FIX THAT */ #if 0 if(layout.type == H5D_CHUNKED) { @@ -1794,22 +2219,21 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num /* create the dataset */ if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_ARRAY, NULL, &array, - &cur_id, NULL /*event*/) < 0) + &dset_id, NULL /*event*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create current object handle"); kv.key = HDstrdup(last_comp); - kv.value = &cur_id; + kv.value = &dset_id; kv.value_len = sizeof(iod_obj_id_t); /* insert new dataset in kv store of current group */ if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent"); HDfree(kv.key); + /* close parent group if it is not the location we started the + traversal into */ if(loc_handle.cookie != cur_oh.cookie) { - /* close parent group and its scratch pad if it is not the - location we started the traversal into */ iod_obj_close(cur_oh, NULL, NULL); - iod_obj_close(scratch_oh, NULL, NULL); } /* create scratch pad for dataset */ @@ -1818,18 +2242,18 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); /* open the dataset */ - if (iod_obj_open_write(coh, cur_id, NULL /*hints*/, &cur_oh, NULL) < 0) + if (iod_obj_open_write(coh, dset_id, NULL /*hints*/, &cur_oh, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* add the scratch pad to the dataset */ if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); +#if 0 /* open the scratch pad */ if (iod_obj_open_write(coh, scratch_pad, NULL /*hints*/, &scratch_oh, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); -#if 0 /* insert layout metadata into scratch pad */ kv.key = HDstrdup("dataset_dcpl"); /* determine the buffer size needed to store the encoded dcpl of the dataset */ @@ -1888,22 +2312,25 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num HDassert(cur_oh.cookie); #endif - output.iod_id = cur_id; output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; free(max_dims); free(array.current_dims); free(last_comp); fprintf(stderr, "Done with dset create, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + /* return an UNDEFINED oh to the client if the operation failed */ + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + HG_Handler_start_output(op_data->hg_handle, &output); + } + input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_dset_create_cb() */ @@ -1923,16 +2350,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dset_open_input_t *input = (H5VL_iod_dset_open_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dset_open_in_t *input = (dset_open_in_t *)op_data->input; dset_open_out_t output; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; + iod_obj_id_t dset_id; char *name = input->name; char *last_comp; herr_t ret_value = SUCCEED; @@ -1941,11 +2372,21 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n fprintf(stderr, "Start dataset Open %s\n", name); - /* traverse the path and open the dataset object as we do it */ - if(H5VL_iod_server_get_loc(coh, loc_handle, name, FALSE, FALSE, &last_comp, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the dataset needs + to be opened. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); + if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &dset_id, + sizeof(iod_obj_id_t) , NULL, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Array ID from parent KV store"); + + /* open the dataset */ + if (iod_obj_open_write(coh, dset_id, NULL /*hints*/, &cur_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + #if 0 /*retrieve all metadata from scratch pad */ if(iod_kv_get_value(scratch_oh, IOD_TID_UNKNOWN, "dataset_dcpl", NULL, @@ -1981,8 +2422,8 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n //hid_t space_id, type_id; #if H5_DO_NATIVE - printf("dataset name %s location %d\n", last_comp, loc_handle.cookie); - cur_oh.cookie = H5Dopen(loc_handle.cookie, last_comp, input->dapl_id); + printf("dataset name %s location %d\n", name, loc_handle.cookie); + cur_oh.cookie = H5Dopen(loc_handle.cookie, name, input->dapl_id); HDassert(cur_oh.cookie); output.space_id = H5Dget_space(cur_oh.cookie); output.type_id = H5Dget_type(cur_oh.cookie); @@ -2020,17 +2461,18 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n } - output.iod_id = cur_id; + output.iod_id = dset_id; output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; fprintf(stderr, "Done with dset open, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + output.iod_id = IOD_ID_UNDEFINED; + HG_Handler_start_output(op_data->hg_handle, &output); + } #if !H5_DO_NATIVE H5Tclose(output.type_id); @@ -2038,6 +2480,7 @@ done: #endif input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); free(last_comp); FUNC_LEAVE_NOAPI(ret_value) @@ -2058,14 +2501,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dset_io_input_t *input = (H5VL_iod_dset_io_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dset_io_in_t *input = (dset_io_in_t *)op_data->input; dset_read_out_t output; + iod_handle_t coh = input->coh; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; + iod_obj_id_t iod_id = input->iod_id; hg_bulk_t bulk_handle = input->bulk_handle; hid_t space_id = input->space_id; hid_t dxpl_id = input->dxpl_id; @@ -2075,11 +2521,21 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n size_t size; void *buf; uint32_t cs = 0; - na_addr_t dest = HG_Handler_get_addr(input->hg_handle); + na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle); herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT + /* If the dataset handle and ID are not avaiable, traverse the path to obtain it */ + if(iod_id == IOD_ID_UNDEFINED) { + ;/* traverse routine */ + } + /* open the dataset if we don't have the handle yet */ + if(iod_oh.cookie == IOD_OH_UNDEFINED) { + if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + } + size = HG_Bulk_handle_get_size(bulk_handle); fprintf(stderr, "Start dataset Read of size %d\n", size); if(NULL == (buf = malloc(size))) @@ -2132,12 +2588,13 @@ done: fprintf(stderr, "Done with dset read, sending response to client\n"); - if(HG_SUCCESS != HG_Handler_start_output(input->hg_handle, &output)) + if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &output)) HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client"); if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle)) HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle"); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); free(buf); FUNC_LEAVE_NOAPI(ret_value) @@ -2158,13 +2615,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dset_io_input_t *input = (H5VL_iod_dset_io_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dset_io_in_t *input = (dset_io_in_t *)op_data->input; + iod_handle_t coh = input->coh; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; + iod_obj_id_t iod_id = input->iod_id; hg_bulk_t bulk_handle = input->bulk_handle; hid_t space_id = input->space_id; hid_t dxpl_id = input->dxpl_id; @@ -2175,13 +2635,23 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ size_t size; void *buf; ssize_t ret; - na_addr_t source = HG_Handler_get_addr(input->hg_handle); + na_addr_t source = HG_Handler_get_addr(op_data->hg_handle); herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start dataset Write with checksum %u\n", cs); + /* If the dataset handle and ID are not avaiable, traverse the path to obtain it */ + if(iod_id == IOD_ID_UNDEFINED) { + ;/* traverse routine */ + } + /* open the dataset if we don't have the handle yet */ + if(iod_oh.cookie == IOD_OH_UNDEFINED) { + if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + } + /* Read bulk data here and wait for the data to be here */ size = HG_Bulk_handle_get_size(bulk_handle); if(NULL == (buf = malloc(size))) @@ -2226,10 +2696,11 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ done: fprintf(stderr, "Done with dset write, sending %d response to client\n", ret_value); - if(HG_SUCCESS != HG_Handler_start_output(input->hg_handle, &ret_value)) + if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value)) HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client"); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); free(buf); FUNC_LEAVE_NOAPI(ret_value) @@ -2250,12 +2721,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dset_set_extent_input_t *input = (H5VL_iod_dset_set_extent_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dset_set_extent_in_t *input = (dset_set_extent_in_t *)op_data->input; + iod_handle_t coh = input->coh; iod_handle_t iod_oh = input->iod_oh; + iod_obj_id_t iod_id = input->iod_id; int rank = input->dims.rank; herr_t ret_value = SUCCEED; @@ -2263,6 +2738,16 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED fprintf(stderr, "Start dataset Extend on the first dimension to %d\n", input->dims.size[0]); + /* If the dataset handle and ID are not avaiable, traverse the path to obtain it */ + if(iod_id == IOD_ID_UNDEFINED) { + ;/* traverse routine */ + } + /* open the dataset if we don't have the handle yet */ + if(iod_oh.cookie == IOD_OH_UNDEFINED) { + if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + } + if(iod_array_extend(iod_oh, IOD_TID_UNKNOWN, (iod_size_t)input->dims.size[0], NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't extend dataset"); @@ -2272,8 +2757,10 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED done: fprintf(stderr, "Done with dset set_extent, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &ret_value); + HG_Handler_start_output(op_data->hg_handle, &ret_value); + input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_dset_set_extent_cb() */ @@ -2293,33 +2780,41 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dset_close_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dset_close_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dset_close_input_t *input = (H5VL_iod_dset_close_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dset_close_in_t *input = (dset_close_in_t *)op_data->input; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; + iod_obj_id_t iod_id = input->iod_id; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start dataset Close\n"); + if(iod_oh.cookie != IOD_OH_UNDEFINED) { #if H5_DO_NATIVE - ret_value = H5Dclose(iod_oh.cookie); + ret_value = H5Dclose(iod_oh.cookie); #endif - if((ret_value = iod_obj_close(scratch_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close scratch object handle"); - if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); + if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); + } + else { + /* need a way to kill object handle for this group */ + fprintf(stderr, "I do not have the OH of this dataset to close it\n"); + } done: fprintf(stderr, "Done with dset close, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &ret_value); + HG_Handler_start_output(op_data->hg_handle, &ret_value); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_dset_close_cb() */ @@ -2338,14 +2833,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dtype_commit_input_t *input = (H5VL_iod_dtype_commit_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dtype_commit_in_t *input = (dtype_commit_in_t *)op_data->input; dtype_commit_out_t output; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ + iod_obj_id_t dtype_id = input->dtype_id; /* The ID of the datatype that needs to be created */ iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; const char *name = input->name; @@ -2361,43 +2860,45 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED nu fprintf(stderr, "Start datatype Commit %s\n", name); - /* traverse and break at the last component in the path, i.e. the dataset */ - if(H5VL_iod_server_get_loc(coh, loc_handle, name, TRUE, TRUE, &last_comp, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the datatype needs + to be created. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); - fprintf(stderr, "now creating the Blob object for datatype \n"); - /* create the datatype */ if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_BLOB, NULL, NULL, - &cur_id, NULL /*event*/) < 0) + &dtype_id, NULL /*event*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create current object handle"); kv.key = HDstrdup(last_comp); - kv.value = &cur_id; + kv.value = &dtype_id; kv.value_len = sizeof(iod_obj_id_t); - /* insert new datatype in kv store of current group */ + /* insert new dataset in kv store of current group */ if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent"); HDfree(kv.key); + /* close parent group and its scratch pad if it is not the + location we started the traversal into */ + if(loc_handle.cookie != cur_oh.cookie) { + iod_obj_close(cur_oh, NULL, NULL); + } + /* create scratch pad for datatype */ if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_KV, NULL, NULL, &scratch_pad, NULL /*event*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); /* open the datatype */ - if (iod_obj_open_write(coh, cur_id, NULL /*hints*/, &cur_oh, NULL) < 0) + if (iod_obj_open_write(coh, dtype_id, NULL /*hints*/, &cur_oh, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* add the scratch pad to the datatype */ if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); - /* open the scratch pad */ - if (iod_obj_open_write(coh, scratch_pad, NULL /*hints*/, &scratch_oh, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open scratch pad"); - /* determine the buffer size needed to store the encoded type of the datatype */ if(H5Tencode(input->type_id, NULL, &buf_size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype type"); @@ -2442,19 +2943,19 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED nu last_comp, cur_oh.cookie, loc_handle.cookie); #endif - output.iod_id = cur_id; output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; fprintf(stderr, "Done with dtype commit, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + HG_Handler_start_output(op_data->hg_handle, &output); + } input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); free(last_comp); free(buf); @@ -2476,17 +2977,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dtype_open_input_t *input = (H5VL_iod_dtype_open_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dtype_open_in_t *input = (dtype_open_in_t *)op_data->input; dtype_open_out_t output; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; + iod_obj_id_t dtype_id; iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; char *name = input->name; + char *last_comp; /* the name of the datatype obtained from the last component in the path */ size_t buf_size; void *buf; iod_mem_desc_t mem_desc; @@ -2497,11 +3003,21 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ fprintf(stderr, "Start datatype Open %s\n", name); - /* traverse the path and open the dataset object as we do it */ - if(H5VL_iod_server_get_loc(coh, loc_handle, name, FALSE, FALSE, NULL, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the datatype needs + to be opened. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); + if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &dtype_id, + sizeof(iod_obj_id_t) , NULL, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Array ID from parent KV store"); + + /* open the datatype */ + if (iod_obj_open_write(coh, dtype_id, NULL /*hints*/, &cur_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + /* MSC - need to read datatype; size should be stored in metadata, but since no real IOD, can't do anything now */ @@ -2542,22 +3058,27 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); #endif - output.iod_id = cur_id; + output.iod_id = dtype_id; output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; fprintf(stderr, "Done with dtype open, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + output.iod_id = IOD_ID_UNDEFINED; + HG_Handler_start_output(op_data->hg_handle, &output); + } #if !H5_DO_NATIVE H5Tclose(output.type_id); #endif + + free(last_comp); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_dtype_open_cb() */ @@ -2576,33 +3097,41 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_dtype_close_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_dtype_close_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_dtype_close_input_t *input = (H5VL_iod_dtype_close_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + dtype_close_in_t *input = (dtype_close_in_t *)op_data->input; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; + iod_obj_id_t iod_id = input->iod_id; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - fprintf(stderr, "Start datatype Close %d\n", iod_oh.cookie); + fprintf(stderr, "Start datatype Close\n"); + if(iod_oh.cookie != IOD_OH_UNDEFINED) { #if H5_DO_NATIVE - HDassert(H5Tclose(iod_oh.cookie) == SUCCEED); + HDassert(H5Tclose(iod_oh.cookie) == SUCCEED); #endif - if((ret_value = iod_obj_close(scratch_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close scratch object handle"); - if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); + if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); + } + else { + /* need a way to kill object handle for this group */ + fprintf(stderr, "I do not have the OH of this datatype to close it\n"); + } done: fprintf(stderr, "Done with dtype close, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &ret_value); + HG_Handler_start_output(op_data->hg_handle, &ret_value); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_dtype_close_cb() */ @@ -2621,14 +3150,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_attr_create_input_t *input = (H5VL_iod_attr_create_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + attr_create_in_t *input = (attr_create_in_t *)op_data->input; attr_create_out_t output; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ + iod_obj_id_t attr_id = input->attr_id; /* The ID of the attribute that needs to be created */ iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; const char *loc_name = input->path; @@ -2644,9 +3177,11 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num fprintf(stderr, "Start attribute Create %s on object path %s\n", attr_name, loc_name); - /* traverse path */ - if(H5VL_iod_server_get_loc(coh, loc_handle, loc_name, FALSE, FALSE, &last_comp, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the attribute needs + to be created. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); /* Set the IOD array creation parameters */ @@ -2662,24 +3197,23 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num array.chunk_dims = NULL; array.dims_seq = NULL; - /* create the dataset */ + /* create the attribute */ if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_ARRAY, NULL, &array, - &cur_id, NULL /*event*/) < 0) + &attr_id, NULL /*event*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create current object handle"); /* insert new attribute in scratch pad of current object */ kv.key = HDstrdup(attr_name); - kv.value = &cur_id; + kv.value = &attr_id; kv.value_len = 0; - if (iod_kv_set(scratch_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) + if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent"); HDfree(kv.key); + /* close parent group if it is not the location we started the + traversal into */ if(loc_handle.cookie != cur_oh.cookie) { - /* close parent group and its scratch pad if it is not the - location we started the traversal into */ iod_obj_close(cur_oh, NULL, NULL); - iod_obj_close(scratch_oh, NULL, NULL); } /* create scratch pad for attribute */ @@ -2688,18 +3222,18 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); /* open the attribute */ - if (iod_obj_open_write(coh, cur_id, NULL /*hints*/, &cur_oh, NULL) < 0) + if (iod_obj_open_write(coh, attr_id, NULL /*hints*/, &cur_oh, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* add the scratch pad to the attribute */ if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); +#if 0 /* open the scratch pad */ if (iod_obj_open_write(coh, scratch_pad, NULL /*hints*/, &scratch_oh, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); -#if 0 /* insert datatype metadata into scratch pad */ kv.key = HDstrdup("attribute_dtype"); /* determine the buffer size needed to store the encoded type of the attribute */ @@ -2740,21 +3274,24 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num HDassert(cur_oh.cookie); #endif - output.iod_id = cur_id; output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; free(max_dims); free(array.current_dims); fprintf(stderr, "Done with attr create, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + + /* return an UNDEFINED oh to the client if the operation failed */ + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + HG_Handler_start_output(op_data->hg_handle, &output); + } + input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); if(last_comp) free(last_comp); @@ -2776,16 +3313,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_attr_open_input_t *input = (H5VL_iod_attr_open_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + attr_open_in_t *input = (attr_open_in_t *)op_data->input; attr_open_out_t output; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; + iod_obj_id_t attr_id; const char *loc_name = input->path; const char *attr_name = input->attr_name; char *last_comp = NULL; @@ -2795,26 +3336,46 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n fprintf(stderr, "Start attribute Open %s\n", attr_name); - /* traverse the path and open the location object as we do it */ - if(H5VL_iod_server_get_loc(coh, loc_handle, loc_name, FALSE, FALSE, &last_comp, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the attribute needs + to be opened. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); - /*retrieve that attribute ID from the scratch pad and open it */ - if(iod_kv_get_value(scratch_oh, IOD_TID_UNKNOWN, attr_name, &cur_id, - sizeof(iod_obj_id_t), NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve attribute ID"); + /* get and open the scratch pad where the attribute should be */ + if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &scratch_pad, NULL, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for root object"); + if (iod_obj_open_write(coh, scratch_pad, NULL /*hints*/, &scratch_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + + /* get attribute ID from scratch pad */ + if(iod_kv_get_value(scratch_oh, IOD_TID_UNKNOWN, attr_name, &attr_id, + sizeof(iod_obj_id_t) , NULL, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Array ID from parent KV store"); + + /* close parent group if it is not the location we started the + traversal into */ + if(loc_handle.cookie != cur_oh.cookie) { + iod_obj_close(cur_oh, NULL, NULL); + iod_obj_close(scratch_oh, NULL, NULL); + } /* open the attribute */ - if (iod_obj_open_write(coh, cur_id, NULL /*hints*/, &cur_oh, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); + if (iod_obj_open_write(coh, attr_id, NULL /*hints*/, &cur_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); { hsize_t dims[1]; //hid_t space_id, type_id; #if H5_DO_NATIVE - cur_oh.cookie = H5Aopen(loc_handle.cookie, attr_name, H5P_DEFAULT); + printf("attr name %s location %d %s\n", attr_name, loc_handle.cookie, loc_name); + if(strcmp(loc_name, ".") == 0) + cur_oh.cookie = H5Aopen(loc_handle.cookie, attr_name, H5P_DEFAULT); + else + cur_oh.cookie = H5Aopen_by_name(loc_handle.cookie, loc_name, + attr_name, H5P_DEFAULT, H5P_DEFAULT); HDassert(cur_oh.cookie); output.space_id = H5Aget_space(cur_oh.cookie); output.type_id = H5Aget_type(cur_oh.cookie); @@ -2828,17 +3389,18 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n #endif } - output.iod_id = cur_id; + output.iod_id = attr_id; output.iod_oh = cur_oh; - output.scratch_id = scratch_pad; - output.scratch_oh = scratch_oh; fprintf(stderr, "Done with attr open, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &output); + HG_Handler_start_output(op_data->hg_handle, &output); done: - if(ret_value < 0) - HG_Handler_start_output(input->hg_handle, &ret_value); + if(ret_value < 0) { + output.iod_oh.cookie = IOD_OH_UNDEFINED; + output.iod_id = IOD_ID_UNDEFINED; + HG_Handler_start_output(op_data->hg_handle, &output); + } #if !H5_DO_NATIVE H5Sclose(output.space_id); @@ -2846,6 +3408,7 @@ done: #endif input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); if(last_comp) free(last_comp); @@ -2867,13 +3430,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) +H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_attr_io_input_t *input = (H5VL_iod_attr_io_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + attr_io_in_t *input = (attr_io_in_t *)op_data->input; + iod_handle_t coh = input->coh; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; + iod_obj_id_t iod_id = input->iod_id; hg_bulk_t bulk_handle = input->bulk_handle; hid_t type_id = input->type_id; hg_bulk_block_t bulk_block_handle; @@ -2881,11 +3447,21 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n iod_array_iodesc_t file_desc; size_t size; void *buf; - na_addr_t dest = HG_Handler_get_addr(input->hg_handle); + na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle); herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT + /* If the attribute handle and ID are not avaiable, traverse the path to obtain it */ + if(iod_id == IOD_ID_UNDEFINED) { + ;/* traverse routine */ + } + /* open the attribute if we don't have the handle yet */ + if(iod_oh.cookie == IOD_OH_UNDEFINED) { + if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + } + size = HG_Bulk_handle_get_size(bulk_handle); fprintf(stderr, "Start attribute Read of size %d\n", size); if(NULL == (buf = malloc(size))) @@ -2927,12 +3503,13 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, size_t UNUSED num_n done: fprintf(stderr, "Done with attr read, sending response to client\n"); - if(HG_SUCCESS != HG_Handler_start_output(input->hg_handle, &ret_value)) + if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value)) HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client"); if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle)) HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle"); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); free(buf); FUNC_LEAVE_NOAPI(ret_value) @@ -2954,13 +3531,15 @@ done: */ static herr_t H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, - size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_attr_io_input_t *input = (H5VL_iod_attr_io_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + attr_io_in_t *input = (attr_io_in_t *)op_data->input; + iod_handle_t coh = input->coh; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; + iod_obj_id_t iod_id = input->iod_id; hg_bulk_t bulk_handle = input->bulk_handle; hid_t type_id = input->type_id; hg_bulk_block_t bulk_block_handle; @@ -2969,13 +3548,23 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, size_t size; void *buf; ssize_t ret; - na_addr_t source = HG_Handler_get_addr(input->hg_handle); + na_addr_t source = HG_Handler_get_addr(op_data->hg_handle); herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start attribute Write\n"); + /* If the attribute handle and ID are not avaiable, traverse the path to obtain it */ + if(iod_id == IOD_ID_UNDEFINED) { + ;/* traverse routine */ + } + /* open the attribute if we don't have the handle yet */ + if(iod_oh.cookie == IOD_OH_UNDEFINED) { + if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + } + /* Read bulk data here and wait for the data to be here */ size = HG_Bulk_handle_get_size(bulk_handle); if(NULL == (buf = malloc(size))) @@ -3020,10 +3609,11 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, done: fprintf(stderr, "Done with attr write, sending %d response to client\n", ret_value); - if(HG_SUCCESS != HG_Handler_start_output(input->hg_handle, &ret_value)) + if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value)) HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client"); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); free(buf); FUNC_LEAVE_NOAPI(ret_value) @@ -3045,13 +3635,15 @@ done: */ static herr_t H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, - size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_attr_op_input_t *input = (H5VL_iod_attr_op_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + attr_op_in_t *input = (attr_op_in_t *)op_data->input; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; const char *loc_name = input->path; @@ -3064,9 +3656,11 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Start attribute Exists %s\n", attr_name); - /* traverse the path and open the dataset object as we do it */ - if(H5VL_iod_server_get_loc(coh, loc_handle, loc_name, FALSE, FALSE, &last_comp, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the dataset needs + to be opened. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); /*MSC - check the attribute in the scratch pad KV store when it is @@ -3080,9 +3674,10 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, done: fprintf(stderr, "Done with attr exists, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &ret); + HG_Handler_start_output(op_data->hg_handle, &ret); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); if(last_comp) free(last_comp); @@ -3105,13 +3700,15 @@ done: */ static herr_t H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, - size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_attr_op_input_t *input = (H5VL_iod_attr_op_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + attr_op_in_t *input = (attr_op_in_t *)op_data->input; iod_handle_t coh = input->coh; iod_handle_t loc_handle = input->loc_oh; + iod_obj_id_t loc_id = input->loc_id; iod_handle_t cur_oh, scratch_oh; iod_obj_id_t cur_id, scratch_pad; const char *loc_name = input->path; @@ -3123,9 +3720,11 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Start attribute Remove %s\n", attr_name); - /* traverse the path and open the dataset object as we do it */ - if(H5VL_iod_server_get_loc(coh, loc_handle, loc_name, FALSE, FALSE, &last_comp, - &cur_id, &cur_oh, &scratch_pad, &scratch_oh) < 0) + /* the traversal will retrieve the location where the dataset needs + to be opened. The traversal will fail if an intermediate group + does not exist. */ + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE, + &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); /*MSC - Remove the attribute from the scratch pad KV store when it @@ -3137,9 +3736,10 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, done: fprintf(stderr, "Done with attr remove, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &ret_value); + HG_Handler_start_output(op_data->hg_handle, &ret_value); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); if(last_comp) free(last_comp); @@ -3162,45 +3762,50 @@ done: */ static herr_t H5VL_iod_server_attr_close_cb(AXE_engine_t UNUSED axe_engine, - size_t UNUSED num_necessary_parents, AXE_task_t UNUSED necessary_parents[], - size_t UNUSED num_sufficient_parents, AXE_task_t UNUSED sufficient_parents[], - void *op_data) + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) { - H5VL_iod_attr_close_input_t *input = (H5VL_iod_attr_close_input_t *)op_data; + op_data_t *op_data = (op_data_t *)_op_data; + attr_close_in_t *input = (attr_close_in_t *)op_data->input; iod_handle_t iod_oh = input->iod_oh; - iod_handle_t scratch_oh = input->scratch_oh; + iod_obj_id_t iod_id = input->iod_id; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT fprintf(stderr, "Start attribute Close\n"); + if(iod_oh.cookie != IOD_OH_UNDEFINED) { #if H5_DO_NATIVE - HDassert(H5Aclose(iod_oh.cookie) == SUCCEED); + HDassert(H5Aclose(iod_oh.cookie) == SUCCEED); #endif - - if((ret_value = iod_obj_close(scratch_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close scratch object handle"); - if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); + if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle"); + } + else { + /* need a way to kill object handle for this group */ + fprintf(stderr, "I do not have the OH of this dataset to close it\n"); + } done: fprintf(stderr, "Done with attr close, sending response to client\n"); - HG_Handler_start_output(input->hg_handle, &ret_value); + HG_Handler_start_output(op_data->hg_handle, &ret_value); input = H5MM_xfree(input); + op_data = H5MM_xfree(op_data); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_attr_close_cb() */ static herr_t -H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *path, - hbool_t create_interm_grps, hbool_t break_on_last_comp, - char **last_comp, iod_obj_id_t *iod_id, iod_handle_t *iod_oh, - iod_obj_id_t *scratch_id, iod_handle_t *scratch_oh) +H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handle_t loc_handle, + const char *path, hbool_t create_interm_grps, + char **last_comp, iod_obj_id_t *iod_id, iod_handle_t *iod_oh) { char comp_buf[1024]; /* Temporary buffer for path components */ - char *comp; /* Pointer to buffer for path components */ - H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */ + char *comp; /* Pointer to buffer for path components */ + H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */ size_t nchars; /* component name length */ iod_handle_t cur_oh, prev_oh; iod_obj_id_t cur_id; @@ -3210,6 +3815,12 @@ H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *p cur_oh = loc_handle; + if(cur_oh.cookie == IOD_OH_UNDEFINED) { + /* open the current group */ + if (iod_obj_open_write(coh, loc_id, NULL /*hints*/, &cur_oh, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); + } + /* Wrap the local buffer for serialized header info */ if(NULL == (wb = H5WB_wrap(comp_buf, sizeof(comp_buf)))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer") @@ -3222,10 +3833,7 @@ H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *p const char *s; /* Temporary string pointer */ iod_size_t kv_size; - /* - * Copy the component path into a null-terminated buffer so - * we can pass it down to the other symbol table functions. - */ + /* Copy the component path into a null-terminated buffer. */ HDmemcpy(comp, path, nchars); comp[nchars] = '\0'; @@ -3241,8 +3849,7 @@ H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *p if(!((s = H5G__component(path + nchars, NULL)) && *s)) { if(last_comp) *last_comp = HDstrdup(comp); - if(break_on_last_comp) - break; + break; } kv_size = sizeof(iod_obj_id_t); @@ -3250,47 +3857,8 @@ H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *p prev_oh = cur_oh; /* lookup next object in the current group */ - if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, comp, &cur_id, - &kv_size, NULL, NULL) < 0) { - if(create_interm_grps) { - iod_kv_t kv; - - fprintf(stderr, "creating intermediate group %s\n",comp); - - /* create the current group */ - if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_KV, NULL, NULL, - &cur_id, NULL /*event*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create current object handle"); - - /* insert new object in kv store of current object */ - kv.key = HDstrdup(comp); - kv.value = &cur_id; - kv.value_len = sizeof(iod_obj_id_t); - if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");; - HDfree(kv.key); - - /* create scratch pad for current group */ - if (iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_KV, NULL, NULL, - scratch_id, NULL /*event*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); - - /* Close previous handle unless it is the original one */ - if(loc_handle.cookie != prev_oh.cookie && - iod_obj_close(prev_oh, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); - - /* open the current group */ - if (iod_obj_open_write(coh, cur_id, NULL /*hints*/, &cur_oh, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); - - /* add the scratch pad to the current group */ - if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, scratch_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); - } - else { - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "group does not exist"); - } + if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, comp, &cur_id, &kv_size, NULL, NULL) < 0) { + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist"); } /* end if */ else { /* Close previous handle unless it is the original one */ @@ -3307,17 +3875,9 @@ H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *p path += nchars; } /* end while */ - /* get scratch pad of current location */ - if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, scratch_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for root object"); - - /* open the scratch pad */ - if (iod_obj_open_write(coh, *scratch_id, NULL /*hints*/, scratch_oh, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); - /* Release temporary component buffer */ if(wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't release wrapped buffer"); + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't release wrapped buffer"); *iod_id = cur_id; *iod_oh = cur_oh; @@ -3325,4 +3885,5 @@ H5VL_iod_server_get_loc(iod_handle_t coh, iod_handle_t loc_handle, const char *p done: FUNC_LEAVE_NOAPI(ret_value) } + #endif /* H5_HAVE_EFF */ diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h index 04235f6..9515b3a 100644 --- a/src/H5VLiod_server.h +++ b/src/H5VLiod_server.h @@ -23,224 +23,10 @@ #ifdef H5_HAVE_EFF -typedef struct H5VL_iod_file_create_input_t { - /* Do NOT change the order of the parameters */ - const char *name; - unsigned flags; - hid_t fapl_id; - hid_t fcpl_id; - AXE_task_t axe_id; +typedef struct op_data_t { + void *input; hg_handle_t hg_handle; -} H5VL_iod_file_create_input_t; - -typedef struct H5VL_iod_file_open_input_t { - /* Do NOT change the order of the parameters */ - const char *name; - unsigned flags; - hid_t fapl_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_file_open_input_t; - -typedef struct H5VL_iod_file_flush_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - H5F_scope_t scope; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_file_flush_input_t; - -typedef struct H5VL_iod_file_close_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t root_oh; - iod_obj_id_t root_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_file_close_input_t; - -typedef struct H5VL_iod_attr_create_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *path; - const char *attr_name; - hid_t acpl_id; - hid_t type_id; - hid_t space_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_attr_create_input_t; - -typedef struct H5VL_iod_attr_open_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *path; - const char *attr_name; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_attr_open_input_t; - -typedef struct H5VL_iod_attr_io_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t iod_oh; - iod_handle_t scratch_oh; - hid_t type_id; - hg_bulk_t bulk_handle; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_attr_io_input_t; - -typedef struct H5VL_iod_attr_op_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *path; - const char *attr_name; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_attr_op_input_t; - -typedef struct H5VL_iod_attr_close_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t iod_oh; - iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_attr_close_input_t; - -typedef struct H5VL_iod_group_create_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *name; - hid_t gapl_id; - hid_t gcpl_id; - hid_t lcpl_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_group_create_input_t; - -typedef struct H5VL_iod_group_open_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *name; - hid_t gapl_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_group_open_input_t; - -typedef struct H5VL_iod_group_close_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t iod_oh; - iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_group_close_input_t; - -typedef struct H5VL_iod_dset_create_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *name; - hid_t dapl_id; - hid_t dcpl_id; - hid_t lcpl_id; - hid_t type_id; - hid_t space_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dset_create_input_t; - -typedef struct H5VL_iod_dset_open_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *name; - hid_t dapl_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dset_open_input_t; - -typedef struct H5VL_iod_dset_io_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t iod_oh; - iod_handle_t scratch_oh; - hid_t space_id; - hid_t dxpl_id; - uint32_t checksum; - hg_bulk_t bulk_handle; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dset_io_input_t; - -typedef struct H5VL_iod_dset_set_extent_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t iod_oh; - struct dims_t dims; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dset_set_extent_input_t; - -typedef struct H5VL_iod_dset_close_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t iod_oh; - iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dset_close_input_t; - -typedef struct H5VL_iod_dtype_commit_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *name; - hid_t tapl_id; - hid_t tcpl_id; - hid_t lcpl_id; - hid_t type_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dtype_commit_input_t; - -typedef struct H5VL_iod_dtype_open_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t coh; - iod_handle_t loc_oh; - iod_obj_id_t loc_id; - const char *name; - hid_t tapl_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dtype_open_input_t; - -typedef struct H5VL_iod_dtype_close_input_t { - /* Do NOT change the order of the parameters */ - iod_handle_t iod_oh; - iod_obj_id_t iod_id; - iod_handle_t scratch_oh; - iod_obj_id_t scratch_id; - AXE_task_t axe_id; - hg_handle_t hg_handle; -} H5VL_iod_dtype_close_input_t; +} op_data_t; H5_DLL int H5VL_iod_server_eff_init(hg_handle_t handle); H5_DLL int H5VL_iod_server_eff_finalize(hg_handle_t handle); @@ -267,6 +53,7 @@ H5_DLL int H5VL_iod_server_dset_close(hg_handle_t handle); H5_DLL int H5VL_iod_server_dtype_commit(hg_handle_t handle); H5_DLL int H5VL_iod_server_dtype_open(hg_handle_t handle); H5_DLL int H5VL_iod_server_dtype_close(hg_handle_t handle); +H5_DLL int H5VL_iod_server_cancel_op(hg_handle_t handle); #endif /* H5_HAVE_EFF */ #endif /* _H5VLiod_server_H */ |