From 5f6d336144b6af368373e80038488e860b28cb7b Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 10 Sep 2013 18:02:03 -0500 Subject: [svn-r24122] more transactions/read contexts - include 2 examples for using transactions - IOD calls at server side still need to be updated --- examples/Makefile.am | 3 +- examples/Makefile.in | 3 +- examples/h5ff_client_attr.c | 311 +++++ examples/h5ff_client_dset.c | 294 +++++ examples/h5ff_client_trans.c | 19 +- src/H5FF.c | 472 +++++-- src/H5FFprivate.h | 3 +- src/H5FFpublic.h | 1 - src/H5M.c | 56 +- src/H5Pdxpl.c | 13 + src/H5RC.c | 90 +- src/H5RCprivate.h | 11 + src/H5RCpublic.h | 1 + src/H5TR.c | 97 +- src/H5TRprivate.h | 3 +- src/H5VLiod.c | 2904 ++++++++++++++++++++++-------------------- src/H5VLiod_attr.c | 11 + src/H5VLiod_client.c | 502 ++++---- src/H5VLiod_client.h | 53 +- src/H5VLiod_common.h | 32 +- src/H5VLiod_dset.c | 9 + src/H5VLiod_dtype.c | 3 + src/H5VLiod_file.c | 61 +- src/H5VLiod_group.c | 3 + src/H5VLiod_link.c | 9 + src/H5VLiod_map.c | 12 +- src/H5VLiod_obj.c | 8 + src/H5VLiod_server.c | 54 - src/H5VLiod_server.h | 5 - src/H5VLiod_trans.c | 34 + 30 files changed, 3204 insertions(+), 1873 deletions(-) create mode 100644 examples/h5ff_client_attr.c create mode 100644 examples/h5ff_client_dset.c diff --git a/examples/Makefile.am b/examples/Makefile.am index 7fb18ab..16e3941 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -31,7 +31,8 @@ if BUILD_EFF_CONDITIONAL INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/test LDADD = $(LIBH5TEST) $(LIBHDF5) $(MYAXE_LIBS) $(MYIOD_LIBS) EXAMPLE_PROG_EFF = h5ff_server h5ff_client h5ff_client_map h5ff_client_do \ - h5ff_client_old_api h5ff_client_multiple_cont h5ff_client_trans + h5ff_client_old_api h5ff_client_multiple_cont h5ff_client_trans \ + h5ff_client_dset h5ff_client_attr endif # Example programs. diff --git a/examples/Makefile.in b/examples/Makefile.in index dc56c93..2d57482 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -402,7 +402,8 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog $(EXTLINK_DIRS) *.h5 @BUILD_PARALLEL_CONDITIONAL_TRUE@LDADD = $(LIBH5TEST) $(LIBHDF5) @BUILD_PARALLEL_CONDITIONAL_TRUE@EXAMPLE_PROG_PARA = ph5example @BUILD_EFF_CONDITIONAL_TRUE@EXAMPLE_PROG_EFF = h5ff_server h5ff_client h5ff_client_map h5ff_client_do \ -@BUILD_EFF_CONDITIONAL_TRUE@ h5ff_client_old_api h5ff_client_multiple_cont h5ff_client_trans +@BUILD_EFF_CONDITIONAL_TRUE@ h5ff_client_old_api h5ff_client_multiple_cont h5ff_client_trans \ +@BUILD_EFF_CONDITIONAL_TRUE@ h5ff_client_dset h5ff_client_attr # Example programs. diff --git a/examples/h5ff_client_attr.c b/examples/h5ff_client_attr.c new file mode 100644 index 0000000..bf9037f --- /dev/null +++ b/examples/h5ff_client_attr.c @@ -0,0 +1,311 @@ +/* + * h5ff_client_attr.c: Client side test for attribute routines. + */ + +#include +#include +#include +#include +#include "mpi.h" +#include "hdf5.h" + +int main(int argc, char **argv) { + const char file_name[]="eff_file.h5"; + + hid_t file_id; + hid_t gid1; + hid_t sid, dtid; + hid_t did1; + hid_t aid1, aid2, aid3, aid4; + hid_t tid1, tid2, rid1, rid2; + hid_t fapl_id, trspl_id; + hid_t event_q; + hbool_t exists1; + hbool_t exists2; + + uint64_t version; + uint64_t trans_num; + + int *wdata1 = NULL, *wdata2 = NULL; + int *rdata1 = NULL, *rdata2 = NULL; + const unsigned int nelem=60; + hsize_t dims[1]; + + int my_rank, my_size; + int provided; + MPI_Request mpi_req; + + H5_status_t *status = NULL; + int num_requests = 0; + H5_request_t req1; + H5_status_t status1; + unsigned int i = 0; + herr_t ret; + + MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); + if(MPI_THREAD_MULTIPLE != provided) { + fprintf(stderr, "MPI does not have MPI_THREAD_MULTIPLE support\n"); + exit(1); + } + + /* Call EFF_init to initialize the EFF stack. */ + EFF_init(MPI_COMM_WORLD, MPI_INFO_NULL); + + MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); + MPI_Comm_size(MPI_COMM_WORLD, &my_size); + fprintf(stderr, "APP processes = %d, my rank is %d\n", my_size, my_rank); + + /* Choose the IOD VOL plugin to use with this file. */ + fapl_id = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_fapl_iod(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL); + + /* allocate and initialize arrays for dataset I/O */ + wdata1 = malloc (sizeof(int32_t)*nelem); + wdata2 = malloc (sizeof(int32_t)*nelem); + rdata1 = malloc (sizeof(int32_t)*nelem); + rdata2 = malloc (sizeof(int32_t)*nelem); + for(i=0;i 0); + + /* create 1-D dataspace with 60 elements */ + dims [0] = nelem; + sid = H5Screate_simple(1, dims, NULL); + + dtid = H5Tcopy(H5T_STD_I32LE); + + /* acquire container version 0 - EXACT */ + version = 0; + rid1 = H5RCacquire(file_id, &version, H5P_DEFAULT, H5_EVENT_QUEUE_NULL); + assert(0 == version); + + /* create transaction object */ + tid1 = H5TRcreate(file_id, rid1, (uint64_t)1); + assert(tid1); + + /* start transaction 1 with default num_peers (= 0). + This is asynchronous. */ + if(0 == my_rank) { + ret = H5TRstart(tid1, H5P_DEFAULT, H5_EVENT_QUEUE_NULL); + assert(0 == ret); + } + + /* Tell other procs that transaction 1 is started */ + trans_num = 1; + MPI_Ibcast(&trans_num, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD, &mpi_req); + + /* Process 0 can continue writing to transaction 1, + while others wait for the bcast to complete */ + if(0 != my_rank) + MPI_Wait(&mpi_req, MPI_STATUS_IGNORE); + + /* create group /G1 */ + gid1 = H5Gcreate_ff(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(gid1 > 0); + + /* create dataset /G1/D1 */ + did1 = H5Dcreate_ff(gid1, "D1", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(did1 > 0); + + /* Commit the datatype dtid to the file. */ + ret = H5Tcommit_ff(file_id, "DT1", dtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, + tid1, event_q); + assert(ret == 0); + + /* create an attribute on root group */ + aid1 = H5Acreate_ff(file_id, "ROOT_ATTR", dtid, sid, + H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(aid1); + + /* create an attribute on group G1. */ + aid2 = H5Acreate_ff(gid1, "GROUP_ATTR", dtid, sid, + H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(aid2); + + /* write data to attributes */ + ret = H5Awrite_ff(aid1, dtid, wdata1, tid1, event_q); + assert(ret == 0); + ret = H5Awrite_ff(aid2, dtid, wdata2, tid1, event_q); + assert(ret == 0); + + /* Barrier to make sure all processes are done writing so Process + 0 can finish transaction 1 and acquire a read context on it. */ + MPI_Barrier(MPI_COMM_WORLD); + + if(0 == my_rank) { + MPI_Wait(&mpi_req, MPI_STATUS_IGNORE); + + ret = H5TRfinish(tid1, H5P_DEFAULT, &rid2, H5_EVENT_QUEUE_NULL); + assert(0 == ret); + } + + /* another barrier so other processes know that container version is acquried */ + MPI_Barrier(MPI_COMM_WORLD); + + /* Local op */ + ret = H5TRclose(tid1); + assert(0 == ret); + + /* close attribute objects */ + ret = H5Aclose_ff(aid1, event_q); + assert(ret == 0); + ret = H5Aclose_ff(aid2, event_q); + assert(ret == 0); + + /* release container version 0. This is async. */ + ret = H5RCrelease(rid1, event_q); + assert(0 == ret); + + H5EQwait(event_q, &num_requests, &status); + printf("%d requests in event queue. Completions: ", num_requests); + for(i=0 ; i 0); + } + + ret = H5Aexists_ff(file_id, "ROOT_ATTR", &exists1, rid2, event_q); + assert(ret == 0); + ret = H5Aexists_by_name_ff(file_id, "G1", "GROUP_ATTR", H5P_DEFAULT, &exists2, rid2, event_q); + assert(ret == 0); + + aid1 = H5Aopen_ff(file_id, "ROOT_ATTR", H5P_DEFAULT, rid2, event_q); + aid2 = H5Aopen_ff(gid1, "GROUP_ATTR", H5P_DEFAULT, rid2, event_q); + + /* read data from datasets with read version 1. */ + ret = H5Aread_ff(aid1, dtid, rdata1, rid2, event_q); + assert(ret == 0); + ret = H5Aread_ff(aid2, dtid, rdata2, rid2, event_q); + assert(ret == 0); + + /* close attribute objects */ + ret = H5Aclose_ff(aid1, event_q); + assert(ret == 0); + ret = H5Aclose_ff(aid2, event_q); + assert(ret == 0); + + /* create & start transaction 2 with num_peers = n */ + tid2 = H5TRcreate(file_id, rid2, (uint64_t)2); + assert(tid2); + trspl_id = H5Pcreate (H5P_TR_START); + ret = H5Pset_trspl_num_peers(trspl_id, my_size); + assert(0 == ret); + ret = H5TRstart(tid2, trspl_id, event_q); + assert(0 == ret); + ret = H5Pclose(trspl_id); + assert(0 == ret); + + /* Delete an attribute */ + ret = H5Adelete_ff(file_id, "ROOT_ATTR", tid2, event_q); + assert(ret == 0); + + /* rename an attribute */ + ret = H5Arename_ff(gid1, "GROUP_ATTR", "RENAMED_GROUP_ATTR", tid2, event_q); + assert(ret == 0); + + /* create an attribute on dataset */ + aid3 = H5Acreate_ff(did1, "DSET_ATTR", dtid, sid, + H5P_DEFAULT, H5P_DEFAULT, tid2, event_q); + assert(aid1); + + /* create an attribute on datatype */ + aid4 = H5Acreate_ff(dtid, "DTYPE_ATTR", dtid, sid, + H5P_DEFAULT, H5P_DEFAULT, tid2, event_q); + assert(aid2); + + /* finish transaction 2 */ + ret = H5TRfinish(tid2, H5P_DEFAULT, NULL, event_q); + assert(0 == ret); + + /* release container version 1. This is async. */ + ret = H5RCrelease(rid2, event_q); + assert(0 == ret); + + /* close objects */ + ret = H5Aclose_ff(aid3, event_q); + assert(ret == 0); + ret = H5Aclose_ff(aid4, event_q); + assert(ret == 0); + ret = H5Dclose_ff(did1, event_q); + assert(ret == 0); + ret = H5Gclose_ff(gid1, event_q); + assert(ret == 0); + + ret = H5Sclose(sid); + assert(ret == 0); + ret = H5Tclose(dtid); + assert(ret == 0); + ret = H5Pclose(fapl_id); + assert(ret == 0); + + H5Fclose_ff(file_id, event_q); + + H5EQwait(event_q, &num_requests, &status); + printf("%d requests in event queue. Completions: ", num_requests); + for(i=0 ; i +#include +#include +#include +#include "mpi.h" +#include "hdf5.h" + +int main(int argc, char **argv) { + const char file_name[]="eff_file.h5"; + + hid_t file_id; + hid_t gid1, gid2, gid3; + hid_t sid, dtid; + hid_t did1, did2, did3; + hid_t tid1, tid2, rid1, rid2; + hid_t fapl_id, trspl_id; + hid_t event_q; + + uint64_t version; + uint64_t trans_num; + + int *wdata1 = NULL, *wdata2 = NULL, *wdata3 = NULL; + int *rdata1 = NULL, *rdata2 = NULL, *rdata3 = NULL; + const unsigned int nelem=60; + hsize_t dims[1]; + hsize_t extent; + + int my_rank, my_size; + int provided; + MPI_Request mpi_req; + + H5_status_t *status = NULL; + int num_requests = 0; + H5_request_t req1; + H5_status_t status1; + unsigned int i = 0; + herr_t ret; + + MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); + if(MPI_THREAD_MULTIPLE != provided) { + fprintf(stderr, "MPI does not have MPI_THREAD_MULTIPLE support\n"); + exit(1); + } + + /* Call EFF_init to initialize the EFF stack. */ + EFF_init(MPI_COMM_WORLD, MPI_INFO_NULL); + + MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); + MPI_Comm_size(MPI_COMM_WORLD, &my_size); + fprintf(stderr, "APP processes = %d, my rank is %d\n", my_size, my_rank); + + /* Choose the IOD VOL plugin to use with this file. */ + fapl_id = H5Pcreate (H5P_FILE_ACCESS); + H5Pset_fapl_iod(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL); + + /* allocate and initialize arrays for dataset I/O */ + wdata1 = malloc (sizeof(int32_t)*nelem); + wdata2 = malloc (sizeof(int32_t)*nelem); + wdata3 = malloc (sizeof(int32_t)*nelem); + rdata1 = malloc (sizeof(int32_t)*nelem); + rdata2 = malloc (sizeof(int32_t)*nelem); + rdata3 = malloc (sizeof(int32_t)*nelem); + for(i=0;i 0); + + /* create 1-D dataspace with 60 elements */ + dims [0] = nelem; + sid = H5Screate_simple(1, dims, NULL); + + dtid = H5Tcopy(H5T_STD_I32LE); + + /* acquire container version 0 - EXACT */ + version = 0; + rid1 = H5RCacquire(file_id, &version, H5P_DEFAULT, H5_EVENT_QUEUE_NULL); + assert(0 == version); + + /* create transaction object */ + tid1 = H5TRcreate(file_id, rid1, (uint64_t)1); + assert(tid1); + + /* start transaction 1 with default num_peers (= 0). */ + if(0 == my_rank) { + ret = H5TRstart(tid1, H5P_DEFAULT, H5_EVENT_QUEUE_NULL); + assert(0 == ret); + } + + /* Tell other procs that transaction 1 is started */ + trans_num = 1; + MPI_Ibcast(&trans_num, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD, &mpi_req); + + /* Process 0 can continue writing to transaction 1, + while others wait for the bcast to complete */ + if(0 != my_rank) + MPI_Wait(&mpi_req, MPI_STATUS_IGNORE); + + /* create group hierarchy /G1/G2/G3 */ + gid1 = H5Gcreate_ff(file_id, "G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(gid1 > 0); + gid2 = H5Gcreate_ff(gid1, "G2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(gid2 > 0); + gid3 = H5Gcreate_ff(gid2, "G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(gid3 > 0); + + /* create datasets */ + did1 = H5Dcreate_ff(gid1, "D1", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(did1 > 0); + did2 = H5Dcreate_ff(gid2, "D2", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(did2 > 0); + did3 = H5Dcreate_ff(gid3, "D3", dtid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT, tid1, event_q); + assert(did3 > 0); + + /* write data to datasets */ + ret = H5Dwrite_ff(did1, dtid, sid, sid, H5P_DEFAULT, wdata1, tid1, event_q); + assert(ret == 0); + ret = H5Dwrite_ff(did2, dtid, sid, sid, H5P_DEFAULT, wdata2, tid1, event_q); + assert(ret == 0); + ret = H5Dwrite_ff(did3, dtid, sid, sid, H5P_DEFAULT, wdata3, tid1, event_q); + assert(ret == 0); + + /* Barrier to make sure all processes are done writing so Process + 0 can finish transaction 1 and acquire a read context on it. */ + MPI_Barrier(MPI_COMM_WORLD); + + if(0 == my_rank) { + MPI_Wait(&mpi_req, MPI_STATUS_IGNORE); + + /* make this synchronous so we know the container version has been acquired */ + ret = H5TRfinish(tid1, H5P_DEFAULT, &rid2, H5_EVENT_QUEUE_NULL); + assert(0 == ret); + } + + /* another barrier so other processes know that container version is acquried */ + MPI_Barrier(MPI_COMM_WORLD); + + /* Local op */ + ret = H5TRclose(tid1); + assert(0 == ret); + + /* close some objects */ + ret = H5Dclose_ff(did1, event_q); + assert(ret == 0); + ret = H5Gclose_ff(gid1, event_q); + assert(ret == 0); + + /* release container version 0. This is async. */ + ret = H5RCrelease(rid1, event_q); + assert(0 == ret); + + H5EQwait(event_q, &num_requests, &status); + printf("%d requests in event queue. Completions: ", num_requests); + for(i=0 ; i 0); + } + + /* Open objects closed before */ + gid1 = H5Gopen_ff(file_id, "G1", H5P_DEFAULT, rid2, event_q); + did1 = H5Dopen_ff(file_id, "G1/D1", H5P_DEFAULT, rid2, event_q); + + /* read data from datasets with read version 1. */ + ret = H5Dread_ff(did1, dtid, sid, sid, H5P_DEFAULT, rdata1, rid2, event_q); + assert(ret == 0); + ret = H5Dread_ff(did2, dtid, sid, sid, H5P_DEFAULT, rdata2, rid2, event_q); + assert(ret == 0); + ret = H5Dread_ff(did3, dtid, sid, sid, H5P_DEFAULT, rdata3, rid2, event_q); + assert(ret == 0); + + /* create & start transaction 2 with num_peers = n */ + tid2 = H5TRcreate(file_id, rid2, (uint64_t)2); + assert(tid2); + trspl_id = H5Pcreate (H5P_TR_START); + ret = H5Pset_trspl_num_peers(trspl_id, my_size); + assert(0 == ret); + ret = H5TRstart(tid2, trspl_id, event_q); + assert(0 == ret); + ret = H5Pclose(trspl_id); + assert(0 == ret); + + extent = 10; + ret = H5Dset_extent_ff(did1, &extent, tid2, event_q); + assert(ret == 0); + + extent = 30; + ret = H5Dset_extent_ff(did2, &extent, tid2, event_q); + assert(ret == 0); + + extent = 60; + ret = H5Dset_extent_ff(did3, &extent, tid2, event_q); + assert(ret == 0); + + /* finish transaction 2 */ + ret = H5TRfinish(tid2, H5P_DEFAULT, NULL, event_q); + assert(0 == ret); + + /* release container version 1. This is async. */ + ret = H5RCrelease(rid2, event_q); + assert(0 == ret); + + /* close objects */ + ret = H5Dclose_ff(did1, event_q); + assert(ret == 0); + ret = H5Dclose_ff(did2, event_q); + assert(ret == 0); + ret = H5Dclose_ff(did3, event_q); + assert(ret == 0); + ret = H5Gclose_ff(gid1, event_q); + assert(ret == 0); + ret = H5Gclose_ff(gid2, event_q); + assert(ret == 0); + ret = H5Gclose_ff(gid3, event_q); + assert(ret == 0); + + ret = H5Sclose(sid); + assert(ret == 0); + ret = H5Tclose(dtid); + assert(ret == 0); + ret = H5Pclose(fapl_id); + assert(ret == 0); + + H5Fclose_ff(file_id, event_q); + + H5EQwait(event_q, &num_requests, &status); + printf("%d requests in event queue. Completions: ", num_requests); + for(i=0 ; inrefs ++; if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue") } @@ -445,7 +451,13 @@ H5Mset_ff(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_ty HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set map KV pair") if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -522,7 +534,13 @@ H5Mget_ff(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_ty HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get map value") if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -591,7 +609,13 @@ H5Mget_types_ff(hid_t map_id, hid_t *key_type_id, hid_t *val_type_id, HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get map value") if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -655,7 +679,13 @@ H5Mget_count_ff(hid_t map_id, hsize_t *count, hid_t rcxt_id, hid_t eq_id) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get map value") if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -722,7 +752,13 @@ H5Mexists_ff(hid_t map_id, hid_t key_mem_type_id, const void *key, HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get map value") if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -832,7 +868,13 @@ H5Mdelete_ff(hid_t map_id, hid_t key_mem_type_id, const void *key, HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get map value") if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } done: diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 7ece9c6..d02ec73 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -37,6 +37,7 @@ #include "H5ACprivate.h" /* Cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ +#include "H5FFprivate.h" /* Fast Forward routines */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppkg.h" /* Property lists */ @@ -308,6 +309,8 @@ static const size_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRIT static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass) { + hid_t trans_id = FAIL; + hid_t context_id = FAIL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -508,6 +511,16 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the transaction ID property*/ + if(H5P_register_real(pclass, H5VL_TRANS_ID, sizeof(hid_t), &trans_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the context ID property*/ + if(H5P_register_real(pclass, H5VL_CONTEXT_ID, sizeof(hid_t), &context_id, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ diff --git a/src/H5RC.c b/src/H5RC.c index aecf4f7..61cd0c2 100644 --- a/src/H5RC.c +++ b/src/H5RC.c @@ -325,11 +325,16 @@ H5RC_create(void *file, uint64_t c_version) /* allocate read context struct */ if(NULL == (rc = H5FL_CALLOC(H5RC_t))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate top read context structure") + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate read context structure") rc->file = (H5VL_iod_file_t *)file; rc->c_version = c_version; + rc->req_info.request = NULL; + rc->req_info.head = NULL; + rc->req_info.tail = NULL; + rc->req_info.num_req = 0; + /* set return value */ ret_value = rc; @@ -407,8 +412,14 @@ H5RCacquire(hid_t file_id, /*IN/OUT*/ uint64_t *c_version, HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a read context on container"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue") } done: @@ -447,7 +458,7 @@ H5RCrelease(hid_t rc_id , hid_t eq_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Read Context ID") /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(eq_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(rc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); if(eq_id != H5_EVENT_QUEUE_NULL) { @@ -464,7 +475,13 @@ H5RCrelease(hid_t rc_id , hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a release on a read context on container"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -503,7 +520,7 @@ H5RCpersist(hid_t rc_id , hid_t eq_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Read Context ID") /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(eq_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(rc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); if(eq_id != H5_EVENT_QUEUE_NULL) { @@ -520,7 +537,13 @@ H5RCpersist(hid_t rc_id , hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a persist on a read context on container"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -563,7 +586,7 @@ H5RCsnapshot(hid_t rc_id , const char *snapshot_name, hid_t eq_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Read Context ID") /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(eq_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(rc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); if(eq_id != H5_EVENT_QUEUE_NULL) { @@ -580,7 +603,13 @@ H5RCsnapshot(hid_t rc_id , const char *snapshot_name, hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a snapshot on a read context on container"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -640,6 +669,49 @@ H5RC_close(H5RC_t *rc) { FUNC_ENTER_NOAPI_NOINIT_NOERR + if(rc->req_info.num_req) { + H5VL_iod_request_t *cur_req = rc->req_info.head; + H5VL_iod_request_t *next_req = NULL; + H5VL_iod_request_t *prev; + H5VL_iod_request_t *next; + + while(cur_req) { + next_req = cur_req->trans_next; + + /* remove the current request from the linked list */ + prev = cur_req->trans_prev; + next = cur_req->trans_next; + if (prev) { + if (next) { + prev->trans_next = next; + next->trans_prev = prev; + } + else { + prev->trans_next = NULL; + rc->req_info.tail = prev; + } + } + else { + if (next) { + next->trans_prev = NULL; + rc->req_info.head = next; + } + else { + rc->req_info.head = NULL; + rc->req_info.tail = NULL; + } + } + + cur_req->trans_prev = NULL; + cur_req->trans_next = NULL; + + rc->req_info.num_req --; + + cur_req = next_req; + } + HDassert(0 == rc->req_info.num_req); + } + rc = H5FL_FREE(H5RC_t, rc); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5RCprivate.h b/src/H5RCprivate.h index bb77ede..a280ff9 100644 --- a/src/H5RCprivate.h +++ b/src/H5RCprivate.h @@ -36,8 +36,19 @@ /****************************/ /* Library Private Typedefs */ /****************************/ + +/* Request and Linked list info used in transactions and read contexts + to track dependencies. */ +typedef struct H5VL_iod_req_info_t { + struct H5VL_iod_request_t *request; + struct H5VL_iod_request_t *head; + struct H5VL_iod_request_t *tail; + size_t num_req; +} H5VL_iod_req_info_t; + /* the client Read Context struct */ typedef struct H5RC_t { + H5VL_iod_req_info_t req_info; /* must be first */ struct H5VL_iod_file_t *file; uint64_t c_version; } H5RC_t; diff --git a/src/H5RCpublic.h b/src/H5RCpublic.h index 4d6b500..290fe2c 100644 --- a/src/H5RCpublic.h +++ b/src/H5RCpublic.h @@ -37,6 +37,7 @@ /*******************/ typedef enum H5RC_request_t{ H5RC_EXACT, /* default */ + H5RC_PREV, H5RC_NEXT, H5RC_LAST } H5RC_request_t; diff --git a/src/H5TR.c b/src/H5TR.c index 191c379..a929cd0 100644 --- a/src/H5TR.c +++ b/src/H5TR.c @@ -349,6 +349,11 @@ H5TR_create(void *file, H5RC_t *rc, uint64_t trans_num) tr->c_version = rc->c_version; tr->trans_num = trans_num; + tr->req_info.request = NULL; + tr->req_info.head = NULL; + tr->req_info.tail = NULL; + tr->req_info.num_req = 0; + /* set return value */ ret_value = tr; @@ -396,7 +401,7 @@ H5TRstart(hid_t tr_id, hid_t trspl_id, hid_t eq_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not transaction start property list") /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(eq_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(tr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); if(eq_id != H5_EVENT_QUEUE_NULL) { @@ -413,7 +418,13 @@ H5TRstart(hid_t tr_id, hid_t trspl_id, hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a transaction start"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -466,7 +477,7 @@ H5TRfinish(hid_t tr_id, hid_t trfpl_id, hid_t *rcxt_id, hid_t eq_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not transaction finish property list") /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(eq_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(tr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); /* create a new read context object (if user requested it) with @@ -495,7 +506,13 @@ H5TRfinish(hid_t tr_id, hid_t trfpl_id, hid_t *rcxt_id, hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a transaction finish"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -539,7 +556,7 @@ H5TRset_dependency(hid_t tr_id, uint64_t trans_num, hid_t eq_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "The dependent transaction must be higher than the one it depends on") /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(eq_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(tr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); if(eq_id != H5_EVENT_QUEUE_NULL) { @@ -556,7 +573,13 @@ H5TRset_dependency(hid_t tr_id, uint64_t trans_num, hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a transaction set_dependency"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -611,7 +634,13 @@ H5TRskip(hid_t file_id, uint64_t start_trans_num, uint64_t count, hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a transaction skip"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -646,7 +675,7 @@ H5TRabort(hid_t tr_id, hid_t eq_id) H5TRACE2("e", "ii", tr_id, eq_id); /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(eq_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(tr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); /* get the TR object */ @@ -667,7 +696,13 @@ H5TRabort(hid_t tr_id, hid_t eq_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to request a transaction abort"); if(request && *req) { - if(H5EQinsert(eq_id, request) < 0) + H5EQ_t *eq = NULL; /* event queue token */ + + /* get the eq object */ + if(NULL == (eq = (H5EQ_t *)H5I_object_verify(eq_id, H5I_EQ))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event queue identifier") + + if(H5EQ_insert(eq, request) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "failed to insert request in event queue"); } @@ -724,8 +759,52 @@ done: herr_t H5TR_close(H5TR_t *tr) { + FUNC_ENTER_NOAPI_NOINIT_NOERR + if(tr->req_info.num_req) { + H5VL_iod_request_t *cur_req = tr->req_info.head; + H5VL_iod_request_t *next_req = NULL; + H5VL_iod_request_t *prev; + H5VL_iod_request_t *next; + + while(cur_req) { + next_req = cur_req->trans_next; + + /* remove the current request from the linked list */ + prev = cur_req->trans_prev; + next = cur_req->trans_next; + if (prev) { + if (next) { + prev->trans_next = next; + next->trans_prev = prev; + } + else { + prev->trans_next = NULL; + tr->req_info.tail = prev; + } + } + else { + if (next) { + next->trans_prev = NULL; + tr->req_info.head = next; + } + else { + tr->req_info.head = NULL; + tr->req_info.tail = NULL; + } + } + + cur_req->trans_prev = NULL; + cur_req->trans_next = NULL; + + tr->req_info.num_req --; + + cur_req = next_req; + } + HDassert(0 == tr->req_info.num_req); + } + tr = H5FL_FREE(H5TR_t, tr); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5TRprivate.h b/src/H5TRprivate.h index d648d2b..4c20073 100644 --- a/src/H5TRprivate.h +++ b/src/H5TRprivate.h @@ -34,12 +34,13 @@ /****************************/ /* Library Private Typedefs */ /****************************/ + /* the transaction struct */ typedef struct H5TR_t { + H5VL_iod_req_info_t req_info; /* must be first */ struct H5VL_iod_file_t *file; uint64_t c_version; uint64_t trans_num; - struct H5VL_iod_request_t *request; } H5TR_t; /*****************************/ diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 771d4ff..a1d8ac4 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -27,6 +27,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FDprivate.h" /* file drivers */ +#include "H5FFprivate.h" /* Fast Forward */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ @@ -42,7 +43,6 @@ static hg_id_t H5VL_EFF_INIT_ID; static hg_id_t H5VL_EFF_FINALIZE_ID; static hg_id_t H5VL_FILE_CREATE_ID; static hg_id_t H5VL_FILE_OPEN_ID; -static hg_id_t H5VL_FILE_FLUSH_ID; static hg_id_t H5VL_FILE_CLOSE_ID; static hg_id_t H5VL_ATTR_CREATE_ID; static hg_id_t H5VL_ATTR_OPEN_ID; @@ -149,9 +149,7 @@ static herr_t H5VL_iod_dataset_close(void *dset, hid_t dxpl_id, void **req); /* File callbacks */ static void *H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); static void *H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_iod_file_flush(void *obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, hid_t dxpl_id, void **req); static herr_t H5VL_iod_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_iod_file_misc(void *file, H5VL_file_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_iod_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ @@ -236,9 +234,9 @@ static H5VL_class_t H5VL_iod_g = { { /* file_cls */ H5VL_iod_file_create, /* create */ H5VL_iod_file_open, /* open */ - H5VL_iod_file_flush, /* flush */ + NULL, /* flush */ H5VL_iod_file_get, /* get */ - H5VL_iod_file_misc, /* misc */ + NULL, /* misc */ NULL, /* optional */ H5VL_iod_file_close /* close */ }, @@ -419,9 +417,13 @@ H5VL__iod_request_add_to_axe_list(H5VL_iod_request_t *request) /* process axe_list */ while(axe_list.head && /* If there is a head request */ + /* and the only reference is from this global axe list OR + from the axe list and the file list */ (axe_list.head->ref_count == 1 || (axe_list.head->ref_count == 2 && request->req != NULL)) && + /* and the request has completed */ H5VL_IOD_COMPLETED == axe_list.head->state) { + /* add the axe IDs to the ones to free. */ axe_list.last_released_task = axe_list.head->axe_id; /* remove head from axe list */ @@ -450,12 +452,15 @@ herr_t H5VL__iod_create_and_forward(hg_id_t op_id, H5RQ_type_t op_type, H5VL_iod_object_t *request_obj, htri_t track, size_t num_parents, H5VL_iod_request_t **parent_reqs, + H5VL_iod_req_info_t *req_info, void *input, void *output, void *data, void **req) { hg_request_t *hg_req = NULL; H5VL_iod_request_t *request = NULL; hbool_t do_async = (req == NULL) ? FALSE : TRUE; /* Whether we're performing async. I/O */ axe_t *axe_info = (axe_t *) input; + AXE_task_t *parent_axe_ids = NULL; + unsigned u; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -468,6 +473,9 @@ H5VL__iod_create_and_forward(hg_id_t op_id, H5RQ_type_t op_type, if(NULL == (request = (H5VL_iod_request_t *)H5MM_malloc(sizeof(H5VL_iod_request_t)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate IOD VOL request struct"); + /* get axe ID for operation */ + axe_info->axe_id = g_axe_id ++; + /* Set up request */ HDmemset(request, 0, sizeof(*request)); request->type = op_type; @@ -476,8 +484,9 @@ H5VL__iod_create_and_forward(hg_id_t op_id, H5RQ_type_t op_type, request->ref_count = 1; request->obj = request_obj; request->axe_id = axe_info->axe_id; - request->next = request->prev = NULL; + request->file_next = request->file_prev = NULL; request->global_next = request->global_prev = NULL; + request->trans_info = req_info; /* add request to container's linked list */ H5VL_iod_request_add(request_obj->file, request); @@ -486,15 +495,32 @@ H5VL__iod_create_and_forward(hg_id_t op_id, H5RQ_type_t op_type, request->num_parents = num_parents; request->parent_reqs = parent_reqs; + if(num_parents) { + if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * num_parents))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); + + for(u=0 ; uaxe_id; + } + + axe_info->num_parents = num_parents; + axe_info->parent_axe_ids = parent_axe_ids; + axe_info->start_range = axe_list.last_released_task + 1; /* add request to global axe's linked list */ H5VL__iod_request_add_to_axe_list(request); axe_info->count = axe_list.last_released_task - axe_info->start_range + 1; #if H5VL_IOD_DEBUG + printf("Operation %llu Dependencies: ", request->axe_id); + for(u=0 ; uparent_axe_ids[u]); + printf("\n"); + if(axe_info->count) { printf("Operation %llu will finish tasks %llu through %llu\n", - request->axe_id, axe_info->start_range, axe_info->start_range+axe_info->count-1); + request->axe_id, axe_info->start_range, + axe_info->start_range+axe_info->count-1); } #endif @@ -525,6 +551,7 @@ H5VL__iod_create_and_forward(hg_id_t op_id, H5RQ_type_t op_type, } /* end else */ done: + parent_axe_ids = (AXE_task_t *)H5MM_xfree(parent_axe_ids); FUNC_LEAVE_NOAPI(ret_value) }/* end H5VL__iod_create_and_forward() */ @@ -591,7 +618,6 @@ EFF_init(MPI_Comm comm, MPI_Info UNUSED info) H5VL_FILE_CREATE_ID = MERCURY_REGISTER("file_create", file_create_in_t, file_create_out_t); H5VL_FILE_OPEN_ID = MERCURY_REGISTER("file_open", file_open_in_t, file_open_out_t); - H5VL_FILE_FLUSH_ID = MERCURY_REGISTER("file_flush", file_flush_in_t, ret_t); H5VL_FILE_CLOSE_ID = MERCURY_REGISTER("file_close", file_close_in_t, ret_t); H5VL_ATTR_CREATE_ID = MERCURY_REGISTER("attr_create", attr_create_in_t, attr_create_out_t); @@ -691,6 +717,26 @@ EFF_finalize(void) hg_request_t hg_req; herr_t ret_value = SUCCEED; + H5VL_iod_request_t *cur_req = axe_list.head; + + /* process axe_list */ + while(cur_req) { + H5VL_iod_request_t *next_req = NULL; + + next_req = cur_req->global_next; + + HDassert(cur_req->ref_count == 1); + HDassert(H5VL_IOD_COMPLETED == cur_req->state); + + /* add the axe IDs to the ones to free. */ + axe_list.last_released_task = cur_req->axe_id; + + /* remove head from axe list */ + H5VL__iod_request_remove_from_axe_list(cur_req); + + cur_req = next_req; + } + /* forward the finalize call to the ION and wait for it to complete */ if(HG_Forward(PEER, H5VL_EFF_FINALIZE_ID, &ret_value, &ret_value, &hg_req) < 0) return FAIL; @@ -963,7 +1009,7 @@ done: herr_t H5Pget_dxpl_checksum_ptr(hid_t dxpl_id, uint32_t **cs/*out*/) { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -998,7 +1044,7 @@ done: herr_t H5Pset_dxpl_inject_corruption(hid_t dxpl_id, hbool_t flag) { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1036,7 +1082,7 @@ done: herr_t H5Pget_dxpl_inject_corruption(hid_t dxpl_id, hbool_t *flag/*out*/) { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1072,7 +1118,7 @@ done: herr_t H5Pset_dcpl_append_only(hid_t dcpl_id, hbool_t flag) { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1111,7 +1157,7 @@ done: herr_t H5Pget_dcpl_append_only(hid_t dcpl_id, hbool_t *flag/*out*/) { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1145,10 +1191,10 @@ done: */ static void * H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, - hid_t dxpl_id, void **req) + hid_t UNUSED dxpl_id, void **req) { H5VL_iod_fapl_t *fa = NULL; - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ H5VL_iod_file_t *file = NULL; file_create_in_t input; void *ret_value = NULL; @@ -1187,14 +1233,6 @@ H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl input.flags = flags; input.fcpl_id = fcpl_id; input.fapl_id = fapl_id; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - -#if H5VL_IOD_DEBUG - printf("File Create %s IOD ROOT ID %llu, axe id %llu\n", - name, input.root_id, input.axe_info.axe_id); -#endif /* create the file object that is passed to the API layer */ file->file_name = HDstrdup(name); @@ -1216,9 +1254,14 @@ H5VL_iod_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl file->common.obj_name[1] = '\0'; file->common.file = file; +#if H5VL_IOD_DEBUG + printf("File Create %s IOD ROOT ID %llu, axe id %llu\n", + name, input.root_id, g_axe_id); +#endif + if(H5VL__iod_create_and_forward(H5VL_FILE_CREATE_ID, HG_FILE_CREATE, (H5VL_iod_object_t *)file, 1, 0, NULL, - &input, &file->remote_file, file, req) < 0) + NULL, &input, &file->remote_file, file, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship file create"); ret_value = (void *)file; @@ -1242,10 +1285,11 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) +H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t UNUSED dxpl_id, void **req) { H5VL_iod_fapl_t *fa; - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ H5VL_iod_file_t *file = NULL; file_open_in_t input; void *ret_value = NULL; @@ -1271,13 +1315,6 @@ H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_i input.name = name; input.flags = flags; input.fapl_id = fapl_id; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - -#if H5VL_IOD_DEBUG - printf("File Open %s axe id %llu\n", name, input.axe_info.axe_id); -#endif /* create the file object that is passed to the API layer */ MPI_Comm_rank(fa->comm, &file->my_rank); @@ -1299,9 +1336,13 @@ H5VL_iod_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_i file->common.obj_name[1] = '\0'; file->common.file = file; +#if H5VL_IOD_DEBUG + printf("File Open %s axe id %llu\n", name, g_axe_id); +#endif + if(H5VL__iod_create_and_forward(H5VL_FILE_OPEN_ID, HG_FILE_OPEN, (H5VL_iod_object_t *)file, 1, 0, NULL, - &input, &file->remote_file, file, req) < 0) + NULL, &input, &file->remote_file, file, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship file open"); ret_value = (void *)file; @@ -1312,51 +1353,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_iod_file_flush - * - * Purpose: Flushs a iod HDF5 file. - * - * Return: Success: 0 - * Failure: -1, file not flushed. - * - * Programmer: Mohamad Chaarawi - * February, 2013 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_iod_file_flush(void *_obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, - hid_t dxpl_id, void **req) -{ - H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; - H5VL_iod_file_t *file = obj->file; - int *status; - file_flush_in_t input; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* set the input structure for the HG encode routine */ - input.coh = file->remote_file.coh; - input.scope = scope; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - - /* allocate an integer to receive the return value if the file close succeeded or not */ - status = (int *)malloc(sizeof(int)); - - if(H5VL__iod_create_and_forward(H5VL_FILE_FLUSH_ID, HG_FILE_FLUSH, - (H5VL_iod_object_t *)file, 1, 0, NULL, - &input, status, status, req) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship file flush"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_iod_file_flush() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_iod_file_get * * Purpose: Gets certain data about a file @@ -1370,7 +1366,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_file_get(void *_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +H5VL_iod_file_get(void *_obj, H5VL_file_get_t get_type, hid_t UNUSED dxpl_id, + void UNUSED **req, va_list arguments) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; H5VL_iod_file_t *file = obj->file; @@ -1460,25 +1457,17 @@ H5VL_iod_file_get(void *_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **re /* H5Fget_obj_count */ case H5VL_FILE_GET_OBJ_COUNT: { - unsigned types = va_arg (arguments, unsigned); - ssize_t *ret = va_arg (arguments, ssize_t *); - size_t obj_count = 0; /* Number of opened objects */ - - /* Set the return value */ - *ret = (ssize_t)obj_count; + //unsigned types = va_arg (arguments, unsigned); + //ssize_t *ret = va_arg (arguments, ssize_t *); //break; } /* H5Fget_obj_ids */ case H5VL_FILE_GET_OBJ_IDS: { - unsigned types = va_arg (arguments, unsigned); - size_t max_objs = va_arg (arguments, size_t); - hid_t *oid_list = va_arg (arguments, hid_t *); - ssize_t *ret = va_arg (arguments, ssize_t *); - size_t obj_count = 0; /* Number of opened objects */ - - /* Set the return value */ - *ret = (ssize_t)obj_count; + //unsigned types = va_arg (arguments, unsigned); + //size_t max_objs = va_arg (arguments, size_t); + //hid_t *oid_list = va_arg (arguments, hid_t *); + //ssize_t *ret = va_arg (arguments, ssize_t *); //break; } default: @@ -1489,6 +1478,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_file_get() */ +#if 0 /*------------------------------------------------------------------------- * Function: H5VL_iod_file_misc @@ -1504,7 +1494,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_file_misc(void *obj, H5VL_file_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments) +H5VL_iod_file_misc(void *obj, H5VL_file_misc_t misc_type, hid_t dxpl_id, + void **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1553,6 +1544,7 @@ H5VL_iod_file_misc(void *obj, H5VL_file_misc_t misc_type, hid_t dxpl_id, void ** done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_file_misc() */ +#endif /*------------------------------------------------------------------------- @@ -1569,7 +1561,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_file_close(void *_file, hid_t dxpl_id, void **req) +H5VL_iod_file_close(void *_file, hid_t UNUSED dxpl_id, void **req) { H5VL_iod_file_t *file = (H5VL_iod_file_t *)_file; file_close_in_t input; @@ -1593,15 +1585,6 @@ 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.axe_info.axe_id = g_axe_id ++; - /* MSC - for now, we will insert this as a barrier task so no need - to get parent axe IDs */ - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - -#if H5VL_IOD_DEBUG - printf("File Close Root ID %llu axe id %llu\n", input.root_id, input.axe_info.axe_id); -#endif if(file->num_req) { H5VL_iod_request_t *cur_req = file->request_list_head; @@ -1616,14 +1599,18 @@ H5VL_iod_file_close(void *_file, hid_t dxpl_id, void **req) cur_req->ref_count ++; num_parents ++; } - cur_req = cur_req->next; + cur_req = cur_req->file_next; } } +#if H5VL_IOD_DEBUG + printf("File Close Root ID %llu axe id %llu\n", input.root_id, g_axe_id); +#endif + if(H5VL__iod_create_and_forward(H5VL_FILE_CLOSE_ID, HG_FILE_CLOSE, (H5VL_iod_object_t *)file, 1, num_parents, parent_reqs, - &input, status, status, req) < 0) + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship file close"); done: @@ -1645,18 +1632,20 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_iod_group_create(void *_obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, +H5VL_iod_group_create(void *_obj, H5VL_loc_params_t UNUSED loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the group */ H5VL_iod_group_t *grp = NULL; /* the group object that is created and passed to the user */ group_create_in_t input; - H5P_genplist_t *plist; hid_t lcpl_id; iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ + H5VL_iod_request_t **parent_reqs = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; + H5P_genplist_t *plist = NULL; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -1664,18 +1653,32 @@ H5VL_iod_group_create(void *_obj, H5VL_loc_params_t loc_params, const char *name /* Get the group creation plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); - /* get creation properties */ 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"); - /* Retrieve the parent AXE id by traversing the path where the - group should be created. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a Transaction ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the group object that is returned to the user */ if(NULL == (grp = H5FL_CALLOC(H5VL_iod_group_t))) @@ -1698,24 +1701,12 @@ H5VL_iod_group_create(void *_obj, H5VL_loc_params_t loc_params, const char *name input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.gcpl_id = gcpl_id; input.gapl_id = gapl_id; input.lcpl_id = lcpl_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } - -#if H5VL_IOD_DEBUG - printf("Group Create %s, IOD ID %llu, axe id %llu, parent %llu\n", - new_name, input.grp_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); -#endif + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; /* setup the local group struct */ /* store the entire path of the group locally */ @@ -1740,17 +1731,20 @@ H5VL_iod_group_create(void *_obj, H5VL_loc_params_t loc_params, const char *name grp->common.file = obj->file; grp->common.file->nopen_objs ++; +#if H5VL_IOD_DEBUG + printf("Group Create %s, IOD ID %llu, axe id %llu\n", + name, input.grp_id, g_axe_id); +#endif + if(H5VL__iod_create_and_forward(H5VL_GROUP_CREATE_ID, HG_GROUP_CREATE, (H5VL_iod_object_t *)grp, 1, - input.axe_info.num_parents, parent_req, + num_parents, parent_reqs, (H5VL_iod_req_info_t *)tr, &input, &grp->remote_group, grp, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship group create"); ret_value = (void *)grp; done: - if(new_name) - free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_group_create() */ @@ -1769,27 +1763,45 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_iod_group_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, +H5VL_iod_group_open(void *_obj, H5VL_loc_params_t UNUSED loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the group */ H5VL_iod_group_t *grp = NULL; /* the group object that is created and passed to the user */ + group_open_in_t input; iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ - group_open_in_t input; + H5P_genplist_t *plist = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent AXE id by traversing the path where the - group should be opened. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the group object that is returned to the user */ if(NULL == (grp = H5FL_CALLOC(H5VL_iod_group_t))) @@ -1802,21 +1814,13 @@ H5VL_iod_group_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.gapl_id = gapl_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.rcxt_num = rc->c_version; #if H5VL_IOD_DEBUG - printf("Group Open %s LOC ID %llu, axe id %llu, parent %llu\n", - new_name, input.loc_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Group Open %s LOC ID %llu, axe id %llu\n", + name, input.loc_id, g_axe_id); #endif /* setup the local group struct */ @@ -1842,15 +1846,13 @@ H5VL_iod_group_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, if(H5VL__iod_create_and_forward(H5VL_GROUP_OPEN_ID, HG_GROUP_OPEN, (H5VL_iod_object_t *)grp, 1, - input.axe_info.num_parents, parent_req, + num_parents, parent_reqs, (H5VL_iod_req_info_t *)rc, &input, &grp->remote_group, grp, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship group open"); ret_value = (void *)grp; done: - if(new_name) - free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_group_open() */ @@ -1869,10 +1871,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_group_get(void *_grp, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) +H5VL_iod_group_get(void *_grp, H5VL_group_get_t get_type, hid_t UNUSED dxpl_id, + void UNUSED **req, va_list arguments) { H5VL_iod_group_t *grp = (H5VL_iod_group_t *)_grp; - 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 @@ -1891,8 +1893,8 @@ H5VL_iod_group_get(void *_grp, H5VL_group_get_t get_type, hid_t dxpl_id, void ** /* H5Gget_info */ case H5VL_GROUP_GET_INFO: { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - H5G_info_t *ginfo = va_arg (arguments, H5G_info_t *); + //H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); + //H5G_info_t *ginfo = va_arg (arguments, H5G_info_t *); } default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") @@ -1916,13 +1918,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_group_close(void *_grp, hid_t dxpl_id, void **req) +H5VL_iod_group_close(void *_grp, hid_t UNUSED dxpl_id, void **req) { H5VL_iod_group_t *grp = (H5VL_iod_group_t *)_grp; group_close_in_t input; int *status; - size_t num_parents; - AXE_task_t *parent_axe_ids = NULL; + size_t num_parents = 0; H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -1935,42 +1936,36 @@ H5VL_iod_group_close(void *_grp, hid_t dxpl_id, void **req) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't wait on all object requests"); } - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)grp, &num_parents, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)grp, &num_parents, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num requests"); if(num_parents) { - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * num_parents))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); - if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc - (sizeof(H5VL_iod_request_t *) * num_parents))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * num_parents))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)grp, &num_parents, - parent_axe_ids, parent_reqs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)grp, &num_parents, + parent_reqs) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get parent requests"); } input.iod_oh = grp->remote_group.iod_oh; input.iod_id = grp->remote_group.iod_id; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; + + /* allocate an integer to receive the return value if the group close succeeded or not */ + status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG printf("Group Close IOD ID %llu, axe id %llu\n", - input.iod_id, input.axe_info.axe_id); + input.iod_id, g_axe_id); #endif - /* allocate an integer to receive the return value if the group close succeeded or not */ - status = (int *)malloc(sizeof(int)); - if(H5VL__iod_create_and_forward(H5VL_GROUP_CLOSE_ID, HG_GROUP_CLOSE, (H5VL_iod_object_t *)grp, 1, num_parents, parent_reqs, - &input, status, status, req) < 0) + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship group close"); done: - parent_axe_ids = (AXE_task_t *)H5MM_xfree(parent_axe_ids); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_group_close() */ @@ -1989,17 +1984,20 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, +H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t UNUSED loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the dataset */ H5VL_iod_dset_t *dset = NULL; /* the dataset object that is created and passed to the user */ dset_create_in_t input; - H5P_genplist_t *plist; iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ + H5VL_iod_request_t **parent_reqs = NULL; + H5P_genplist_t *plist = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; hid_t type_id, space_id, lcpl_id; void *ret_value = NULL; @@ -2017,13 +2015,29 @@ 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"); + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a Transaction ID") + /* Retrieve the parent AXE id by traversing the path where the dataset should be created. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the dataset object that is returned to the user */ if(NULL == (dset = H5FL_CALLOC(H5VL_iod_dset_t))) @@ -2045,26 +2059,14 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t loc_params, const char *na input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.dcpl_id = dcpl_id; input.dapl_id = dapl_id; input.lcpl_id = lcpl_id; input.type_id = type_id; input.space_id = space_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } - -#if H5VL_IOD_DEBUG - printf("Dataset Create %s IOD ID %llu, axe id %llu, parent %llu\n", - new_name, input.dset_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); -#endif + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; /* setup the local dataset struct */ /* store the entire path of the dataset locally */ @@ -2094,17 +2096,20 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t loc_params, const char *na dset->common.file = obj->file; dset->common.file->nopen_objs ++; +#if H5VL_IOD_DEBUG + printf("Dataset Create %s IOD ID %llu, axe id %llu\n", + name, input.dset_id, g_axe_id); +#endif + if(H5VL__iod_create_and_forward(H5VL_DSET_CREATE_ID, HG_DSET_CREATE, (H5VL_iod_object_t *)dset, 1, - input.axe_info.num_parents, parent_req, - &input, &dset->remote_dset, dset, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, &dset->remote_dset, dset, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship dataset create"); ret_value = (void *)dset; done: - if(new_name) - free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_dataset_create() */ @@ -2123,7 +2128,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, +H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t UNUSED loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the dataset */ @@ -2131,19 +2136,38 @@ 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; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ + H5P_genplist_t *plist = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID") + /* Retrieve the parent AXE id by traversing the path where the dataset should be opened. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the dataset object that is returned to the user */ if(NULL == (dset = H5FL_CALLOC(H5VL_iod_dset_t))) @@ -2159,22 +2183,9 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t loc_params, const char *name input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.dapl_id = dapl_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } - -#if H5VL_IOD_DEBUG - printf("Dataset Open %s LOC ID %llu, axe id %llu, parent %llu\n", - new_name, input.loc_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); -#endif + input.rcxt_num = rc->c_version; /* setup the local dataset struct */ /* store the entire path of the dataset locally */ @@ -2197,17 +2208,20 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t loc_params, const char *name dset->common.file = obj->file; dset->common.file->nopen_objs ++; +#if H5VL_IOD_DEBUG + printf("Dataset Open %s LOC ID %llu, axe id %llu\n", + name, input.loc_id, g_axe_id); +#endif + if(H5VL__iod_create_and_forward(H5VL_DSET_OPEN_ID, HG_DSET_OPEN, (H5VL_iod_object_t *)dset, 1, - input.axe_info.num_parents, parent_req, - &input, &dset->remote_dset, dset, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, &dset->remote_dset, dset, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship dataset open"); ret_value = (void *)dset; done: - if(new_name) - free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_dataset_open() */ @@ -2232,7 +2246,7 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)_dset; dset_io_in_t input; dset_get_vl_size_in_t input_vl; - H5P_genplist_t *plist; + H5P_genplist_t *plist = NULL; hg_bulk_t *bulk_handle = NULL; H5VL_iod_read_status_t *status = NULL; const H5S_t *mem_space = NULL; @@ -2242,11 +2256,24 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, size_t nelmts; /* num elements in mem dataspace */ H5VL_iod_io_info_t *info = NULL; hbool_t is_vl_data = FALSE; - H5VL_iod_request_t **parent_req = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID") + /* If there is information needed about the dataset that is not present locally, wait */ if(-1 == dset->remote_dset.dcpl_id || -1 == dset->remote_dset.type_id || @@ -2303,9 +2330,15 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, bulk_handle, &is_vl_data) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't generate read parameters"); - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)dset, (H5VL_iod_req_info_t *)rc, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + if(!is_vl_data) { /* Fill input structure for reading data */ input.coh = dset->common.file->remote_file.coh; @@ -2317,18 +2350,7 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, input.space_id = file_space_id; input.dset_type_id = dset->remote_dset.type_id; input.mem_type_id = mem_type_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != dset->common.request && dset->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &dset->common.request->axe_id; - dset->common.request->ref_count ++; - *parent_req = dset->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.rcxt_num = rc->c_version; } else { /* Fill input structure for retrieving the buffer size needed to read */ @@ -2338,33 +2360,13 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, input_vl.dxpl_id = dxpl_id; input_vl.space_id = file_space_id; input_vl.mem_type_id = mem_type_id; - input_vl.axe_info.axe_id = g_axe_id ++; - if(NULL != dset->common.request && dset->common.request->state != H5VL_IOD_COMPLETED) { - input_vl.axe_info.num_parents = 1; - input_vl.axe_info.parent_axe_ids = &dset->common.request->axe_id; - dset->common.request->ref_count ++; - *parent_req = dset->common.request; - } - else { - input_vl.axe_info.num_parents = 0; - input_vl.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input_vl.rcxt_num = rc->c_version; } /* allocate structure to receive status of read operation (contains return value, checksum, and buffer size) */ status = (H5VL_iod_read_status_t *)malloc(sizeof(H5VL_iod_read_status_t)); -#if H5VL_IOD_DEBUG - if(!is_vl_data) - printf("Dataset Read, axe id %llu, parent %llu\n", - input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); - else - printf("Dataset GET size, axe id %llu, parent %llu\n", - input_vl.axe_info.axe_id, ((input_vl.axe_info.parent_axe_ids!=NULL) ? input_vl.axe_info.parent_axe_ids[0] : 0)); -#endif - /* setup info struct for I/O request. This is to manage the I/O operation once the wait is called. */ if(NULL == (info = (H5VL_iod_io_info_t *)H5MM_calloc(sizeof(H5VL_iod_io_info_t)))) @@ -2397,23 +2399,30 @@ H5VL_iod_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype"); if((info->dxpl_id = H5P_copy_plist((H5P_genplist_t *)plist, TRUE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy dxpl"); - info->axe_id = g_axe_id ++; + info->peer = PEER; info->read_id = H5VL_DSET_READ_ID; } +#if H5VL_IOD_DEBUG + if(!is_vl_data) + printf("Dataset Read, axe id %llu\n", g_axe_id); + else + printf("Dataset GET size, axe id %llu\n", g_axe_id); +#endif + /* forward the call to the IONs */ if(!is_vl_data) { if(H5VL__iod_create_and_forward(H5VL_DSET_READ_ID, HG_DSET_READ, (H5VL_iod_object_t *)dset, 0, - input.axe_info.num_parents, parent_req, + num_parents, parent_reqs, (H5VL_iod_req_info_t *)rc, &input, status, info, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship dataset read"); } else { if(H5VL__iod_create_and_forward(H5VL_DSET_GET_VL_SIZE_ID, HG_DSET_GET_VL_SIZE, (H5VL_iod_object_t *)dset, 0, - input_vl.axe_info.num_parents, parent_req, + num_parents, parent_reqs, (H5VL_iod_req_info_t *)rc, &input_vl, status, info, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship dataset get VL size"); } @@ -2442,19 +2451,19 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, { H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)_dset; dset_io_in_t input; - H5P_genplist_t *plist; + H5P_genplist_t *plist = NULL; hg_bulk_t *bulk_handle = NULL; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; char fake_char; int *status = NULL; - hsize_t buf_size; /* size of the contiguous buffer */ - size_t type_size; /* size of mem type */ - size_t nelmts; /* num elements in mem dataspace */ H5VL_iod_io_info_t *info; /* info struct used to manage I/O parameters once the operation completes*/ uint32_t internal_cs; /* internal checksum calculated in this function */ size_t *vl_string_len = NULL; /* array that will contain lengths of strings if the datatype is a VL string type */ - H5VL_iod_request_t **parent_req = NULL; + H5VL_iod_request_t **parent_reqs = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -2502,14 +2511,20 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, &internal_cs, bulk_handle, &vl_string_len) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't generate write parameters"); + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + /* Verify the checksum value if the dxpl contains a user defined checksum */ if(H5P_DATASET_XFER_DEFAULT != dxpl_id) { uint32_t user_cs; - /* Get the dcpl plist structure */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - if(H5P_get(plist, H5D_XFER_CHECKSUM_NAME, &user_cs) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get checksum value"); @@ -2520,9 +2535,15 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, } } - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)dset, (H5VL_iod_req_info_t *)tr, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = dset->common.file->remote_file.coh; input.iod_oh = dset->remote_dset.iod_oh; @@ -2533,24 +2554,13 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, input.space_id = file_space_id; input.dset_type_id = dset->remote_dset.type_id; input.mem_type_id = mem_type_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != dset->common.request && dset->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &dset->common.request->axe_id; - dset->common.request->ref_count ++; - *parent_req = dset->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG - printf("Dataset Write, axe id %llu, parent %llu\n", - input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Dataset Write, axe id %llu\n", g_axe_id); #endif /* setup info struct for I/O request @@ -2564,8 +2574,8 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, if(H5VL__iod_create_and_forward(H5VL_DSET_WRITE_ID, HG_DSET_WRITE, (H5VL_iod_object_t *)dset, 0, - input.axe_info.num_parents, parent_req, - &input, status, info, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, info, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship dataset write"); done: @@ -2587,15 +2597,16 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_iod_dataset_set_extent(void *_dset, const hsize_t size[], hid_t dxpl_id, void **req) +H5VL_iod_dataset_set_extent(void *_dset, const hsize_t size[], + hid_t dxpl_id, void **req) { H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)_dset; dset_set_extent_in_t input; - iod_obj_id_t iod_id; - iod_handle_t iod_oh; int *status = NULL; - size_t num_parents; - AXE_task_t *parent_axe_ids = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; + H5P_genplist_t *plist = NULL; H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -2609,18 +2620,26 @@ H5VL_iod_dataset_set_extent(void *_dset, const hsize_t size[], hid_t dxpl_id, vo dset->common.request = NULL; } - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)dset, &num_parents, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num AXE parents"); + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)dset, &num_parents, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num requests"); if(num_parents) { - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * num_parents))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc (sizeof(H5VL_iod_request_t *) * num_parents))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)dset, &num_parents, - parent_axe_ids, parent_reqs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)dset, &num_parents, + parent_reqs) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get parent requests"); } /* Fill input structure */ @@ -2629,20 +2648,11 @@ H5VL_iod_dataset_set_extent(void *_dset, const hsize_t size[], hid_t dxpl_id, vo 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_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; - input.axe_info.axe_id = g_axe_id ++; + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; #if H5VL_IOD_DEBUG - { - size_t i; - - printf("Dataset Set Extent, axe id %llu, %d parents: ", - input.axe_info.axe_id, num_parents); - for(i=0 ; iremote_dset.iod_oh; input.iod_id = dset->remote_dset.iod_id; - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; - input.axe_info.axe_id = g_axe_id ++; -#if H5VL_IOD_DEBUG - { - size_t i; + status = (int *)malloc(sizeof(int)); - printf("Dataset Close %s, axe id %llu, %d parents: ", - dset->common.obj_name, input.axe_info.axe_id, num_parents); - for(i=0 ; ifile->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.tcpl_id = tcpl_id; input.tapl_id = tapl_id; input.lcpl_id = lcpl_id; input.type_id = type_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; #if H5VL_IOD_DEBUG - printf("Datatype Commit %s IOD ID %llu, axe id %llu, parent %llu\n", - new_name, input.dtype_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Datatype Commit %s IOD ID %llu, axe id %llu\n", + name, input.dtype_id, g_axe_id); #endif /* setup the local datatype struct */ @@ -2955,14 +2962,13 @@ H5VL_iod_datatype_commit(void *_obj, H5VL_loc_params_t loc_params, const char *n if(H5VL__iod_create_and_forward(H5VL_DTYPE_COMMIT_ID, HG_DTYPE_COMMIT, (H5VL_iod_object_t *)dtype, 1, - input.axe_info.num_parents, parent_req, - &input, &dtype->remote_dtype, dtype, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, &dtype->remote_dtype, dtype, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship datatype commit"); ret_value = (void *)dtype; + done: - if(new_name) - free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_datatype_commit() */ @@ -2981,7 +2987,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_iod_datatype_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, +H5VL_iod_datatype_open(void *_obj, H5VL_loc_params_t UNUSED loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the datatype */ @@ -2989,19 +2995,37 @@ H5VL_iod_datatype_open(void *_obj, H5VL_loc_params_t loc_params, const char *nam dtype_open_in_t input; iod_obj_id_t iod_id; iod_handle_t iod_oh; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ - H5VL_iod_request_t **parent_req = NULL; + H5P_genplist_t *plist = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent AXE id by traversing the path where the - dtype should be opened. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the datatype object that is returned to the user */ if(NULL == (dtype = H5FL_CALLOC(H5VL_iod_dtype_t))) @@ -3016,21 +3040,13 @@ H5VL_iod_datatype_open(void *_obj, H5VL_loc_params_t loc_params, const char *nam input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.tapl_id = tapl_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.rcxt_num = rc->c_version; #if H5VL_IOD_DEBUG - printf("Datatype Open %s LOC ID %llu, axe id %llu, parent %llu\n", - new_name, input.loc_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Datatype Open %s LOC ID %llu, axe id %llu\n", + name, input.loc_id, g_axe_id); #endif /* setup the local datatype struct */ @@ -3056,14 +3072,13 @@ H5VL_iod_datatype_open(void *_obj, H5VL_loc_params_t loc_params, const char *nam if(H5VL__iod_create_and_forward(H5VL_DTYPE_OPEN_ID, HG_DTYPE_OPEN, (H5VL_iod_object_t *)dtype, 1, - input.axe_info.num_parents, parent_req, - &input, &dtype->remote_dtype, dtype, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, &dtype->remote_dtype, dtype, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship datatype open"); ret_value = (void *)dtype; done: - if(new_name) free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_datatype_open() */ @@ -3152,12 +3167,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_datatype_close(void *obj, hid_t dxpl_id, void **req) +H5VL_iod_datatype_close(void *obj, hid_t UNUSED dxpl_id, void **req) { H5VL_iod_dtype_t *dtype = (H5VL_iod_dtype_t *)obj; dtype_close_in_t input; - size_t num_parents; - AXE_task_t *parent_axe_ids = NULL; + size_t num_parents = 0; H5VL_iod_request_t **parent_reqs = NULL; int *status; herr_t ret_value = SUCCEED; /* Return value */ @@ -3171,29 +3185,23 @@ H5VL_iod_datatype_close(void *obj, hid_t dxpl_id, void **req) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't wait on all object requests"); } - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)dtype, &num_parents, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)dtype, &num_parents, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num requests"); if(num_parents) { - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * num_parents))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); - if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc - (sizeof(H5VL_iod_request_t *) * num_parents))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * num_parents))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)dtype, &num_parents, - parent_axe_ids, parent_reqs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)dtype, &num_parents, + parent_reqs) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get parent requests"); } input.iod_oh = dtype->remote_dtype.iod_oh; input.iod_id = dtype->remote_dtype.iod_id; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; #if H5VL_IOD_DEBUG - printf("Datatype Close %s, axe id %llu, parent %llu\n", - dtype->common.obj_name, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Datatype Close IOD ID %llu, axe id %llu\n", input.iod_id, g_axe_id); #endif status = (int *)malloc(sizeof(int)); @@ -3201,11 +3209,10 @@ H5VL_iod_datatype_close(void *obj, hid_t dxpl_id, void **req) if(H5VL__iod_create_and_forward(H5VL_DTYPE_CLOSE_ID, HG_DTYPE_CLOSE, (H5VL_iod_object_t *)dtype, 1, num_parents, parent_reqs, - &input, status, status, req) < 0) + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship datatype open"); done: - parent_axe_ids = (AXE_task_t *)H5MM_xfree(parent_axe_ids); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_datatype_close() */ @@ -3225,18 +3232,21 @@ done: */ static void * H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char *attr_name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) + hid_t acpl_id, hid_t UNUSED aapl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the attribute */ H5VL_iod_attr_t *attr = NULL; /* the attribute object that is created and passed to the user */ attr_create_in_t input; - H5P_genplist_t *plist; + H5P_genplist_t *plist = NULL; iod_obj_id_t iod_id; iod_handle_t iod_oh; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ const char *path; /* path on where the traversal starts relative to the location object specified */ + char *loc_name = NULL; hid_t type_id, space_id; - H5VL_iod_request_t **parent_req = NULL; + H5VL_iod_request_t **parent_reqs = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -3251,13 +3261,28 @@ 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"); - /* Retrieve the parent AXE id by traversing the path where the - attribute should be created. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a Transaction ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the attribute object that is returned to the user */ if(NULL == (attr = H5FL_CALLOC(H5VL_iod_attr_t))) @@ -3275,24 +3300,22 @@ H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char * /* increment the index of ARRAY objects created on the container */ obj->file->remote_file.array_oid_index ++; + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); + /* 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.path = new_name; + input.path = loc_name; input.attr_name = attr_name; input.acpl_id = acpl_id; input.type_id = type_id; input.space_id = space_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; /* setup the local attribute struct */ /* store the entire path of the attribute locally */ @@ -3318,8 +3341,8 @@ H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char * attr->common.obj_name = strdup(attr_name); #if H5VL_IOD_DEBUG - printf("Attribute Create %s IOD ID %llu, axe id %llu, parent %llu\n", - attr_name, input.attr_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Attribute Create %s IOD ID %llu, axe id %llu\n", + attr_name, input.attr_id, g_axe_id); #endif /* copy property lists, dtype, and dspace*/ @@ -3337,15 +3360,16 @@ H5VL_iod_attribute_create(void *_obj, H5VL_loc_params_t loc_params, const char * if(H5VL__iod_create_and_forward(H5VL_ATTR_CREATE_ID, HG_ATTR_CREATE, (H5VL_iod_object_t *)attr, 1, - input.axe_info.num_parents, parent_req, - &input, &attr->remote_attr, attr, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, &attr->remote_attr, attr, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship attribute create"); ret_value = (void *)attr; done: - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_attribute_create() */ @@ -3365,27 +3389,46 @@ done: */ static void * H5VL_iod_attribute_open(void *_obj, H5VL_loc_params_t loc_params, const char *attr_name, - hid_t aapl_id, hid_t dxpl_id, void **req) + hid_t UNUSED aapl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the attribute */ H5VL_iod_attr_t *attr = NULL; /* the attribute object that is created and passed to the user */ attr_open_in_t input; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ const char *path; /* path on where the traversal starts relative to the location object specified */ + char *loc_name = NULL; iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; + H5P_genplist_t *plist = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent AXE id by traversing the path where the - attribute should be opened. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the attribute object that is returned to the user */ if(NULL == (attr = H5FL_CALLOC(H5VL_iod_attr_t))) @@ -3397,25 +3440,22 @@ H5VL_iod_attribute_open(void *_obj, H5VL_loc_params_t loc_params, const char *at attr->remote_attr.type_id = -1; attr->remote_attr.space_id = -1; + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); + /* 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.path = new_name; + input.path = loc_name; input.attr_name = attr_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.rcxt_num = rc->c_version; #if H5VL_IOD_DEBUG - printf("Attribute Open %s LOC ID %llu, axe id %llu, parent %llu\n", - attr_name, input.loc_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Attribute Open %s LOC ID %llu, axe id %llu\n", + attr_name, input.loc_id, g_axe_id); #endif /* setup the local attribute struct */ @@ -3449,15 +3489,15 @@ H5VL_iod_attribute_open(void *_obj, H5VL_loc_params_t loc_params, const char *at if(H5VL__iod_create_and_forward(H5VL_ATTR_OPEN_ID, HG_ATTR_OPEN, (H5VL_iod_object_t *)attr, 1, - input.axe_info.num_parents, parent_req, - &input, &attr->remote_attr, attr, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, &attr->remote_attr, attr, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship attribute open"); ret_value = (void *)attr; done: - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_attribute_open() */ @@ -3483,12 +3523,26 @@ H5VL_iod_attribute_read(void *_attr, hid_t type_id, void *buf, hid_t dxpl_id, vo hg_bulk_t *bulk_handle = NULL; H5VL_iod_read_status_t *status = NULL; size_t size; - H5VL_iod_io_info_t *info; - H5VL_iod_request_t **parent_req = NULL; + H5VL_iod_io_info_t *info = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + H5P_genplist_t *plist = NULL; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID") + if(-1 == attr->remote_attr.space_id) { HDassert(attr->common.request); /* Synchronously wait on the request attached to the attribute */ @@ -3508,27 +3562,22 @@ H5VL_iod_attribute_read(void *_attr, hid_t type_id, void *buf, hid_t dxpl_id, vo if(HG_SUCCESS != HG_Bulk_handle_create(buf, size, HG_BULK_READWRITE, bulk_handle)) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't create Bulk Data Handle"); - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)attr, (H5VL_iod_req_info_t *)rc, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = attr->common.file->remote_file.coh; input.iod_oh = attr->remote_attr.iod_oh; input.iod_id = attr->remote_attr.iod_id; input.bulk_handle = *bulk_handle; input.type_id = type_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != attr->common.request && attr->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &attr->common.request->axe_id; - attr->common.request->ref_count ++; - *parent_req = attr->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.rcxt_num = rc->c_version; /* allocate structure to receive status of read operation (contains return value and checksum */ status = (H5VL_iod_read_status_t *)malloc(sizeof(H5VL_iod_read_status_t)); @@ -3542,8 +3591,8 @@ H5VL_iod_attribute_read(void *_attr, hid_t type_id, void *buf, hid_t dxpl_id, vo if(H5VL__iod_create_and_forward(H5VL_ATTR_READ_ID, HG_ATTR_READ, (H5VL_iod_object_t *)attr, 0, - input.axe_info.num_parents, parent_req, - &input, status, info, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, status, info, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship attribute read"); done: @@ -3569,17 +3618,30 @@ H5VL_iod_attribute_write(void *_attr, hid_t type_id, const void *buf, hid_t dxpl { H5VL_iod_attr_t *attr = (H5VL_iod_attr_t *)_attr; attr_io_in_t input; - H5P_genplist_t *plist; + H5P_genplist_t *plist = NULL; hg_bulk_t *bulk_handle = NULL; int *status = NULL; size_t size; H5VL_iod_io_info_t *info; uint32_t cs; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + if(-1 == attr->remote_attr.space_id) { /* Synchronously wait on the request attached to the attribute */ if(H5VL_iod_request_wait(attr->common.file, attr->common.request) < 0) @@ -3604,34 +3666,26 @@ H5VL_iod_attribute_write(void *_attr, hid_t type_id, const void *buf, hid_t dxpl if(HG_SUCCESS != HG_Bulk_handle_create(buf, size, HG_BULK_READ_ONLY, bulk_handle)) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "can't create Bulk Data Handle"); - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)attr, (H5VL_iod_req_info_t *)tr, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = attr->common.file->remote_file.coh; input.iod_oh = attr->remote_attr.iod_oh; input.iod_id = attr->remote_attr.iod_id; input.bulk_handle = *bulk_handle; input.type_id = type_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != attr->common.request && attr->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &attr->common.request->axe_id; - attr->common.request->ref_count ++; - *parent_req = attr->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; status = (int *)malloc(sizeof(int)); - /* Get the dxpl plist structure */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_BADATOM, FAIL, "can't find object for ID") - /* setup info struct for I/O request This is to manage the I/O operation once the wait is called. */ if(NULL == (info = (H5VL_iod_io_info_t *)H5MM_malloc(sizeof(H5VL_iod_io_info_t)))) @@ -3641,8 +3695,8 @@ H5VL_iod_attribute_write(void *_attr, hid_t type_id, const void *buf, hid_t dxpl if(H5VL__iod_create_and_forward(H5VL_ATTR_WRITE_ID, HG_ATTR_WRITE, (H5VL_iod_object_t *)attr, 0, - input.axe_info.num_parents, parent_req, - &input, status, info, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, info, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship attribute write"); done: @@ -3671,48 +3725,66 @@ H5VL_iod_attribute_remove(void *_obj, H5VL_loc_params_t loc_params, const char * attr_op_in_t input; iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; + H5P_genplist_t *plist = NULL; + H5VL_iod_request_t **parent_reqs = NULL; int *status = NULL; + char *loc_name = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent AXE id by traversing the path where the - attribute should be removed. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); + + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* 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.path = new_name; + input.path = loc_name; input.attr_name = attr_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; status = (int *)malloc(sizeof(int)); if(H5VL__iod_create_and_forward(H5VL_ATTR_REMOVE_ID, HG_ATTR_REMOVE, (H5VL_iod_object_t *)obj, 1, - input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship attribute remove"); done: - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_attribute_remove() */ @@ -3737,11 +3809,26 @@ H5VL_iod_attribute_get(void *_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location of operation */ iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; + H5P_genplist_t *plist = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; + char *loc_name = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID") + switch (get_type) { /* H5Aget_space */ case H5VL_ATTR_GET_SPACE: @@ -3833,40 +3920,41 @@ H5VL_iod_attribute_get(void *_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); char *attr_name = va_arg (arguments, char *); htri_t *ret = va_arg (arguments, htri_t *); - char *new_name = NULL; attr_op_in_t input; - /* Retrieve the parent AXE id by traversing the path where the - attribute should be checked. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); + + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* 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.path = new_name; input.attr_name = attr_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.path = loc_name; + input.rcxt_num = rc->c_version; if(H5VL__iod_create_and_forward(H5VL_ATTR_EXISTS_ID, HG_ATTR_EXISTS, - obj, 1, input.axe_info.num_parents, parent_req, - &input, ret, ret, req) < 0) + obj, 1, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, ret, ret, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship attribute exists"); - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); break; } /* H5Aget_info */ @@ -3893,7 +3981,7 @@ H5VL_iod_attribute_get(void *_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, } case H5VL_ATTR_GET_STORAGE_SIZE: { - hsize_t *ret = va_arg (arguments, hsize_t *); + //hsize_t *ret = va_arg (arguments, hsize_t *); HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get attr storage size"); break; } @@ -3920,13 +4008,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_iod_attribute_close(void *_attr, hid_t dxpl_id, void **req) +H5VL_iod_attribute_close(void *_attr, hid_t UNUSED dxpl_id, void **req) { H5VL_iod_attr_t *attr = (H5VL_iod_attr_t *)_attr; attr_close_in_t input; int *status; - size_t num_parents; - AXE_task_t *parent_axe_ids = NULL; + size_t num_parents = 0; H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -3948,48 +4035,35 @@ H5VL_iod_attribute_close(void *_attr, hid_t dxpl_id, void **req) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't wait on all object requests"); } - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)attr, &num_parents, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)attr, &num_parents, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num requests"); if(num_parents) { - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * num_parents))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc (sizeof(H5VL_iod_request_t *) * num_parents))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)attr, &num_parents, - parent_axe_ids, parent_reqs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get AXE parents"); + + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)attr, &num_parents, + parent_reqs) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get parent requests"); } status = (int *)malloc(sizeof(int)); input.iod_oh = attr->remote_attr.iod_oh; input.iod_id = attr->remote_attr.iod_id; - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; - input.axe_info.axe_id = g_axe_id ++; #if H5VL_IOD_DEBUG - { - size_t i; - - printf("Attribute Close, axe id %llu, %d parents: ", - input.axe_info.axe_id, num_parents); - for(i=0 ; ifile->remote_file.coh; + input.target_name = target_name; + input.loc_name = loc_name; input.lcpl_id = lcpl_id; input.lapl_id = lapl_id; - input.loc_name = loc_name; - input.target_name = new_name; - input.axe_info.axe_id = g_axe_id ++; link_value = strdup("\0"); input.link_value = link_value; + + if(loc_name) + HDfree(loc_name); + if(target_name) + HDfree(target_name); + break; } case H5VL_LINK_CREATE_SOFT: { - char *target_name; + char *target_name = NULL, *loc_name = NULL; H5VL_iod_object_t *target_obj = NULL; H5VL_loc_params_t target_params; @@ -4110,32 +4216,42 @@ H5VL_iod_link_create(H5VL_link_create_type_t create_type, void *_obj, H5VL_loc_p /* Retrieve the parent info by traversing the path where the link should be created from. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &loc_name, &cur_obj) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); - /* Retrieve the parent info by traversing the path where the - target link should be created. */ - if(NULL == (target_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(target_obj, target_params, ".", - &input.target_loc_id, &input.target_loc_oh, - target_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &input.loc_id, &input.loc_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); + + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(target_obj, NULL, + &parent_reqs[num_parents], &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(target_obj, &input.target_loc_id, + &input.target_loc_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); /* set the input structure for the HG encode routine */ input.create_type = H5VL_LINK_CREATE_SOFT; input.coh = obj->file->remote_file.coh; - - input.axe_info.axe_id = g_axe_id ++; + input.loc_name = loc_name; + input.target_name = target_name; input.lcpl_id = lcpl_id; input.lapl_id = lapl_id; - input.loc_name = loc_name; - input.target_name = new_name; input.link_value = link_value; + if(loc_name) + HDfree(loc_name); + break; } /* MSC - not supported now */ @@ -4156,71 +4272,16 @@ H5VL_iod_link_create(H5VL_link_create_type_t create_type, void *_obj, H5VL_loc_p HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call") } - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * 2))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); - if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); - - if(NULL != parent_req[0] && NULL != target_req[0]) { - num_parents = 2; - parent_axe_ids[0] = parent_req[0]->axe_id; - parent_axe_ids[1] = target_req[0]->axe_id; - parent_reqs[0] = *parent_req; - parent_reqs[1] = *target_req; - } - else if (NULL != parent_req[0]) { - num_parents = 1; - parent_axe_ids[0] = parent_req[0]->axe_id; - parent_reqs[0] = *parent_req; - } - else if (NULL != target_req[0]) { - num_parents = 1; - parent_axe_ids[0] = target_req[0]->axe_id; - parent_reqs[0] = *target_req; - } - else { - num_parents = 0; - } - - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; - -#if H5VL_IOD_DEBUG - if(create_type == H5VL_LINK_CREATE_HARD) - printf("Hard Link Create axe %llu: %s ID %llu to %s ID %llu \n", - input.axe_info.axe_id, loc_name, input.loc_id, - new_name, input.target_loc_id); - else - printf("Soft Link Create axe %llu: %s ID %llu to %s ID %llu\n", - input.axe_info.axe_id, loc_name, input.loc_id, - new_name, input.target_loc_id); - - status = (herr_t *)malloc(sizeof(herr_t)); + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; - { - size_t i; - printf("Link Create Dependencies: "); - for(i=0 ; ifile->remote_file.coh; input.copy_flag = copy_flag; - input.axe_info.axe_id = g_axe_id ++; - input.lcpl_id = lcpl_id; - input.lapl_id = lapl_id; input.src_loc_name = src_name; input.dst_loc_name = dst_name; - - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * 2))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); - if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); - - if(NULL != src_req[0] && NULL != dst_req[0]) { - num_parents = 2; - parent_axe_ids[0] = src_req[0]->axe_id; - parent_axe_ids[1] = dst_req[0]->axe_id; - parent_reqs[0] = *src_req; - parent_reqs[1] = *dst_req; - } - else if (NULL != src_req[0]) { - num_parents = 1; - parent_axe_ids[0] = src_req[0]->axe_id; - parent_reqs[0] = *src_req; - } - else if (NULL != dst_req[0]) { - num_parents = 1; - parent_axe_ids[0] = dst_req[0]->axe_id; - parent_reqs[0] = *dst_req; - } - else { - num_parents = 0; - } - - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; - -#if H5VL_IOD_DEBUG - { - size_t i; - printf("Link Move Dependencies: "); - for(i=0 ; itrans_num; + input.rcxt_num = tr->c_version; status = (herr_t *)malloc(sizeof(herr_t)); if(H5VL__iod_create_and_forward(H5VL_LINK_MOVE_ID, HG_LINK_MOVE, cur_obj, 1, num_parents, parent_reqs, - &input, status, status, req) < 0) + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship link move"); done: - - parent_axe_ids = (AXE_task_t *)H5MM_xfree(parent_axe_ids); - src_req = (H5VL_iod_request_t **)H5MM_xfree(src_req); - dst_req = (H5VL_iod_request_t **)H5MM_xfree(dst_req); - if(src_name) free(src_name); - if(dst_name) free(dst_name); + if(src_name) + free(src_name); + if(dst_name) + free(dst_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_link_move() */ @@ -4387,7 +4431,6 @@ static herr_t H5VL_iod_link_iterate(void *_obj, H5VL_loc_params_t loc_params, hb H5L_iterate_t op, void *op_data, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; - hid_t temp_id; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -4416,12 +4459,41 @@ H5VL_iod_link_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_ hid_t dxpl_id, void **req, va_list arguments) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; + H5VL_iod_request_t **parent_reqs = NULL; + size_t num_parents = 0; + hid_t rcxt_id; + H5RC_t *rc; + H5P_genplist_t *plist = NULL; + iod_obj_id_t iod_id; + iod_handle_t iod_oh; + char *loc_name = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID"); + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); + switch (get_type) { /* H5Lexists */ case H5VL_LINK_EXISTS: @@ -4429,40 +4501,30 @@ H5VL_iod_link_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_ link_op_in_t input; htri_t *ret = va_arg (arguments, htri_t *); - /* Retrieve the parent info by traversing the path where the - link should be checked. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.path = new_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.rcxt_num = rc->c_version; + input.path = loc_name; #if H5VL_IOD_DEBUG - printf("Link Exists axe %llu: %s ID %llu axe %llu\n", - input.axe_info.axe_id, new_name, input.loc_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Link Exists axe %llu: %s ID %llu\n", + g_axe_id, loc_name, input.loc_id); #endif if(H5VL__iod_create_and_forward(H5VL_LINK_EXISTS_ID, HG_LINK_EXISTS, - obj, 0, input.axe_info.num_parents, parent_req, - &input, ret, ret, req) < 0) + obj, 0, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, ret, ret, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship link exists"); - if(new_name) - free(new_name); - + if(loc_name) + HDfree(loc_name); break; } /* H5Lget_info/H5Lget_info_by_idx */ @@ -4471,40 +4533,31 @@ H5VL_iod_link_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_ H5L_ff_info_t *linfo = va_arg (arguments, H5L_ff_info_t *); link_op_in_t input; - /* Retrieve the parent info by traversing the path where the - link should be checked. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.path = new_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.rcxt_num = rc->c_version; + input.path = loc_name; #if H5VL_IOD_DEBUG - printf("Link get info axe %llu: %s ID %llu axe %llu\n", - input.axe_info.axe_id, new_name, input.loc_id, - ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Link get info axe %llu: %s ID %llu\n", + g_axe_id, loc_name, input.loc_id); #endif if(H5VL__iod_create_and_forward(H5VL_LINK_GET_INFO_ID, HG_LINK_GET_INFO, - obj, 0, input.axe_info.num_parents, parent_req, - &input, linfo, linfo, req) < 0) + obj, 0, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, linfo, linfo, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship link get_info"); - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); + break; } /* H5Lget_val/H5Lget_val_by_idx */ @@ -4515,27 +4568,18 @@ H5VL_iod_link_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_ link_get_val_in_t input; link_get_val_out_t *result; - /* Retrieve the parent info by traversing the path where the - link should be checked. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.path = new_name; input.length = size; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.rcxt_num = rc->c_version; + input.path = loc_name; if(NULL == (result = (link_get_val_out_t *)malloc (sizeof(link_get_val_out_t)))) { @@ -4546,17 +4590,18 @@ H5VL_iod_link_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_ result->value.val = buf; #if H5VL_IOD_DEBUG - printf("Link get val axe %llu: %s ID %llu axe %llu\n", - input.axe_info.axe_id, new_name, input.loc_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Link get val axe %llu: %s ID %llu\n", + g_axe_id, loc_name, input.loc_id); #endif if(H5VL__iod_create_and_forward(H5VL_LINK_GET_VAL_ID, HG_LINK_GET_VAL, obj, 0, - input.axe_info.num_parents, parent_req, - &input, result, result, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, result, result, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship link get_val"); - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); + break; } /* H5Lget_name_by_idx */ @@ -4593,49 +4638,66 @@ H5VL_iod_link_remove(void *_obj, H5VL_loc_params_t loc_params, hid_t dxpl_id, vo H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; H5VL_iod_object_t *cur_obj; link_op_in_t input; - H5VL_iod_request_t **parent_req = NULL; + H5VL_iod_request_t **parent_reqs = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; + H5P_genplist_t *plist = NULL; int *status; - char *new_name = NULL; + char *loc_name = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent info by traversing the path where the - link should be removed. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, &cur_obj) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &input.loc_id, &input.loc_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); + + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.path = new_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.path = loc_name; + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; #if H5VL_IOD_DEBUG - printf("Link Remove axe %llu: %s ID %llu axe %llu\n", - input.axe_info.axe_id, new_name, input.loc_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Link Remove axe %llu: %s ID %llu\n", + g_axe_id, loc_name, input.loc_id); #endif status = (int *)malloc(sizeof(int)); if(H5VL__iod_create_and_forward(H5VL_LINK_REMOVE_ID, HG_LINK_REMOVE, cur_obj, 1, - input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship link remove"); done: - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_link_remove() */ @@ -4658,12 +4720,26 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to open the group */ - char *new_name = NULL; - H5VL_iod_request_t **parent_req = NULL; + H5P_genplist_t *plist = NULL; + hid_t rcxt_id; + H5RC_t *rc; + size_t num_parents = 0; + char *loc_name = NULL; + H5VL_iod_request_t **parent_reqs = NULL; void *ret_value; FUNC_ENTER_NOAPI_NOINIT + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID") + if(H5VL_OBJECT_BY_ADDR == loc_params.type) { switch(loc_params.loc_data.loc_by_addr.obj_type) { case H5O_TYPE_DATASET: @@ -4686,9 +4762,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, input.loc_oh.cookie = IOD_OH_UNDEFINED; input.name = "."; input.dapl_id = H5P_DATASET_ACCESS_DEFAULT; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; + input.rcxt_num = rc->c_version; dset->dapl_id = H5P_DATASET_ACCESS_DEFAULT; @@ -4700,7 +4774,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, if(H5VL__iod_create_and_forward(H5VL_DSET_OPEN_ID, HG_DSET_OPEN, (H5VL_iod_object_t *)dset, 1, 0, NULL, - &input, &dset->remote_dset, dset, req) < 0) + (H5VL_iod_req_info_t *)rc, &input, &dset->remote_dset, dset, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship dataset create"); *opened_type = H5I_DATASET; @@ -4727,9 +4801,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, input.loc_oh.cookie = IOD_OH_UNDEFINED; input.name = "."; input.tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; + input.rcxt_num = rc->c_version; dtype->tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; @@ -4741,7 +4813,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, if(H5VL__iod_create_and_forward(H5VL_DTYPE_OPEN_ID, HG_DTYPE_OPEN, (H5VL_iod_object_t *)dtype, 1, 0, NULL, - &input, &dtype->remote_dtype, dtype, req) < 0) + (H5VL_iod_req_info_t *)rc, &input, &dtype->remote_dtype, dtype, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship datatype open"); *opened_type = H5I_DATATYPE; @@ -4767,9 +4839,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, input.loc_oh.cookie = IOD_OH_UNDEFINED; input.name = "."; input.gapl_id = H5P_GROUP_ACCESS_DEFAULT; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; + input.rcxt_num = rc->c_version; grp->gapl_id = H5P_GROUP_ACCESS_DEFAULT; @@ -4781,7 +4851,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, if(H5VL__iod_create_and_forward(H5VL_GROUP_OPEN_ID, HG_GROUP_OPEN, (H5VL_iod_object_t *)grp, 1, 0, NULL, - &input, &grp->remote_group, grp, req) < 0) + (H5VL_iod_req_info_t *)rc, &input, &grp->remote_group, grp, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship group open"); *opened_type = H5I_GROUP; @@ -4809,9 +4879,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, input.loc_oh.cookie = IOD_OH_UNDEFINED; input.name = "."; input.mapl_id = H5P_GROUP_ACCESS_DEFAULT; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; + input.rcxt_num = rc->c_version; map->mapl_id = H5P_GROUP_ACCESS_DEFAULT; @@ -4823,7 +4891,7 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, if(H5VL__iod_create_and_forward(H5VL_MAP_OPEN_ID, HG_MAP_OPEN, (H5VL_iod_object_t *)map, 1, 0, NULL, - &input, &map->remote_map, map, req) < 0) + (H5VL_iod_req_info_t *)rc, &input, &map->remote_map, map, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship map open"); *opened_type = H5I_MAP; @@ -4839,34 +4907,39 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, object_op_in_t input; H5VL_iod_remote_object_t remote_obj; /* generic remote object structure */ - /* Retrieve the parent AXE id by traversing the path where the - object should be opened. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &input.loc_id, &input.loc_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); + + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.loc_name = new_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_name = loc_name; + input.rcxt_num = rc->c_version; if(H5VL__iod_create_and_forward(H5VL_OBJECT_OPEN_ID, HG_OBJECT_OPEN, - obj, 1, input.axe_info.num_parents, parent_req, - &input, &remote_obj, &remote_obj, req) < 0) + obj, 1, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, &remote_obj, &remote_obj, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship object open"); *opened_type = remote_obj.obj_type; + if(loc_name) + HDfree(loc_name); + switch(remote_obj.obj_type) { case H5I_DATASET: { @@ -5053,8 +5126,6 @@ H5VL_iod_object_open(void *_obj, H5VL_loc_params_t loc_params, } } done: - if(new_name) - free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_object_open */ @@ -5073,8 +5144,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_iod_object_copy(void *_src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *_dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, +H5VL_iod_object_copy(void *_src_obj, H5VL_loc_params_t UNUSED loc_params1, const char *src_name, + void *_dst_obj, H5VL_loc_params_t UNUSED loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { H5VL_iod_object_t *src_obj = (H5VL_iod_object_t *)_src_obj; @@ -5082,96 +5153,62 @@ H5VL_iod_object_copy(void *_src_obj, H5VL_loc_params_t loc_params1, const char * H5VL_iod_object_t *cur_obj; object_copy_in_t input; int *status; - char *new_src_name = NULL, *new_dst_name = NULL; - size_t num_parents; - AXE_task_t *parent_axe_ids = NULL; H5VL_iod_request_t **parent_reqs = NULL; - H5VL_iod_request_t **src_req; - H5VL_iod_request_t **dst_req; + H5P_genplist_t *plist = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent information by traversing the path where the - link should be moved from. */ - if(NULL == (src_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(src_obj, loc_params1, src_name, - &input.src_loc_id, &input.src_loc_oh, - src_req, &new_src_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); - - /* Retrieve the parent information by traversing the path where the - link should be moved to. */ - if(NULL == (dst_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(dst_obj, loc_params2, dst_name, - &input.dst_loc_id, &input.dst_loc_oh, - dst_req, &new_dst_name, &cur_obj) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); - /* set the input structure for the HG encode routine */ - input.coh = src_obj->file->remote_file.coh; - input.axe_info.axe_id = g_axe_id ++; - input.lcpl_id = lcpl_id; - input.ocpypl_id = ocpypl_id; - input.src_loc_name = new_src_name; - input.dst_loc_name = new_dst_name; + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * 2))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); - if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 3))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(NULL != src_req[0] && NULL != dst_req[0]) { - num_parents = 2; - parent_axe_ids[0] = src_req[0]->axe_id; - parent_axe_ids[1] = dst_req[0]->axe_id; - parent_reqs[0] = *src_req; - parent_reqs[1] = *dst_req; - } - else if (NULL != src_req[0]) { - num_parents = 1; - parent_axe_ids[0] = src_req[0]->axe_id; - parent_reqs[0] = *src_req; - } - else if (NULL != dst_req[0]) { - num_parents = 1; - parent_axe_ids[0] = dst_req[0]->axe_id; - parent_reqs[0] = *dst_req; - } - else { - num_parents = 0; - } + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(src_obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(src_obj, &input.src_loc_id, &input.src_loc_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(dst_obj, NULL, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(dst_obj, &input.dst_loc_id, &input.dst_loc_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); -#if H5VL_IOD_DEBUG - { - size_t i; - printf("Object Copy Dependencies: "); - for(i=0 ; ifile->remote_file.coh; + input.src_loc_name = src_name; + input.dst_loc_name = dst_name; + input.lcpl_id = lcpl_id; + input.ocpypl_id = ocpypl_id; + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; status = (herr_t *)malloc(sizeof(herr_t)); if(H5VL__iod_create_and_forward(H5VL_OBJECT_COPY_ID, HG_OBJECT_COPY, (H5VL_iod_object_t *)cur_obj, 1, num_parents, parent_reqs, - &input, status, status, req) < 0) + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship object copy"); done: - parent_axe_ids = (AXE_task_t *)H5MM_xfree(parent_axe_ids); - src_req = (H5VL_iod_request_t **)H5MM_xfree(src_req); - dst_req = (H5VL_iod_request_t **)H5MM_xfree(dst_req); - if(new_src_name) free(new_src_name); - if(new_dst_name) free(new_dst_name); - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_object_copy() */ @@ -5194,7 +5231,6 @@ static herr_t H5VL_iod_object_visit(void *_obj, H5VL_loc_params_t loc_params, H5 hid_t dxpl_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; - hid_t temp_id; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -5223,58 +5259,80 @@ H5VL_iod_object_misc(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_misc_ hid_t dxpl_id, void **req, va_list arguments) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; + iod_obj_id_t iod_id; + iod_handle_t iod_oh; int *status = NULL; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + hid_t trans_id; + H5TR_t *tr; + H5P_genplist_t *plist = NULL; + H5VL_iod_request_t **parent_reqs = NULL; + char *loc_name = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* get the transaction ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_TRANS_ID, &trans_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); + switch (misc_type) { /* H5Arename/rename_by_name */ case H5VL_ATTR_RENAME: { const char *old_name = va_arg (arguments, const char *); const char *new_name = va_arg (arguments, const char *); - char *loc_name = NULL; attr_rename_in_t input; - /* Retrieve the parent AXE id by traversing the path where the - attribute is located. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &loc_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.path = loc_name; input.old_attr_name = old_name; input.new_attr_name = new_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.path = loc_name; + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; #if H5VL_IOD_DEBUG - printf("Attribute Rename %s to %s LOC ID %llu, axe id %llu, parent %llu\n", - old_name, new_name, input.loc_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Attribute Rename %s to %s LOC ID %llu, axe id %llu\n", + old_name, new_name, input.loc_id, g_axe_id); #endif status = (herr_t *)malloc(sizeof(herr_t)); if(H5VL__iod_create_and_forward(H5VL_ATTR_RENAME_ID, HG_ATTR_RENAME, - obj, 1, input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + obj, 1, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship attribute rename"); if(loc_name) - free(loc_name); + HDfree(loc_name); + break; } /* H5Oset_comment */ @@ -5282,35 +5340,26 @@ H5VL_iod_object_misc(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_misc_ { const char *comment = va_arg (arguments, char *); object_set_comment_in_t input; - char *loc_name = NULL; - /* Retrieve the parent AXE id by traversing the path where the - object is located. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &loc_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.path = loc_name; input.comment = comment; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.path = loc_name; + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; status = (herr_t *)malloc(sizeof(herr_t)); if(H5VL__iod_create_and_forward(H5VL_OBJECT_SET_COMMENT_ID, HG_OBJECT_SET_COMMENT, - obj, 0, input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + obj, 0, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship object set_comment"); /* store the comment locally if the object is open */ @@ -5318,16 +5367,17 @@ H5VL_iod_object_misc(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_misc_ obj->comment = HDstrdup(comment); if(loc_name) - free(loc_name); + HDfree(loc_name); break; } /* H5Oincr_refcount / H5Odecr_refcount */ case H5VL_OBJECT_CHANGE_REF_COUNT: { - int update_ref = va_arg (arguments, int); + //int update_ref = va_arg (arguments, int); } case H5VL_REF_CREATE: { + /* void *ref = va_arg (arguments, void *); const char *name = va_arg (arguments, char *); H5R_type_t ref_type = va_arg (arguments, H5R_type_t); @@ -5338,6 +5388,7 @@ H5VL_iod_object_misc(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_misc_ ref_size = sizeof(hdset_reg_ref_t); else if (ref_type == H5R_OBJECT) ref_size = sizeof(hobj_ref_t); + */ } default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") @@ -5366,13 +5417,41 @@ H5VL_iod_object_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t hid_t dxpl_id, void **req, va_list arguments) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; - int *status; - char *new_name = NULL; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + hid_t rcxt_id; + H5RC_t *rc; + H5P_genplist_t *plist = NULL; + iod_obj_id_t iod_id; + iod_handle_t iod_oh; + H5VL_iod_request_t **parent_reqs = NULL; + char *loc_name = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID"); + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current location group info"); + switch (get_type) { /* H5Oexists_by_name */ case H5VL_OBJECT_EXISTS: @@ -5380,39 +5459,30 @@ H5VL_iod_object_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t htri_t *ret = va_arg (arguments, htri_t *); object_op_in_t input; - /* Retrieve the parent info by traversing the path where the - object should be checked. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.axe_info.axe_id = g_axe_id ++; - input.loc_name = new_name; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.rcxt_num = rc->c_version; + input.loc_name = loc_name; #if H5VL_IOD_DEBUG - printf("Object Exists axe %llu: %s ID %llu axe %llu\n", - input.axe_info.axe_id, new_name, input.loc_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Object Exists axe %llu: %s ID %llu\n", + g_axe_id, input.loc_name, input.loc_id); #endif if(H5VL__iod_create_and_forward(H5VL_OBJECT_EXISTS_ID, HG_OBJECT_EXISTS, - obj, 0, input.axe_info.num_parents, parent_req, - &input, ret, ret, req) < 0) + obj, 0, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, ret, ret, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship object exists"); - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); break; } /* H5Oget_comment / H5Oget_comment_by_name */ @@ -5442,30 +5512,21 @@ H5VL_iod_object_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t /* Otherwise Go to the server */ - /* Retrieve the parent info by traversing the path where the - object should be checked. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.path = new_name; + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.rcxt_num = rc->c_version; + input.path = loc_name; if(comment) input.length = size; else input.length = 0; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } if(NULL == (result = (object_get_comment_out_t *)malloc (sizeof(object_get_comment_out_t)))) { @@ -5477,17 +5538,17 @@ H5VL_iod_object_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t result->name.value = comment; #if H5VL_IOD_DEBUG - printf("Object Get Comment axe %llu: %s ID %llu axe %llu\n", - input.axe_info.axe_id, new_name, input.loc_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Object Get Comment axe %llu: %s ID %llu\n", + g_axe_id, loc_name, input.loc_id); #endif if(H5VL__iod_create_and_forward(H5VL_OBJECT_GET_COMMENT_ID, HG_OBJECT_GET_COMMENT, - obj, 0, input.axe_info.num_parents, parent_req, - &input, result, result, req) < 0) + obj, 0, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, result, result, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship object get_comment"); - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); break; } /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ @@ -5496,64 +5557,55 @@ H5VL_iod_object_get(void *_obj, H5VL_loc_params_t loc_params, H5VL_object_get_t H5O_ff_info_t *oinfo = va_arg (arguments, H5O_ff_info_t *); object_op_in_t input; - /* Retrieve the parent info by traversing the path where the - object should be checked. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, ".", &input.loc_id, &input.loc_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to resolve current working group"); + if(H5VL_OBJECT_BY_SELF == loc_params.type) + loc_name = strdup("."); + else if(H5VL_OBJECT_BY_NAME == loc_params.type) + loc_name = strdup(loc_params.loc_data.loc_by_name.name); /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; - input.loc_name = new_name; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.rcxt_num = rc->c_version; + input.loc_name = loc_name; #if H5VL_IOD_DEBUG - printf("Object get_info axe %llu: %s ID %llu axe %llu\n", - input.axe_info.axe_id, new_name, input.loc_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Object get_info axe %llu: %s ID %llu\n", + g_axe_id, input.loc_name, input.loc_id); #endif if(H5VL__iod_create_and_forward(H5VL_OBJECT_GET_INFO_ID, HG_OBJECT_GET_INFO, - obj, 0, input.axe_info.num_parents, parent_req, - &input, oinfo, oinfo, req) < 0) + obj, 0, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, oinfo, oinfo, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship object get_info"); - if(new_name) - free(new_name); + if(loc_name) + HDfree(loc_name); break; } /* H5Rget_region */ case H5VL_REF_GET_REGION: { - hid_t *ret = va_arg (arguments, hid_t *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - H5S_t *space = NULL; /* Dataspace object */ + //hid_t *ret = va_arg (arguments, hid_t *); + //H5R_type_t ref_type = va_arg (arguments, H5R_type_t); + //void *ref = va_arg (arguments, void *); + //H5S_t *space = NULL; /* Dataspace object */ } /* H5Rget_obj_type2 */ case H5VL_REF_GET_TYPE: { - H5O_type_t *obj_type = va_arg (arguments, H5O_type_t *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - const void *ref = va_arg (arguments, const void *); + //H5O_type_t *obj_type = va_arg (arguments, H5O_type_t *); + //H5R_type_t ref_type = va_arg (arguments, H5R_type_t); + //const void *ref = va_arg (arguments, const void *); } /* H5Rget_name */ case H5VL_REF_GET_NAME: { - ssize_t *ret = va_arg (arguments, ssize_t *); - char *name = va_arg (arguments, char *); - size_t size = va_arg (arguments, size_t); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); + //ssize_t *ret = va_arg (arguments, ssize_t *); + //char *name = va_arg (arguments, char *); + //size_t size = va_arg (arguments, size_t); + //H5R_type_t ref_type = va_arg (arguments, H5R_type_t); + //void *ref = va_arg (arguments, void *); } default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") @@ -5563,7 +5615,7 @@ done: } /* end H5VL_iod_object_get() */ void * -H5VL_iod_map_create(void *_obj, H5VL_loc_params_t loc_params, const char *name, +H5VL_iod_map_create(void *_obj, H5VL_loc_params_t UNUSED loc_params, const char *name, hid_t keytype, hid_t valtype, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id, hid_t trans_id, void **req) { @@ -5572,19 +5624,29 @@ H5VL_iod_map_create(void *_obj, H5VL_loc_params_t loc_params, const char *name, map_create_in_t input; iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ + H5VL_iod_request_t **parent_reqs = NULL; + size_t num_parents = 0; + H5TR_t *tr; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent AXE id by traversing the path where the - map should be created. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a Transaction ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the map object that is returned to the user */ if(NULL == (map = H5FL_CALLOC(H5VL_iod_map_t))) @@ -5607,25 +5669,18 @@ H5VL_iod_map_create(void *_obj, H5VL_loc_params_t loc_params, const char *name, input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.keytype_id = keytype; input.valtype_id = valtype; input.mcpl_id = mcpl_id; input.mapl_id = mapl_id; input.lcpl_id = lcpl_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; #if H5VL_IOD_DEBUG - printf("Map Create %s, IOD ID %llu, axe id %llu, parent %llu\n", - new_name, input.map_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Map Create %s, IOD ID %llu, axe id %llu\n", + name, input.map_id, g_axe_id); #endif /* setup the local map struct */ @@ -5658,40 +5713,48 @@ H5VL_iod_map_create(void *_obj, H5VL_loc_params_t loc_params, const char *name, if(H5VL__iod_create_and_forward(H5VL_MAP_CREATE_ID, HG_MAP_CREATE, (H5VL_iod_object_t *)map, 1, - input.axe_info.num_parents, parent_req, - &input, &map->remote_map, map, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, &map->remote_map, map, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship map create"); ret_value = (void *)map; done: - if(new_name) - free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_map_create() */ void * -H5VL_iod_map_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, hid_t mapl_id, - hid_t rcxt_id, void **req) +H5VL_iod_map_open(void *_obj, H5VL_loc_params_t UNUSED loc_params, const char *name, + hid_t mapl_id, hid_t rcxt_id, void **req) { H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the group */ H5VL_iod_map_t *map = NULL; /* the map object that is created and passed to the user */ map_open_in_t input; iod_obj_id_t iod_id; iod_handle_t iod_oh; - H5VL_iod_request_t **parent_req = NULL; - char *new_name = NULL; /* resolved path to where we need to start traversal at the server */ + H5VL_iod_request_t **parent_reqs = NULL; + H5RC_t *rc; + size_t num_parents = 0; void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT - /* Retrieve the parent AXE id by traversing the path where the - map should be created. */ - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); - if(H5VL_iod_get_parent_info(obj, loc_params, name, &iod_id, &iod_oh, - parent_req, &new_name, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current working group"); + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID") + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location group info"); /* allocate the map object that is returned to the user */ if(NULL == (map = H5FL_CALLOC(H5VL_iod_map_t))) @@ -5706,21 +5769,13 @@ H5VL_iod_map_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, hi input.coh = obj->file->remote_file.coh; input.loc_id = iod_id; input.loc_oh = iod_oh; - input.name = new_name; + input.name = name; input.mapl_id = mapl_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != parent_req[0]) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &parent_req[0]->axe_id; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - } + input.rcxt_num = rc->c_version; #if H5VL_IOD_DEBUG - printf("Map Open %s LOC ID %llu, axe id %llu, parent %llu, name len %zu\n", - new_name, input.loc_id, input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0), strlen(input.name)); + printf("Map Open %s LOC ID %llu, axe id %llu\n", + name, input.loc_id, g_axe_id); #endif /* setup the local map struct */ @@ -5746,14 +5801,13 @@ H5VL_iod_map_open(void *_obj, H5VL_loc_params_t loc_params, const char *name, hi map->common.file->nopen_objs ++; if(H5VL__iod_create_and_forward(H5VL_MAP_OPEN_ID, HG_MAP_OPEN, (H5VL_iod_object_t *)map, 1, - input.axe_info.num_parents, parent_req, - &input, &map->remote_map, map, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, &map->remote_map, map, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship map open"); ret_value = (void *)map; done: - if(new_name) free(new_name); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_map_open() */ @@ -5766,7 +5820,9 @@ H5VL_iod_map_set(void *_map, hid_t key_mem_type_id, const void *key, map_set_in_t input; size_t key_size, val_size; int *status = NULL; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + H5TR_t *tr; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -5795,9 +5851,19 @@ H5VL_iod_map_set(void *_map, hid_t key_mem_type_id, const void *key, val_size = H5T_GET_SIZE(dt); } - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)map, (H5VL_iod_req_info_t *)tr, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = map->common.file->remote_file.coh; input.iod_oh = map->remote_map.iod_oh; @@ -5811,30 +5877,19 @@ H5VL_iod_map_set(void *_map, hid_t key_mem_type_id, const void *key, input.val_memtype_id = val_mem_type_id; input.val.buf_size = val_size; input.val.buf = value; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != map->common.request && map->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &map->common.request->axe_id; - map->common.request->ref_count ++; - *parent_req = map->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG - printf("MAP set, axe id %llu, parent %llu\n", - input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("MAP set, axe id %llu\n", g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_MAP_SET_ID, HG_MAP_SET, (H5VL_iod_object_t *)map, 0, - input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship map set"); done: @@ -5850,7 +5905,9 @@ H5VL_iod_map_get(void *_map, hid_t key_mem_type_id, const void *key, map_get_in_t input; map_get_out_t *output; size_t key_size, val_size; - H5VL_iod_request_t **parent_req = NULL; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -5879,9 +5936,19 @@ H5VL_iod_map_get(void *_map, hid_t key_mem_type_id, const void *key, val_size = H5T_GET_SIZE(dt); } - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID") + + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)map, (H5VL_iod_req_info_t *)rc, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = map->common.file->remote_file.coh; input.iod_oh = map->remote_map.iod_oh; @@ -5893,22 +5960,10 @@ H5VL_iod_map_get(void *_map, hid_t key_mem_type_id, const void *key, input.key.buf_size = key_size; input.key.buf = key; input.val_memtype_id = val_mem_type_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != map->common.request && map->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &map->common.request->axe_id; - map->common.request->ref_count ++; - *parent_req = map->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.rcxt_num = rc->c_version; #if H5VL_IOD_DEBUG - printf("MAP Get, axe id %llu, parent %llu\n", - input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("MAP Get, axe id %llu\n", g_axe_id); #endif if(NULL == (output = (map_get_out_t *)H5MM_calloc(sizeof(map_get_out_t)))) @@ -5919,8 +5974,8 @@ H5VL_iod_map_get(void *_map, hid_t key_mem_type_id, const void *key, if(H5VL__iod_create_and_forward(H5VL_MAP_GET_ID, HG_MAP_GET, (H5VL_iod_object_t *)map, 0, - input.axe_info.num_parents, parent_req, - &input, output, output, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, output, output, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship map get"); done: @@ -5929,7 +5984,7 @@ done: herr_t H5VL_iod_map_get_types(void *_map, hid_t *key_type_id, hid_t *val_type_id, - hid_t rcxt_id, void **req) + hid_t UNUSED rcxt_id, void UNUSED **req) { H5VL_iod_map_t *map = (H5VL_iod_map_t *)_map; herr_t ret_value = SUCCEED; @@ -5960,40 +6015,40 @@ H5VL_iod_map_get_count(void *_map, hsize_t *count, hid_t rcxt_id, void **req) { H5VL_iod_map_t *map = (H5VL_iod_map_t *)_map; map_get_count_in_t input; - H5VL_iod_request_t **parent_req = NULL; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID") + + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)map, (H5VL_iod_req_info_t *)rc, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = map->common.file->remote_file.coh; input.iod_oh = map->remote_map.iod_oh; input.iod_id = map->remote_map.iod_id; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != map->common.request && map->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &map->common.request->axe_id; - map->common.request->ref_count ++; - *parent_req = map->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.rcxt_num = rc->c_version; #if H5VL_IOD_DEBUG - printf("MAP Get count, axe id %llu, parent %llu\n", - input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("MAP Get count, axe id %llu\n", g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_MAP_GET_COUNT_ID, HG_MAP_GET_COUNT, (H5VL_iod_object_t *)map, 0, - input.axe_info.num_parents, parent_req, - &input, count, count, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, count, count, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship map get_count"); done: @@ -6007,7 +6062,9 @@ H5VL_iod_map_exists(void *_map, hid_t key_mem_type_id, const void *key, H5VL_iod_map_t *map = (H5VL_iod_map_t *)_map; map_op_in_t input; size_t key_size; - H5VL_iod_request_t **parent_req = NULL; + H5RC_t *rc; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -6021,9 +6078,19 @@ H5VL_iod_map_exists(void *_map, hid_t key_mem_type_id, const void *key, key_size = H5T_GET_SIZE(dt); } - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID") + + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)map, (H5VL_iod_req_info_t *)rc, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = map->common.file->remote_file.coh; input.iod_oh = map->remote_map.iod_oh; @@ -6032,28 +6099,16 @@ H5VL_iod_map_exists(void *_map, hid_t key_mem_type_id, const void *key, input.key_memtype_id = key_mem_type_id; input.key.buf_size = key_size; input.key.buf = key; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != map->common.request && map->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &map->common.request->axe_id; - map->common.request->ref_count ++; - *parent_req = map->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.rcxt_num = rc->c_version; #if H5VL_IOD_DEBUG - printf("MAP EXISTS, axe id %llu, parent %llu\n", - input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("MAP EXISTS, axe id %llu\n", g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_MAP_EXISTS_ID, HG_MAP_EXISTS, (H5VL_iod_object_t *)map, 0, - input.axe_info.num_parents, parent_req, - &input, exists, exists, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, exists, exists, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship map exists"); done: @@ -6080,7 +6135,9 @@ H5VL_iod_map_delete(void *_map, hid_t key_mem_type_id, const void *key, map_op_in_t input; size_t key_size; int *status = NULL; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + H5TR_t *tr; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -6094,9 +6151,19 @@ H5VL_iod_map_delete(void *_map, hid_t key_mem_type_id, const void *key, key_size = H5T_GET_SIZE(dt); } - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") + + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests((H5VL_iod_object_t *)map, (H5VL_iod_req_info_t *)tr, + parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* Fill input structure */ input.coh = map->common.file->remote_file.coh; input.iod_oh = map->remote_map.iod_oh; @@ -6105,30 +6172,19 @@ H5VL_iod_map_delete(void *_map, hid_t key_mem_type_id, const void *key, input.key_memtype_id = key_mem_type_id; input.key.buf_size = key_size; input.key.buf = key; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != map->common.request && map->common.request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &map->common.request->axe_id; - map->common.request->ref_count ++; - *parent_req = map->common.request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } + input.trans_num = tr->trans_num; + input.rcxt_num = tr->c_version; #if H5VL_IOD_DEBUG - printf("MAP DELETE, axe id %llu, parent %llu\n", - input.axe_info.axe_id, ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("MAP DELETE, axe id %llu\n", g_axe_id); #endif status = (int *)malloc(sizeof(int)); if(H5VL__iod_create_and_forward(H5VL_MAP_DELETE_ID, HG_MAP_DELETE, (H5VL_iod_object_t *)map, 1, - input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + num_parents, parent_reqs, + (H5VL_iod_req_info_t *)tr, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship map delete"); done: @@ -6140,8 +6196,7 @@ herr_t H5VL_iod_map_close(void *_map, void **req) H5VL_iod_map_t *map = (H5VL_iod_map_t *)_map; map_close_in_t input; int *status; - size_t num_parents; - AXE_task_t *parent_axe_ids = NULL; + size_t num_parents = 0; H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; @@ -6154,47 +6209,34 @@ herr_t H5VL_iod_map_close(void *_map, void **req) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't wait on all object requests"); } - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)map, &num_parents, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)map, &num_parents, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get num requests"); if(num_parents) { - if(NULL == (parent_axe_ids = (AXE_task_t *)H5MM_malloc(sizeof(AXE_task_t) * num_parents))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent axe IDs"); if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc (sizeof(H5VL_iod_request_t *) * num_parents))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); - if(H5VL_iod_get_axe_parents((H5VL_iod_object_t *)map, &num_parents, - parent_axe_ids, parent_reqs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get AXE parents"); + if(H5VL_iod_get_obj_requests((H5VL_iod_object_t *)map, &num_parents, + parent_reqs) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get parents requests"); } input.iod_oh = map->remote_map.iod_oh; input.iod_id = map->remote_map.iod_id; - input.axe_info.num_parents = num_parents; - input.axe_info.parent_axe_ids = parent_axe_ids; - input.axe_info.axe_id = g_axe_id ++; #if H5VL_IOD_DEBUG - { - size_t i; - - printf("Map Close %s, axe id %llu, %d parents: ", - map->common.obj_name, input.axe_info.axe_id, num_parents); - for(i=0 ; iremote_file.coh; input.c_version = *c_version; input.rcapl_id = rcapl_id; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; /* setup the info structure for updating the RC on completion */ if(NULL == (rc_info = (H5VL_iod_rc_info_t *)H5MM_calloc(sizeof(H5VL_iod_rc_info_t)))) @@ -6438,23 +6477,20 @@ H5VL_iod_rc_acquire(H5VL_iod_file_t *file, H5RC_t *rc, uint64_t *c_version, #if H5VL_IOD_DEBUG printf("Read Context Acquire, version %llu, axe id %llu\n", - input.c_version, input.axe_info.axe_id); + input.c_version, g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_RC_ACQUIRE_ID, HG_RC_ACQUIRE, (H5VL_iod_object_t *)file, 0, 0, NULL, - &input, &rc_info->result, rc_info, req) < 0) + NULL, &input, &rc_info->result, rc_info, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); -#if 0 - /* MSC - this is not needed because the user is repsonsible to wait on the acquire */ if(NULL != req) { H5VL_iod_request_t *request = (H5VL_iod_request_t *)(*req); - rc->request = request; - request->ref_count ++; + rc->req_info.request = request; + //request->ref_count ++; } -#endif done: FUNC_LEAVE_NOAPI(ret_value) @@ -6479,35 +6515,89 @@ H5VL_iod_rc_release(H5RC_t *rc, void **req) { rc_release_in_t input; int *status = NULL; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT + if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc + (sizeof(H5VL_iod_request_t *) * (rc->req_info.num_req + 1)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); + + /* retrieve start request */ + if(H5VL_iod_get_parent_requests(NULL, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + if(rc->req_info.num_req) { + H5VL_iod_request_t *cur_req = rc->req_info.head; + H5VL_iod_request_t *next_req = NULL; + H5VL_iod_request_t *prev; + H5VL_iod_request_t *next; + + while(cur_req) { + if(cur_req->state == H5VL_IOD_PENDING) { + parent_reqs[num_parents] = cur_req; + cur_req->ref_count ++; + num_parents ++; + } + + next_req = cur_req->trans_next; + + /* remove the current request from the linked list */ + prev = cur_req->trans_prev; + next = cur_req->trans_next; + if (prev) { + if (next) { + prev->trans_next = next; + next->trans_prev = prev; + } + else { + prev->trans_next = NULL; + rc->req_info.tail = prev; + } + } + else { + if (next) { + next->trans_prev = NULL; + rc->req_info.head = next; + } + else { + rc->req_info.head = NULL; + rc->req_info.tail = NULL; + } + } + + cur_req->trans_prev = NULL; + cur_req->trans_next = NULL; + + rc->req_info.num_req --; + + cur_req = next_req; + } + HDassert(0 == rc->req_info.num_req); + } + /* set the input structure for the HG encode routine */ input.coh = rc->file->remote_file.coh; input.c_version = rc->c_version; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG printf("Read Context Release, version %llu, axe id %llu\n", - input.c_version, input.axe_info.axe_id); + input.c_version, g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_RC_RELEASE_ID, HG_RC_RELEASE, - (H5VL_iod_object_t *)rc->file, 0, 0, NULL, - &input, status, status, req) < 0) + (H5VL_iod_object_t *)rc->file, 0, + num_parents, parent_reqs, + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); -#if 0 - /* MSC - this is not needed because the user is repsonsible to wait on the acquire */ - if(NULL != rc->request) { - H5VL_iod_request_decr_rc(rc->request); - } -#endif + //if(NULL != rc->req_info.request) { + //H5VL_iod_request_decr_rc(rc->req_info.request); + //} done: FUNC_LEAVE_NOAPI(ret_value) @@ -6539,20 +6629,17 @@ H5VL_iod_rc_persist(H5RC_t *rc, void **req) /* set the input structure for the HG encode routine */ input.coh = rc->file->remote_file.coh; input.c_version = rc->c_version; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG printf("Read Context Persist, version %llu, axe id %llu\n", - input.c_version, input.axe_info.axe_id); + input.c_version, g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_RC_PERSIST_ID, HG_RC_PERSIST, (H5VL_iod_object_t *)rc->file, 0, 0, NULL, - &input, status, status, req) < 0) + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); done: @@ -6586,20 +6673,17 @@ H5VL_iod_rc_snapshot(H5RC_t *rc, const char *snapshot_name, void **req) input.coh = rc->file->remote_file.coh; input.c_version = rc->c_version; input.snapshot_name = snapshot_name; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG printf("Read Context Snapshot, version %llu, axe id %llu\n", - input.c_version, input.axe_info.axe_id); + input.c_version, g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_RC_SNAPSHOT_ID, HG_RC_SNAPSHOT, (H5VL_iod_object_t *)rc->file, 0, 0, NULL, - &input, status, status, req) < 0) + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); done: @@ -6633,27 +6717,22 @@ H5VL_iod_tr_start(H5TR_t *tr, hid_t trspl_id, void **req) input.coh = tr->file->remote_file.coh; input.trans_num = tr->trans_num; input.trspl_id = trspl_id; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG printf("Transaction start, number %llu, axe id %llu\n", - input.trans_num, input.axe_info.axe_id); + input.trans_num, g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_TR_START_ID, HG_TR_START, (H5VL_iod_object_t *)tr->file, 0, 0, NULL, - &input, status, status, req) < 0) + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); if(NULL != req) { H5VL_iod_request_t *request = (H5VL_iod_request_t *)(*req); - - tr->request = request; - request->ref_count ++; + tr->req_info.request = request; } done: @@ -6679,52 +6758,92 @@ H5VL_iod_tr_finish(H5TR_t *tr, hbool_t acquire, hid_t trfpl_id, void **req) { tr_finish_in_t input; int *status = NULL; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + if(NULL == (parent_reqs = (H5VL_iod_request_t **)H5MM_malloc + (sizeof(H5VL_iod_request_t *) * (tr->req_info.num_req + 1)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate array of parent reqs"); + + /* retrieve start request */ + if(H5VL_iod_get_parent_requests(NULL, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + + if(tr->req_info.num_req) { + H5VL_iod_request_t *cur_req = tr->req_info.head; + H5VL_iod_request_t *next_req = NULL; + H5VL_iod_request_t *prev; + H5VL_iod_request_t *next; + + while(cur_req) { + /* add a dependency if the current request in the list is pending */ + if(cur_req->state == H5VL_IOD_PENDING) { + parent_reqs[num_parents] = cur_req; + cur_req->ref_count ++; + num_parents ++; + } + + next_req = cur_req->trans_next; + + /* remove the current request from the linked list */ + prev = cur_req->trans_prev; + next = cur_req->trans_next; + if (prev) { + if (next) { + prev->trans_next = next; + next->trans_prev = prev; + } + else { + prev->trans_next = NULL; + tr->req_info.tail = prev; + } + } + else { + if (next) { + next->trans_prev = NULL; + tr->req_info.head = next; + } + else { + tr->req_info.head = NULL; + tr->req_info.tail = NULL; + } + } + + cur_req->trans_prev = NULL; + cur_req->trans_next = NULL; + + tr->req_info.num_req --; + + cur_req = next_req; + } + HDassert(0 == tr->req_info.num_req); + } /* set the input structure for the HG encode routine */ input.coh = tr->file->remote_file.coh; input.trans_num = tr->trans_num; input.trfpl_id = trfpl_id; input.acquire = acquire; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - - if(NULL != tr->request && tr->request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &tr->request->axe_id; - tr->request->ref_count ++; - *parent_req = tr->request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG - printf("Transaction Finish, %llu, axe id %llu, Parent %llu\n", - input.trans_num, input.axe_info.axe_id, - ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Transaction Finish, %llu, axe id %llu\n", + input.trans_num, g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_TR_FINISH_ID, HG_TR_FINISH, (H5VL_iod_object_t *)tr->file, 0, - input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + num_parents, parent_reqs, + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); - if(NULL != tr->request) { - H5VL_iod_request_decr_rc(tr->request); - } + //if(NULL != tr->req_info.request) { + //H5VL_iod_request_decr_rc(tr->req_info.request); + //} done: FUNC_LEAVE_NOAPI(ret_value) @@ -6749,44 +6868,36 @@ H5VL_iod_tr_set_dependency(H5TR_t *tr, uint64_t trans_num, void **req) { tr_set_depend_in_t input; int *status = NULL; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(NULL, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* set the input structure for the HG encode routine */ input.coh = tr->file->remote_file.coh; input.child_trans_num = tr->trans_num; input.parent_trans_num = trans_num; - input.axe_info.axe_id = g_axe_id ++; - - if(NULL != tr->request && tr->request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &tr->request->axe_id; - tr->request->ref_count ++; - *parent_req = tr->request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; - } #if H5VL_IOD_DEBUG - printf("Transaction Set Dependency, %llu on %llu axe id %llu, Parent %llu\n", - input.child_trans_num, input.parent_trans_num, input.axe_info.axe_id, - ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Transaction Set Dependency, %llu on %llu axe id %llu\n", + input.child_trans_num, input.parent_trans_num, g_axe_id); #endif status = (int *)malloc(sizeof(int)); if(H5VL__iod_create_and_forward(H5VL_TR_SET_DEPEND_ID, HG_TR_SET_DEPEND, (H5VL_iod_object_t *)tr->file, 0, - input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + num_parents, parent_reqs, + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); done: @@ -6820,20 +6931,17 @@ H5VL_iod_tr_skip(H5VL_iod_file_t *file, uint64_t start_trans_num, uint64_t count input.coh = file->remote_file.coh; input.start_trans_num = start_trans_num; input.count = count; - input.axe_info.axe_id = g_axe_id ++; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; #if H5VL_IOD_DEBUG printf("Transaction Skip, tr %llu count %llu,, axe id %llu\n", - input.start_trans_num, input.count, input.axe_info.axe_id); + input.start_trans_num, input.count, g_axe_id); #endif status = (int *)malloc(sizeof(int)); if(H5VL__iod_create_and_forward(H5VL_TR_SKIP_ID, HG_TR_SKIP, (H5VL_iod_object_t *)file, 0, 0, NULL, - &input, status, status, req) < 0) + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); done: @@ -6859,42 +6967,78 @@ H5VL_iod_tr_abort(H5TR_t *tr, void **req) { tr_abort_in_t input; int *status = NULL; - H5VL_iod_request_t **parent_req = NULL; + size_t num_parents = 0; + H5VL_iod_request_t **parent_reqs = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - if(NULL == (parent_req = (H5VL_iod_request_t **)H5MM_malloc(sizeof(H5VL_iod_request_t *)))) + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *)))) HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate parent req element"); + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(NULL, (H5VL_iod_req_info_t *)tr, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to retrieve parent requests"); + /* set the input structure for the HG encode routine */ input.coh = tr->file->remote_file.coh; input.trans_num = tr->trans_num; - input.axe_info.axe_id = g_axe_id ++; - if(NULL != tr->request && tr->request->state != H5VL_IOD_COMPLETED) { - input.axe_info.num_parents = 1; - input.axe_info.parent_axe_ids = &tr->request->axe_id; - tr->request->ref_count ++; - *parent_req = tr->request; - } - else { - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - *parent_req = NULL; + + /* remove all nodes from the transaction linked list */ + if(tr->req_info.num_req) { + H5VL_iod_request_t *cur_req = tr->req_info.head; + H5VL_iod_request_t *next_req = NULL; + H5VL_iod_request_t *prev; + H5VL_iod_request_t *next; + + while(cur_req) { + next_req = cur_req->trans_next; + + prev = cur_req->trans_prev; + next = cur_req->trans_next; + if (prev) { + if (next) { + prev->trans_next = next; + next->trans_prev = prev; + } + else { + prev->trans_next = NULL; + tr->req_info.tail = prev; + } + } + else { + if (next) { + next->trans_prev = NULL; + tr->req_info.head = next; + } + else { + tr->req_info.head = NULL; + tr->req_info.tail = NULL; + } + } + + cur_req->trans_prev = NULL; + cur_req->trans_next = NULL; + + tr->req_info.num_req --; + + cur_req = next_req; + } + HDassert(0 == tr->req_info.num_req); } status = (int *)malloc(sizeof(int)); #if H5VL_IOD_DEBUG - printf("Transaction Abort, tr %llu, axe id %llu, Parent %llu\n", - input.trans_num, input.axe_info.axe_id, - ((input.axe_info.parent_axe_ids!=NULL) ? input.axe_info.parent_axe_ids[0] : 0)); + printf("Transaction Abort, tr %llu, axe id %llu\n", + input.trans_num, g_axe_id); #endif if(H5VL__iod_create_and_forward(H5VL_TR_ABORT_ID, HG_TR_ABORT, (H5VL_iod_object_t *)tr->file, 0, - input.axe_info.num_parents, parent_req, - &input, status, status, req) < 0) + num_parents, parent_reqs, + NULL, &input, status, status, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship VOL op"); done: diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c index 06838a7..afa0b85 100644 --- a/src/H5VLiod_attr.c +++ b/src/H5VLiod_attr.c @@ -51,6 +51,8 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */ 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_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t attr_oh, attr_kv_oh, obj_oh, mdkv_oh; /* object handles */ iod_obj_id_t obj_id, mdkv_id; const char *loc_name = input->path; /* path to start hierarchy traversal */ @@ -220,6 +222,7 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; /* container handle */ iod_handle_t loc_handle = input->loc_oh; /* location handle to start traversal */ iod_obj_id_t loc_id = input->loc_id; /* location ID */ + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t attr_kv_oh, attr_oh, obj_oh, mdkv_oh; iod_obj_id_t obj_id; iod_obj_id_t attr_id; @@ -372,6 +375,7 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t iod_id = input->iod_id; /* attribute's ID */ hg_bulk_t bulk_handle = input->bulk_handle; /* bulk handle for data */ hid_t type_id = input->type_id; /* datatype ID of data */ + iod_trans_id_t rtid = input->rcxt_num; hg_bulk_block_t bulk_block_handle; /* HG block handle */ hg_bulk_request_t bulk_request; /* HG request */ iod_mem_desc_t mem_desc; /* memory descriptor used for reading array */ @@ -520,6 +524,8 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t iod_id = input->iod_id; /* attribute's ID */ hg_bulk_t bulk_handle = input->bulk_handle; /* bulk handle for data */ hid_t type_id = input->type_id; /* datatype ID of data */ + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; hg_bulk_block_t bulk_block_handle; /* HG block handle */ hg_bulk_request_t bulk_request; /* HG request */ iod_mem_desc_t mem_desc; /* memory descriptor used for writing array */ @@ -667,6 +673,7 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; /* container handle */ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t obj_oh; /* current object handle accessed */ iod_handle_t attr_kv_oh; /* KV handle holding attributes for object */ iod_obj_id_t obj_id; @@ -772,6 +779,8 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine, const char *loc_name = input->path; /* path to start hierarchy traversal */ const char *old_name = input->old_attr_name; const char *new_name = input->new_attr_name; + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_kv_params_t kvs; /* KV lists for objects - used to unlink attribute object */ iod_kv_t kv; /* KV entry */ H5VL_iod_link_t iod_link; @@ -880,6 +889,8 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t obj_id, attr_id; const char *loc_name = input->path; /* path to start hierarchy traversal */ const char *attr_name = input->attr_name; /* attribute's name */ + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_kv_params_t kvs; iod_kv_t kv; H5VL_iod_link_t iod_link; diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index 4e126e9..def20e9 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -68,7 +68,7 @@ H5VL_iod_request_decr_rc(H5VL_iod_request_t *request) request->ref_count --; if(0 == request->ref_count) { - request->parent_reqs = (H5VL_iod_request_t **)H5MM_xfree(request->parent_reqs); + //request->parent_reqs = (H5VL_iod_request_t **)H5MM_xfree(request->parent_reqs); request = (H5VL_iod_request_t *)H5MM_xfree(request); } @@ -89,24 +89,40 @@ H5VL_iod_request_decr_rc(H5VL_iod_request_t *request) herr_t H5VL_iod_request_add(H5VL_iod_file_t *file, H5VL_iod_request_t *request) { + H5VL_iod_req_info_t *req_info = request->trans_info; + FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(request); if (file->request_list_tail) { - file->request_list_tail->next = request; - request->prev = file->request_list_tail; + file->request_list_tail->file_next = request; + request->file_prev = file->request_list_tail; file->request_list_tail = request; } else { file->request_list_head = request; file->request_list_tail = request; - request->prev = NULL; + request->file_prev = NULL; } - request->next = NULL; - + request->file_next = NULL; file->num_req ++; + if(req_info) { + if (req_info->tail) { + req_info->tail->trans_next = request; + request->trans_prev = req_info->tail; + req_info->tail = request; + } + else { + req_info->head = request; + req_info->tail = request; + request->trans_prev = NULL; + } + request->trans_next = NULL; + req_info->num_req ++; + } + FUNC_LEAVE_NOAPI(SUCCEED) } @@ -138,21 +154,24 @@ H5VL_iod_request_delete(H5VL_iod_file_t *file, H5VL_iod_request_t *request) H5VL_iod_request_decr_rc(request->parent_reqs[u]); } - prev = request->prev; - next = request->next; + request->parent_reqs = (H5VL_iod_request_t **)H5MM_xfree(request->parent_reqs); + + /* remove the request from the container link list */ + prev = request->file_prev; + next = request->file_next; if (prev) { if (next) { - prev->next = next; - next->prev = prev; + prev->file_next = next; + next->file_prev = prev; } else { - prev->next = NULL; + prev->file_next = NULL; file->request_list_tail = prev; } } else { if (next) { - next->prev = NULL; + next->file_prev = NULL; file->request_list_head = next; } else { @@ -163,8 +182,8 @@ H5VL_iod_request_delete(H5VL_iod_file_t *file, H5VL_iod_request_t *request) if(request == request->obj->request) request->obj->request = NULL; - request->prev = NULL; - request->next = NULL; + request->file_prev = NULL; + request->file_next = NULL; file->num_req --; @@ -228,7 +247,7 @@ H5VL_iod_request_wait(H5VL_iod_file_t *file, H5VL_iod_request_t *request) if(HG_FILE_CLOSE != cur_req->type && cur_req->req != request->req) { hg_status_t tmp_status; - tmp_req = cur_req->next; + tmp_req = cur_req->file_next; HDassert(cur_req->state == H5VL_IOD_PENDING); ret = HG_Wait(*((hg_request_t *)cur_req->req), 0, &tmp_status); @@ -288,7 +307,7 @@ H5VL_iod_request_wait_all(H5VL_iod_file_t *file) while(cur_req) { H5VL_iod_request_t *tmp_req = NULL; - tmp_req = cur_req->next; + tmp_req = cur_req->file_next; HDassert(cur_req->state == H5VL_IOD_PENDING); ret = HG_Wait(*((hg_request_t *)cur_req->req), HG_MAX_IDLE_TIME, &status); @@ -346,7 +365,7 @@ H5VL_iod_request_wait_some(H5VL_iod_file_t *file, const void *object) while(cur_req) { H5VL_iod_request_t *tmp_req; - tmp_req = cur_req->next; + tmp_req = cur_req->file_next; /* If the request is pending on the object we want, complete it */ if(cur_req->obj == object) { @@ -557,8 +576,9 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)req->obj; uint32_t internal_cs = 0; size_t buf_size = status->buf_size; - hg_status_t hg_status; - hg_request_t hg_req; /* Local function shipper request */ + hid_t rcxt_id; + H5RC_t *rc; + H5P_genplist_t *plist = NULL; H5VL_iod_read_status_t vl_status; if(NULL == (read_buf = (void *)HDmalloc(buf_size))) @@ -569,6 +589,16 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) HG_BULK_READWRITE, info->bulk_handle)) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't create Bulk Data Handle"); + /* get the context ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(info->dxpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_get(plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for trans_id"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a READ CONTEXT ID") + /* Fill input structure for reading data */ input.coh = file->remote_file.coh; input.iod_oh = dset->remote_dset.iod_oh; @@ -579,27 +609,12 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) input.space_id = info->file_space_id; input.mem_type_id = info->mem_type_id; input.dset_type_id = dset->remote_dset.type_id; - input.axe_info.axe_id = info->axe_id; - input.axe_info.num_parents = 0; - input.axe_info.parent_axe_ids = NULL; - - input.axe_info.start_range = 0; - input.axe_info.count = 0; - - /* forward call to IONs */ - if(HG_Forward(info->peer, info->read_id, &input, &vl_status, &hg_req) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to ship dataset read"); - if(HG_Wait(hg_req, HG_MAX_IDLE_TIME, &hg_status) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to wait on mercury handle"); - - if(!hg_status) { - fprintf(stderr, "Wait timeout reached\n"); - req->status = H5AO_FAILED; - req->state = H5VL_IOD_COMPLETED; - H5VL_iod_request_delete(file, req); - goto done; - } + if(H5VL__iod_create_and_forward(info->read_id, HG_DSET_READ, + (H5VL_iod_object_t *)dset, 0, 0, NULL, + (H5VL_iod_req_info_t *)rc, + &input, &vl_status, NULL, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship dataset read"); /* Free memory handle */ if(HG_SUCCESS != HG_Bulk_handle_free(*info->bulk_handle)) { @@ -753,22 +768,6 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) H5VL_iod_request_delete(file, req); break; } - case HG_FILE_FLUSH: - { - int *status = (int *)req->data; - - if(SUCCEED != *status) { - fprintf(stderr, "File flush failed at the server\n"); - req->status = H5AO_FAILED; - req->state = H5VL_IOD_COMPLETED; - } - - free(status); - req->data = NULL; - file->common.request = NULL; - H5VL_iod_request_delete(file, req); - break; - } case HG_FILE_CLOSE: { int *status = (int *)req->data; @@ -1212,16 +1211,6 @@ H5VL_iod_request_cancel(H5VL_iod_file_t *file, H5VL_iod_request_t *req) 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: @@ -1489,6 +1478,8 @@ H5VL_iod_request_cancel(H5VL_iod_file_t *file, H5VL_iod_request_t *req) break; } case HG_RC_RELEASE: + case HG_RC_PERSIST: + case HG_RC_SNAPSHOT: case HG_TR_START: case HG_TR_FINISH: case HG_TR_SET_DEPEND: @@ -1515,20 +1506,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_iod_get_axe_parents + * Function: H5VL_iod_get_obj_requests * - * Purpose: returns the number of axe_id tasks that are associated + * Purpose: returns the number of requests that are associated * with a particular object. If the parent array is not NULL, - * the axe_ids are returned in parents too. + * the request pointers are stored. * * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ herr_t -H5VL_iod_get_axe_parents(H5VL_iod_object_t *obj, /*IN/OUT*/ size_t *count, - /*OUT*/ AXE_task_t *parent_axe_ids, - /*OUT*/ H5VL_iod_request_t **parent_reqs) +H5VL_iod_get_obj_requests(H5VL_iod_object_t *obj, /*IN/OUT*/ size_t *count, + /*OUT*/ H5VL_iod_request_t **parent_reqs) { H5VL_iod_file_t *file = obj->file; H5VL_iod_request_t *cur_req = file->request_list_head; @@ -1540,9 +1530,6 @@ H5VL_iod_get_axe_parents(H5VL_iod_object_t *obj, /*IN/OUT*/ size_t *count, /* If the request is pending on the object we want, add its axe_id */ if(cur_req->obj == obj) { if(cur_req->status == H5AO_PENDING) { - if(NULL != parent_axe_ids) { - parent_axe_ids[size] = cur_req->axe_id; - } if(NULL != parent_reqs) { parent_reqs[size] = cur_req; cur_req->ref_count ++; @@ -1550,196 +1537,93 @@ H5VL_iod_get_axe_parents(H5VL_iod_object_t *obj, /*IN/OUT*/ size_t *count, size ++; } } - cur_req = cur_req->next; + cur_req = cur_req->file_next; } *count = size; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5VL_iod_get_axe_parents */ +} /* end H5VL_iod_get_obj_requests */ - -/*------------------------------------------------------------------------- - * Function: H5VL_iod_get_parent_info - * - * Purpose: This routine traverses the path in name, or in loc_params - * if the path is specified there, to determine the components - * of the path that are present locally in the ID space. - * Once a component in the path is not found, the routine - * breaks at that point and stores the remaining path in new_name. - * This is where the traversal can begin at the server. - * The IOD ID, OH, and axe_id belonging to the last object - * present are returned too. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ herr_t -H5VL_iod_get_parent_info(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, - const char *name, /*OUT*/iod_obj_id_t *iod_id, - /*OUT*/iod_handle_t *iod_oh, /*OUT*/H5VL_iod_request_t **parent_req, - /*OUT*/char **new_name, /*OUT*/H5VL_iod_object_t **last_obj) +H5VL_iod_get_loc_info(H5VL_iod_object_t *obj, iod_obj_id_t *iod_id, + iod_handle_t *iod_oh) { - iod_obj_id_t cur_id; - iod_handle_t cur_oh; - size_t cur_size; /* current size of the path traversed so far */ - char *cur_name; /* full path to object that is currently being looked for */ - H5VL_iod_object_t *cur_obj = obj; /* current object in the traversal loop */ - H5VL_iod_object_t *next_obj = NULL; /* the next object to traverse */ - const char *path; /* specified path for the object to traverse to */ - H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */ - char comp_buf[1024]; /* Temporary buffer for path components */ - char *comp; /* Pointer to buffer for path components */ - size_t nchars; /* component name length */ - H5VL_iod_file_t *file = obj->file; /* pointer to file where the search happens */ - hbool_t last_comp = FALSE; /* Flag to indicate that a component is the last component in the name */ + iod_obj_id_t id; + iod_handle_t oh; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - if(loc_params.type == H5VL_OBJECT_BY_SELF) - path = name; - else if (loc_params.type == H5VL_OBJECT_BY_NAME) - path = loc_params.loc_data.loc_by_name.name; - - if (NULL == (cur_name = (char *)malloc(HDstrlen(obj->obj_name) + HDstrlen(path) + 2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate"); - - HDstrcpy(cur_name, obj->obj_name); - cur_size = HDstrlen(obj->obj_name); - - if(obj->obj_type != H5I_FILE) { - HDstrcat(cur_name, "/"); - cur_size += 1; - } - - /* 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") - /* Get a pointer to a buffer that's large enough */ - if(NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(path) + 1)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") - - /* Traverse the path */ - while((path = H5G__component(path, &nchars)) && *path) { - const char *s; /* Temporary string pointer */ - - /* - * Copy the component name into a null-terminated buffer so - * we can pass it down to the other symbol table functions. - */ - HDmemcpy(comp, path, nchars); - comp[nchars] = '\0'; - - /* - * The special name `.' is a no-op. - */ - if('.' == comp[0] && !comp[1]) { - path += nchars; - continue; - } /* end if */ - - /* Check if this is the last component of the name */ - if(!((s = H5G__component(path + nchars, NULL)) && *s)) - last_comp = TRUE; - - HDstrcat(cur_name, comp); - cur_size += nchars; - cur_name[cur_size] = '\0'; - - if(NULL == (next_obj = (const H5VL_iod_object_t *)H5I_search_name(file, cur_name, H5I_GROUP))) { - if(last_comp) { - if(NULL == (next_obj = (const H5VL_iod_object_t *)H5I_search_name - (file, cur_name, H5I_DATASET)) - && NULL == (next_obj = (H5VL_iod_object_t *)H5I_search_name - (file, cur_name, H5I_DATATYPE)) - && NULL == (next_obj = (H5VL_iod_object_t *)H5I_search_name - (file, cur_name, H5I_MAP))) - break; - } - else { - break; - } - } - -#if H5VL_IOD_DEBUG - printf("Found %s Locally\n", comp); -#endif - - /* Advance to next component in string */ - path += nchars; - HDstrcat(cur_name, "/"); - cur_size += 1; - cur_obj = next_obj; - } - - switch(cur_obj->obj_type) { + switch(obj->obj_type) { case H5I_FILE: - cur_oh = cur_obj->file->remote_file.root_oh; - cur_id = cur_obj->file->remote_file.root_id; + oh = obj->file->remote_file.root_oh; + id = obj->file->remote_file.root_id; break; case H5I_GROUP: - cur_oh = ((const H5VL_iod_group_t *)cur_obj)->remote_group.iod_oh; - cur_id = ((const H5VL_iod_group_t *)cur_obj)->remote_group.iod_id; + oh = ((const H5VL_iod_group_t *)obj)->remote_group.iod_oh; + id = ((const H5VL_iod_group_t *)obj)->remote_group.iod_id; break; case H5I_DATASET: - cur_oh = ((const H5VL_iod_dset_t *)cur_obj)->remote_dset.iod_oh; - cur_id = ((const H5VL_iod_dset_t *)cur_obj)->remote_dset.iod_id; + oh = ((const H5VL_iod_dset_t *)obj)->remote_dset.iod_oh; + id = ((const H5VL_iod_dset_t *)obj)->remote_dset.iod_id; break; case H5I_DATATYPE: - cur_oh = ((const H5VL_iod_dtype_t *)cur_obj)->remote_dtype.iod_oh; - cur_id = ((const H5VL_iod_dtype_t *)cur_obj)->remote_dtype.iod_id; + oh = ((const H5VL_iod_dtype_t *)obj)->remote_dtype.iod_oh; + id = ((const H5VL_iod_dtype_t *)obj)->remote_dtype.iod_id; break; case H5I_MAP: - cur_oh = ((const H5VL_iod_map_t *)cur_obj)->remote_map.iod_oh; - cur_id = ((const H5VL_iod_map_t *)cur_obj)->remote_map.iod_id; + oh = ((const H5VL_iod_map_t *)obj)->remote_map.iod_oh; + id = ((const H5VL_iod_map_t *)obj)->remote_map.iod_id; break; default: HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "bad location object"); } - if(cur_obj->request && cur_obj->request->status == H5AO_PENDING) { - *parent_req = cur_obj->request; - cur_obj->request->ref_count ++; - } - else { - *parent_req = NULL; - HDassert(cur_oh.cookie != IOD_OH_UNDEFINED); - } - - *iod_id = cur_id; - *iod_oh = cur_oh; - - if(*path) - *new_name = strdup(path); - else - *new_name = strdup("."); - - if(last_obj) - *last_obj = cur_obj; + *iod_id = id; + *iod_oh = oh; done: - free(cur_name); - /* Release temporary component buffer */ - 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_get_parent_info */ +} /* end H5VL_iod_get_loc_info() */ /*------------------------------------------------------------------------- - * Function: H5VL_iod_get_axe_parents + * Function: H5VL_iod_get_parent_requests * - * Purpose: routine to generate an IOD ID based on the object type, - * rank and total ranks, and current index or - * number of pre-existing IDs. + * Purpose: Returns the parent requests associated with an object + * and transaction. * * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ herr_t +H5VL_iod_get_parent_requests(H5VL_iod_object_t *obj, H5VL_iod_req_info_t *req_info, + H5VL_iod_request_t **parent_reqs, size_t *num_parents) +{ + size_t count = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(obj && obj->request && obj->request->status == H5AO_PENDING) { + parent_reqs[count] = obj->request; + obj->request->ref_count ++; + count ++; + } + + if(req_info && req_info->request && req_info->request->status == H5AO_PENDING) { + parent_reqs[count] = req_info->request; + req_info->request->ref_count ++; + count ++; + } + + *num_parents += count; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL_iod_get_parent_requests */ + +herr_t H5VL_iod_gen_obj_id(int myrank, int nranks, uint64_t cur_index, iod_obj_type_t type, uint64_t *id) { @@ -2371,6 +2255,174 @@ H5VL_iod_get_axe_id(int myrank, int nranks, int cur_index, uint64_t *id) done: FUNC_LEAVE_NOAPI(ret_value) } + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_get_parent_info + * + * Purpose: This routine traverses the path in name, or in loc_params + * if the path is specified there, to determine the components + * of the path that are present locally in the ID space. + * Once a component in the path is not found, the routine + * breaks at that point and stores the remaining path in new_name. + * This is where the traversal can begin at the server. + * The IOD ID, OH, and axe_id belonging to the last object + * present are returned too. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_iod_get_parent_info(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, + const char *name, /*OUT*/iod_obj_id_t *iod_id, + /*OUT*/iod_handle_t *iod_oh, /*OUT*/H5VL_iod_request_t **parent_req, + /*OUT*/char **new_name, /*OUT*/H5VL_iod_object_t **last_obj) +{ + iod_obj_id_t cur_id; + iod_handle_t cur_oh; + size_t cur_size; /* current size of the path traversed so far */ + char *cur_name; /* full path to object that is currently being looked for */ + H5VL_iod_object_t *cur_obj = obj; /* current object in the traversal loop */ + H5VL_iod_object_t *next_obj = NULL; /* the next object to traverse */ + const char *path; /* specified path for the object to traverse to */ + H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */ + char comp_buf[1024]; /* Temporary buffer for path components */ + char *comp; /* Pointer to buffer for path components */ + size_t nchars; /* component name length */ + H5VL_iod_file_t *file = obj->file; /* pointer to file where the search happens */ + hbool_t last_comp = FALSE; /* Flag to indicate that a component is the last component in the name */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + if(loc_params.type == H5VL_OBJECT_BY_SELF) + path = name; + else if (loc_params.type == H5VL_OBJECT_BY_NAME) + path = loc_params.loc_data.loc_by_name.name; + + if (NULL == (cur_name = (char *)malloc(HDstrlen(obj->obj_name) + HDstrlen(path) + 2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate"); + + HDstrcpy(cur_name, obj->obj_name); + cur_size = HDstrlen(obj->obj_name); + + if(obj->obj_type != H5I_FILE) { + HDstrcat(cur_name, "/"); + cur_size += 1; + } + + /* 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") + /* Get a pointer to a buffer that's large enough */ + if(NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(path) + 1)))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") + + /* Traverse the path */ + while((path = H5G__component(path, &nchars)) && *path) { + const char *s; /* Temporary string pointer */ + + /* + * Copy the component name into a null-terminated buffer so + * we can pass it down to the other symbol table functions. + */ + HDmemcpy(comp, path, nchars); + comp[nchars] = '\0'; + + /* + * The special name `.' is a no-op. + */ + if('.' == comp[0] && !comp[1]) { + path += nchars; + continue; + } /* end if */ + + /* Check if this is the last component of the name */ + if(!((s = H5G__component(path + nchars, NULL)) && *s)) + last_comp = TRUE; + + HDstrcat(cur_name, comp); + cur_size += nchars; + cur_name[cur_size] = '\0'; + + if(NULL == (next_obj = (const H5VL_iod_object_t *)H5I_search_name(file, cur_name, H5I_GROUP))) { + if(last_comp) { + if(NULL == (next_obj = (const H5VL_iod_object_t *)H5I_search_name + (file, cur_name, H5I_DATASET)) + && NULL == (next_obj = (H5VL_iod_object_t *)H5I_search_name + (file, cur_name, H5I_DATATYPE)) + && NULL == (next_obj = (H5VL_iod_object_t *)H5I_search_name + (file, cur_name, H5I_MAP))) + break; + } + else { + break; + } + } + +#if H5VL_IOD_DEBUG + printf("Found %s Locally\n", comp); +#endif + + /* Advance to next component in string */ + path += nchars; + HDstrcat(cur_name, "/"); + cur_size += 1; + cur_obj = next_obj; + } + + switch(cur_obj->obj_type) { + case H5I_FILE: + cur_oh = cur_obj->file->remote_file.root_oh; + cur_id = cur_obj->file->remote_file.root_id; + break; + case H5I_GROUP: + cur_oh = ((const H5VL_iod_group_t *)cur_obj)->remote_group.iod_oh; + cur_id = ((const H5VL_iod_group_t *)cur_obj)->remote_group.iod_id; + break; + case H5I_DATASET: + cur_oh = ((const H5VL_iod_dset_t *)cur_obj)->remote_dset.iod_oh; + cur_id = ((const H5VL_iod_dset_t *)cur_obj)->remote_dset.iod_id; + break; + case H5I_DATATYPE: + cur_oh = ((const H5VL_iod_dtype_t *)cur_obj)->remote_dtype.iod_oh; + cur_id = ((const H5VL_iod_dtype_t *)cur_obj)->remote_dtype.iod_id; + break; + case H5I_MAP: + cur_oh = ((const H5VL_iod_map_t *)cur_obj)->remote_map.iod_oh; + cur_id = ((const H5VL_iod_map_t *)cur_obj)->remote_map.iod_id; + break; + default: + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "bad location object"); + } + + if(cur_obj->request && cur_obj->request->status == H5AO_PENDING) { + *parent_req = cur_obj->request; + cur_obj->request->ref_count ++; + } + else { + *parent_req = NULL; + HDassert(cur_oh.cookie != IOD_OH_UNDEFINED); + } + + *iod_id = cur_id; + *iod_oh = cur_oh; + + if(*path) + *new_name = strdup(path); + else + *new_name = strdup("."); + + if(last_obj) + *last_obj = cur_obj; + +done: + free(cur_name); + /* Release temporary component buffer */ + 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_get_parent_info */ #endif #endif /* H5_HAVE_EFF */ diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index cc6edc2..b6b43e7 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -29,13 +29,13 @@ /* forward declaration of file struct */ struct H5VL_iod_file_t; +/* forward declaration of object struct */ struct H5VL_iod_object_t; -/* types for requests */ +/* enum for types of requests */ typedef enum H5RQ_type_t { HG_FILE_CREATE, HG_FILE_OPEN, - HG_FILE_FLUSH, HG_FILE_CLOSE, HG_ATTR_CREATE, HG_ATTR_OPEN, @@ -94,20 +94,30 @@ typedef enum H5RQ_type_t { /* the client IOD VOL request struct */ typedef struct H5VL_iod_request_t { - H5RQ_type_t type; - void *data; - void *req; - struct H5VL_iod_object_t *obj; - H5VL_iod_state_t state; - H5_status_t status; - uint64_t axe_id; - size_t num_parents; - struct H5VL_iod_request_t **parent_reqs; - struct H5VL_iod_request_t *prev; - struct H5VL_iod_request_t *next; + H5RQ_type_t type; /* The operation type of this request */ + void *data; /* data associated with request (usually used at completion time) */ + void *req; /* the request pointer correponding to the Mercury request */ + struct H5VL_iod_object_t *obj; /* The object pointer that this request is associated with */ + H5VL_iod_state_t state; /* current internal state of the request */ + H5_status_t status; /* external status given to use of request */ + uint64_t axe_id; /* The AXE ID this request was assigned */ + unsigned ref_count; /* reference count to know when this request can be freed. */ + H5VL_iod_req_info_t *trans_info; /* pointer to transaction or read context struct for this request */ + + size_t num_parents; /* Number of parents this request has (in AXE) */ + struct H5VL_iod_request_t **parent_reqs; /* an array of the parent request pointers */ + + /* Linked list pointers for the container this request was generated. */ + struct H5VL_iod_request_t *file_prev; + struct H5VL_iod_request_t *file_next; + + /* Linked list pointers for all IOD VOL requests in the library */ struct H5VL_iod_request_t *global_prev; struct H5VL_iod_request_t *global_next; - unsigned ref_count; + + /* Linked list pointers for the transaction this request belong to */ + struct H5VL_iod_request_t *trans_prev; + struct H5VL_iod_request_t *trans_next; } H5VL_iod_request_t; /* struct that contains the information about the IOD container */ @@ -279,17 +289,16 @@ H5_DLL herr_t H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_ H5_DLL herr_t H5VL_iod_request_cancel(H5VL_iod_file_t *file, H5VL_iod_request_t *req); H5_DLL herr_t H5VL_iod_request_decr_rc(H5VL_iod_request_t *request); -H5_DLL herr_t H5VL_iod_get_parent_info(H5VL_iod_object_t *obj, H5VL_loc_params_t loc_params, - const char *name, /*OUT*/iod_obj_id_t *iod_id, - /*OUT*/iod_handle_t *iod_oh, - /*OUT*/H5VL_iod_request_t **parent_req, - /*OUT*/char **new_name, /*OUT*/H5VL_iod_object_t **last_obj); -H5_DLL herr_t H5VL_iod_get_axe_parents(H5VL_iod_object_t *obj, /*IN/OUT*/ size_t *count, - /*OUT*/ AXE_task_t *parent_axe_ids, - /*OUT*/ H5VL_iod_request_t **parent_reqs); +H5_DLL herr_t H5VL_iod_get_parent_requests(H5VL_iod_object_t *obj, H5VL_iod_req_info_t *req_info, + H5VL_iod_request_t **parent_reqs, size_t *num_parents); +H5_DLL herr_t H5VL_iod_get_loc_info(H5VL_iod_object_t *obj, iod_obj_id_t *iod_id, + iod_handle_t *iod_oh); +H5_DLL herr_t H5VL_iod_get_obj_requests(H5VL_iod_object_t *obj, /*IN/OUT*/ size_t *count, + /*OUT*/ H5VL_iod_request_t **parent_reqs); H5_DLL herr_t H5VL__iod_create_and_forward(hg_id_t op_id, H5RQ_type_t op_type, H5VL_iod_object_t *request_obj, htri_t track, size_t num_parents, H5VL_iod_request_t **parent_reqs, + H5VL_iod_req_info_t *req_info, void *input, void *output, void *data, void **req); H5_DLL herr_t H5VL_iod_gen_obj_id(int myrank, int nranks, uint64_t cur_index, diff --git a/src/H5VLiod_common.h b/src/H5VLiod_common.h index aa92625..628b358 100644 --- a/src/H5VLiod_common.h +++ b/src/H5VLiod_common.h @@ -105,13 +105,12 @@ MERCURY_GEN_PROC(file_open_out_t, ((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)) ((hid_t)(fcpl_id))) -MERCURY_GEN_PROC(file_flush_in_t, ((axe_t)(axe_info)) - ((iod_handle_t)(coh)) ((int32_t)(scope))) MERCURY_GEN_PROC(file_close_in_t, ((axe_t)(axe_info)) ((iod_handle_t)(coh)) ((iod_handle_t)(root_oh)) ((iod_obj_id_t)(root_id))) -MERCURY_GEN_PROC(attr_create_in_t, ((axe_t)(axe_info)) +MERCURY_GEN_PROC(attr_create_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(attr_id)) ((hg_string_t)(path)) @@ -119,21 +118,25 @@ MERCURY_GEN_PROC(attr_create_in_t, ((axe_t)(axe_info)) ((hid_t)(type_id)) ((hid_t)(space_id))) MERCURY_GEN_PROC(attr_create_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(attr_open_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) ((hg_string_t)(attr_name))) MERCURY_GEN_PROC(attr_open_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(acpl_id)) ((hid_t)(type_id)) ((hid_t)(space_id))) MERCURY_GEN_PROC(attr_op_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) ((hg_string_t)(attr_name))) MERCURY_GEN_PROC(attr_rename_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) ((hg_string_t)(old_attr_name)) ((hg_string_t)(new_attr_name))) MERCURY_GEN_PROC(attr_io_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(type_id)) ((hg_bulk_t)(bulk_handle))) @@ -141,12 +144,14 @@ MERCURY_GEN_PROC(attr_close_in_t, ((axe_t)(axe_info)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id))) MERCURY_GEN_PROC(group_create_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(grp_id)) ((hg_string_t)(name)) ((hid_t)(gapl_id)) ((hid_t)(gcpl_id)) ((hid_t)(lcpl_id))) MERCURY_GEN_PROC(group_create_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(group_open_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) ((hid_t)(gapl_id))) @@ -156,6 +161,7 @@ MERCURY_GEN_PROC(group_close_in_t, ((axe_t)(axe_info)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id))) MERCURY_GEN_PROC(map_create_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(map_id)) ((hg_string_t)(name)) @@ -164,18 +170,21 @@ MERCURY_GEN_PROC(map_create_in_t, ((axe_t)(axe_info)) ((hid_t)(lcpl_id))) MERCURY_GEN_PROC(map_create_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(map_open_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) ((hid_t)(mapl_id))) MERCURY_GEN_PROC(map_open_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(keytype_id)) ((hid_t)(valtype_id)) ((hid_t)(mcpl_id))) MERCURY_GEN_PROC(map_set_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(key_maptype_id)) ((hid_t)(key_memtype_id)) ((binary_buf_t)(key)) ((hid_t)(val_maptype_id)) ((hid_t)(val_memtype_id)) ((binary_buf_t)(val)) ((hid_t)(dxpl_id))) MERCURY_GEN_PROC(map_get_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(key_maptype_id)) ((hid_t)(key_memtype_id)) ((binary_buf_t)(key)) @@ -183,9 +192,11 @@ MERCURY_GEN_PROC(map_get_in_t, ((axe_t)(axe_info)) ((hid_t)(dxpl_id))) MERCURY_GEN_PROC(map_get_out_t, ((int32_t)(ret)) ((value_t)(val))) MERCURY_GEN_PROC(map_get_count_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id))) MERCURY_GEN_PROC(map_op_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(key_maptype_id)) ((hid_t)(key_memtype_id)) ((binary_buf_t)(key))) @@ -193,6 +204,7 @@ MERCURY_GEN_PROC(map_close_in_t, ((axe_t)(axe_info)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id))) MERCURY_GEN_PROC(dset_create_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(dset_id)) ((hg_string_t)(name)) @@ -200,21 +212,25 @@ MERCURY_GEN_PROC(dset_create_in_t, ((axe_t)(axe_info)) ((hid_t)(type_id)) ((hid_t)(space_id))) MERCURY_GEN_PROC(dset_create_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(dset_open_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) ((hid_t)(dapl_id))) MERCURY_GEN_PROC(dset_open_out_t, ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(dcpl_id)) ((hid_t)(type_id)) ((hid_t)(space_id))) MERCURY_GEN_PROC(dset_set_extent_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((dims_t)(dims))) MERCURY_GEN_PROC(dset_io_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(dset_type_id)) ((hid_t)(mem_type_id)) ((hid_t)(space_id)) ((hid_t)(dxpl_id)) ((uint32_t)(checksum)) ((hg_bulk_t)(bulk_handle))) MERCURY_GEN_PROC(dset_get_vl_size_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(mem_type_id)) ((hid_t)(space_id)) ((hid_t)(dxpl_id))) @@ -223,6 +239,7 @@ MERCURY_GEN_PROC(dset_close_in_t, ((axe_t)(axe_info)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id))) MERCURY_GEN_PROC(dtype_commit_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((iod_obj_id_t)(dtype_id)) ((hg_string_t)(name)) @@ -230,6 +247,7 @@ MERCURY_GEN_PROC(dtype_commit_in_t, ((axe_t)(axe_info)) ((hid_t)(type_id))) MERCURY_GEN_PROC(dtype_commit_out_t, ((iod_handle_t)(iod_oh))) MERCURY_GEN_PROC(dtype_open_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(name)) ((hid_t)(tapl_id))) @@ -239,6 +257,7 @@ MERCURY_GEN_PROC(dtype_close_in_t, ((axe_t)(axe_info)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id))) MERCURY_GEN_PROC(link_create_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((int8_t)(create_type)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(loc_name)) @@ -247,6 +266,7 @@ MERCURY_GEN_PROC(link_create_in_t, ((axe_t)(axe_info)) ((hg_string_t)(link_value)) ((hid_t)(lapl_id)) ((hid_t)(lcpl_id))) MERCURY_GEN_PROC(link_move_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((hbool_t)(copy_flag)) ((iod_handle_t)(coh)) ((iod_handle_t)(src_loc_oh)) ((iod_obj_id_t)(src_loc_id)) ((hg_string_t)(src_loc_name)) @@ -254,16 +274,19 @@ MERCURY_GEN_PROC(link_move_in_t, ((axe_t)(axe_info)) ((hg_string_t)(dst_loc_name)) ((hid_t)(lapl_id)) ((hid_t)(lcpl_id))) MERCURY_GEN_PROC(link_op_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path))) MERCURY_GEN_PROC(link_get_val_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) ((uint64_t)(length))) MERCURY_GEN_PROC(link_get_val_out_t, ((int32_t)(ret)) ((value_t)(value))) MERCURY_GEN_PROC(object_op_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(loc_name))) @@ -271,6 +294,7 @@ MERCURY_GEN_PROC(object_open_out_t, ((int32_t)(obj_type)) ((iod_handle_t)(iod_oh)) ((iod_obj_id_t)(iod_id)) ((hid_t)(cpl_id)) ((hid_t)(type_id)) ((hid_t)(space_id))) MERCURY_GEN_PROC(object_copy_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(src_loc_oh)) ((iod_obj_id_t)(src_loc_id)) ((hg_string_t)(src_loc_name)) @@ -278,10 +302,12 @@ MERCURY_GEN_PROC(object_copy_in_t, ((axe_t)(axe_info)) ((hg_string_t)(dst_loc_name)) ((hid_t)(ocpypl_id)) ((hid_t)(lcpl_id))) MERCURY_GEN_PROC(object_set_comment_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((uint64_t)(trans_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) ((hg_string_t)(comment))) MERCURY_GEN_PROC(object_get_comment_in_t, ((axe_t)(axe_info)) + ((uint64_t)(rcxt_num)) ((iod_handle_t)(coh)) ((iod_handle_t)(loc_oh)) ((iod_obj_id_t)(loc_id)) ((hg_string_t)(path)) ((uint64_t)(length))) diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c index fcb6455..bf35869 100644 --- a/src/H5VLiod_dset.c +++ b/src/H5VLiod_dset.c @@ -90,6 +90,8 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */ 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_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t dset_oh, cur_oh, mdkv_oh; iod_obj_id_t cur_id, mdkv_id, attr_id; const char *name = input->name; /* name of dset including path to create */ @@ -282,6 +284,7 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; /* container handle */ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ + iod_trans_id_t rtid = input->rcxt_num; iod_obj_id_t dset_id; /* ID of the dataset to open */ iod_handle_t dset_oh, mdkv_oh; const char *name = input->name; /* name of dset including path to open */ @@ -432,6 +435,7 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine, hid_t dxpl_id = input->dxpl_id; /* transfer property list */ hid_t src_id = input->dset_type_id; /* the datatype of the dataset's element */ hid_t dst_id = input->mem_type_id; /* the memory type of the elements */ + iod_trans_id_t rtid = input->rcxt_num; hg_bulk_block_t bulk_block_handle; /* HG block handle */ hg_bulk_request_t bulk_request; /* HG request */ size_t size, buf_size; @@ -646,6 +650,7 @@ H5VL_iod_server_dset_get_vl_size_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t iod_id = input->iod_id; /* dset ID */ hid_t space_id = input->space_id; /* file space selection */ hid_t dxpl_id = input->dxpl_id; /* transfer property list */ + iod_trans_id_t rtid = input->rcxt_num; size_t buf_size; void *buf = NULL; /* buffer to hold blob IDs */ size_t nelmts; /* number of elements selected to read */ @@ -854,6 +859,8 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, uint32_t cs = input->checksum; /* checksum recieved for data */ hid_t src_id = input->mem_type_id; /* the memory type of the elements */ hid_t dst_id = input->dset_type_id; /* the datatype of the dataset's element */ + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; hg_bulk_block_t bulk_block_handle; /* HG block handle */ hg_bulk_request_t bulk_request; /* HG request */ size_t size, buf_size; @@ -1031,6 +1038,8 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; iod_handle_t iod_oh = input->iod_oh; iod_obj_id_t iod_id = input->iod_id; + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; /* int rank = input->dims.rank; rank of dataset */ hbool_t opened_locally = FALSE; herr_t ret_value = SUCCEED; diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c index f102171..3c6ac58 100644 --- a/src/H5VLiod_dtype.c +++ b/src/H5VLiod_dtype.c @@ -51,6 +51,8 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */ 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_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t dtype_oh, cur_oh, mdkv_oh; iod_obj_id_t cur_id, mdkv_id, attr_id; const char *name = input->name; /* name of dtype including path to commit */ @@ -256,6 +258,7 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t dtype_id; /* ID of datatype to open */ iod_handle_t dtype_oh, mdkv_oh; const char *name = input->name; /* name of dtype including path to open */ + iod_trans_id_t rtid = input->rcxt_num; size_t buf_size; /* size of serialized datatype */ void *buf = NULL; iod_mem_desc_t *mem_desc = NULL; /* memory descriptor used for reading */ diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c index 4a37b2f..ca44f02 100644 --- a/src/H5VLiod_file.c +++ b/src/H5VLiod_file.c @@ -55,6 +55,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t mdkv_oh; /* metadata object handle for KV to store file's metadata */ iod_obj_id_t mdkv_id, attr_id; /* metadata and attribute KV IDs for the file */ iod_ret_t ret; + iod_trans_id_t first_tid = 0; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -73,7 +74,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, 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, + ret = iod_obj_create(coh, first_tid, NULL, IOD_OBJ_KV, NULL, NULL, &input->root_id, NULL); if(0 == ret || EEXISTS == ret) { /* root group has been created, open it */ @@ -94,12 +95,12 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, hid_t fcpl_id; /* create the metadata KV object for the root group */ - if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, + if(iod_obj_create(coh, first_tid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); /* create the attribute KV object for the root group */ - if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, + if(iod_obj_create(coh, first_tid, NULL, IOD_OBJ_KV, NULL, NULL, &attr_id, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); @@ -110,7 +111,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, sp.filler2_id = IOD_ID_UNDEFINED; /* set scratch pad in root group */ - if (iod_obj_set_scratch(root_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0) + if (iod_obj_set_scratch(root_oh, first_tid, &sp, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); /* Store Metadata in scratch pad */ @@ -125,7 +126,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, fcpl_id = input->fcpl_id; /* insert plist metadata */ - if(H5VL_iod_insert_plist(mdkv_oh, IOD_TID_UNKNOWN, fcpl_id, + if(H5VL_iod_insert_plist(mdkv_oh, first_tid, fcpl_id, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert link count KV value"); @@ -137,21 +138,21 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, key = strdup(H5VL_IOD_KEY_KV_IDS_INDEX); kv.key = (char *)key; - if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) + if (iod_kv_set(mdkv_oh, first_tid, NULL, &kv, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent"); free(key); key = NULL; key = strdup(H5VL_IOD_KEY_ARRAY_IDS_INDEX); kv.key = (char *)key; - if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) + if (iod_kv_set(mdkv_oh, first_tid, NULL, &kv, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent"); free(key); key = NULL; key = strdup(H5VL_IOD_KEY_BLOB_IDS_INDEX); kv.key = (char *)key; - if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0) + if (iod_kv_set(mdkv_oh, first_tid, NULL, &kv, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent"); free(key); key = NULL; @@ -320,50 +321,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_iod_server_file_flush_cb - * - * Purpose: Flushs iod HDF5 file. - * - * Return: Success: SUCCEED - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * January, 2013 - * - *------------------------------------------------------------------------- - */ -void -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) -{ - 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; - - FUNC_ENTER_NOAPI_NOINIT - - /* MSC - TODO */ - -#if H5_DO_NATIVE - ret_value = H5Fflush(coh.cookie, scope); -#endif - -done: - 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 = (file_flush_in_t *)H5MM_xfree(input); - op_data = (op_data_t *)H5MM_xfree(op_data); - - FUNC_LEAVE_NOAPI_VOID -} /* end H5VL_iod_server_file_flush_cb() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_iod_server_file_close_cb * * Purpose: Closes iod HDF5 file. diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c index b40d180..89d202d 100644 --- a/src/H5VLiod_group.c +++ b/src/H5VLiod_group.c @@ -54,6 +54,8 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, 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_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t grp_oh, cur_oh, mdkv_oh; iod_obj_id_t cur_id, mdkv_id, attr_id; char *last_comp = NULL; /* the name of the group obtained from traversal function */ @@ -207,6 +209,7 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ const char *name = input->name; /* group name including path to open */ + iod_trans_id_t rtid = input->rcxt_num; iod_obj_id_t grp_id; /* The ID of the group that needs to be opened */ iod_handle_t grp_oh, mdkv_oh; /* The group handle and its metadata KV handle */ scratch_pad_t sp; diff --git a/src/H5VLiod_link.c b/src/H5VLiod_link.c index 21f9e20..fb8c89c 100644 --- a/src/H5VLiod_link.c +++ b/src/H5VLiod_link.c @@ -48,6 +48,8 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, link_create_in_t *input = (link_create_in_t *)op_data->input; H5VL_link_create_type_t create_type = input->create_type; iod_handle_t coh = input->coh; /* the container handle */ + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t src_oh; /* The handle for creation src object */ iod_obj_id_t src_id; /* The ID of the creation src object */ iod_handle_t target_oh; @@ -191,6 +193,8 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, link_move_in_t *input = (link_move_in_t *)op_data->input; hbool_t copy_flag = input->copy_flag; iod_handle_t coh = input->coh; /* the container handle */ + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t src_oh; /* The handle for src object group */ iod_obj_id_t src_id; /* The ID of the src object */ iod_handle_t dst_oh; /* The handle for the dst object where link is created*/ @@ -366,6 +370,7 @@ H5VL_iod_server_link_exists_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t cur_oh; iod_obj_id_t cur_id; const char *loc_name = input->path; + iod_trans_id_t rtid = input->rcxt_num; char *last_comp = NULL; htri_t ret = -1; iod_size_t kv_size = 0; @@ -450,6 +455,7 @@ H5VL_iod_server_link_get_info_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t cur_oh; iod_obj_id_t cur_id; const char *loc_name = input->path; + iod_trans_id_t rtid = input->rcxt_num; char *last_comp = NULL; H5VL_iod_link_t iod_link; herr_t ret_value = SUCCEED; @@ -549,6 +555,7 @@ H5VL_iod_server_link_get_val_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t loc_oh = input->loc_oh; iod_obj_id_t loc_id = input->loc_id; size_t length = input->length; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t cur_oh; iod_obj_id_t cur_id; const char *loc_name = input->path; @@ -646,6 +653,8 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; iod_handle_t loc_oh = input->loc_oh; iod_obj_id_t loc_id = input->loc_id; + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t cur_oh; iod_obj_id_t cur_id; const char *loc_name = input->path; diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c index b413faf..f49260f 100644 --- a/src/H5VLiod_map.c +++ b/src/H5VLiod_map.c @@ -56,6 +56,8 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, const char *name = input->name; /* path relative to loc_id and loc_oh */ hid_t keytype = input->keytype_id; hid_t valtype = input->valtype_id; + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t map_oh, cur_oh, mdkv_oh; iod_obj_id_t cur_id, mdkv_id, attr_id; char *last_comp; /* the name of the group obtained from traversal function */ @@ -205,6 +207,7 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t loc_handle = input->loc_oh; iod_obj_id_t loc_id = input->loc_id; const char *name = input->name; + iod_trans_id_t rtid = input->rcxt_num; iod_obj_id_t map_id; /* The ID of the map that needs to be opened */ iod_handle_t map_oh, mdkv_oh; scratch_pad_t sp; @@ -311,6 +314,8 @@ H5VL_iod_server_map_set_cb(AXE_engine_t UNUSED axe_engine, binary_buf_t key = input->key; binary_buf_t val = input->val; hid_t dxpl_id = input->dxpl_id; + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_size_t key_size, val_size; size_t src_size, dst_size; void *key_buf = NULL, *val_buf = NULL; @@ -432,6 +437,7 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine, hid_t val_maptype_id = input->val_maptype_id; binary_buf_t key = input->key; hid_t dxpl_id = input->dxpl_id; + iod_trans_id_t rtid = input->rcxt_num; iod_size_t key_size, val_size; size_t src_size, dst_size; void *key_buf = NULL, *val_buf = NULL; @@ -557,7 +563,8 @@ H5VL_iod_server_map_get_count_cb(AXE_engine_t UNUSED axe_engine, map_get_count_in_t *input = (map_get_count_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; + iod_obj_id_t iod_id = input->iod_id; + iod_trans_id_t rtid = input->rcxt_num; iod_size_t num; hbool_t opened_locally = FALSE; herr_t ret_value = SUCCEED; @@ -636,6 +643,7 @@ H5VL_iod_server_map_exists_cb(AXE_engine_t UNUSED axe_engine, hid_t key_memtype_id = input->key_memtype_id; hid_t key_maptype_id = input->key_maptype_id; binary_buf_t key = input->key; + iod_trans_id_t rtid = input->rcxt_num; iod_size_t key_size, val_size; size_t src_size, dst_size; void *key_buf = NULL; @@ -738,6 +746,8 @@ H5VL_iod_server_map_delete_cb(AXE_engine_t UNUSED axe_engine, hid_t key_memtype_id = input->key_memtype_id; hid_t key_maptype_id = input->key_maptype_id; binary_buf_t key = input->key; + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_size_t key_size; size_t src_size, dst_size; void *key_buf = NULL; diff --git a/src/H5VLiod_obj.c b/src/H5VLiod_obj.c index 3c1e8b9..83a618a 100644 --- a/src/H5VLiod_obj.c +++ b/src/H5VLiod_obj.c @@ -48,6 +48,7 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, object_op_in_t *input = (object_op_in_t *)op_data->input; object_open_out_t output; iod_handle_t coh = input->coh; /* the container handle */ + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t obj_oh; /* The handle for object */ iod_obj_id_t obj_id; /* The ID of the object */ iod_handle_t mdkv_oh; @@ -244,6 +245,8 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, op_data_t *op_data = (op_data_t *)_op_data; object_copy_in_t *input = (object_copy_in_t *)op_data->input; iod_handle_t coh = input->coh; /* the container handle */ + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t dst_oh; /* The handle for the dst object where link is created*/ iod_obj_id_t dst_id; /* The ID of the dst object where link is created*/ iod_obj_id_t obj_id; /* The ID of the object to be moved/copied */ @@ -419,6 +422,7 @@ H5VL_iod_server_object_exists_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; iod_handle_t loc_oh = input->loc_oh; iod_obj_id_t loc_id = input->loc_id; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t obj_oh; iod_obj_id_t obj_id; const char *loc_name = input->loc_name; @@ -488,6 +492,7 @@ H5VL_iod_server_object_get_info_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; iod_handle_t loc_oh = input->loc_oh; iod_obj_id_t loc_id = input->loc_id; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t obj_oh, mdkv_oh, attrkv_oh; iod_obj_id_t obj_id; scratch_pad_t sp; @@ -613,6 +618,8 @@ H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t coh = input->coh; iod_handle_t loc_oh = input->loc_oh; iod_obj_id_t loc_id = input->loc_id; + iod_trans_id_t wtid = input->trans_num; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t obj_oh, mdkv_oh; iod_obj_id_t obj_id; const char *loc_name = input->path; @@ -703,6 +710,7 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t loc_oh = input->loc_oh; iod_obj_id_t loc_id = input->loc_id; size_t length = input->length; + iod_trans_id_t rtid = input->rcxt_num; iod_handle_t obj_oh, mdkv_oh; iod_obj_id_t obj_id; const char *loc_name = input->path; diff --git a/src/H5VLiod_server.c b/src/H5VLiod_server.c index 77fba12..9bcbc5d 100644 --- a/src/H5VLiod_server.c +++ b/src/H5VLiod_server.c @@ -60,8 +60,6 @@ H5VLiod_start_handler(MPI_Comm comm, MPI_Info UNUSED info) file_create_in_t, file_create_out_t); MERCURY_HANDLER_REGISTER("file_open", H5VL_iod_server_file_open, file_open_in_t, file_open_out_t); - MERCURY_HANDLER_REGISTER("file_flush", H5VL_iod_server_file_flush, - file_flush_in_t, ret_t); MERCURY_HANDLER_REGISTER("file_close", H5VL_iod_server_file_close, file_close_in_t, ret_t); @@ -463,58 +461,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_iod_server_file_flush - * - * Purpose: Function shipper registered call for File Flush. - * Inserts the real worker routine into the Async Engine. - * - * Return: Success: HG_SUCCESS - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * January, 2013 - * - *------------------------------------------------------------------------- - */ -int -H5VL_iod_server_file_flush(hg_handle_t handle) -{ - op_data_t *op_data = NULL; - file_flush_in_t *input = NULL; - int ret_value = HG_SUCCESS; - - FUNC_ENTER_NOAPI_NOINIT - - 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)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, HG_FAIL, "can't get input parameters"); - - if(NULL == engine) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); - - if(input->axe_info.count && - H5VL__iod_server_finish_axe_tasks(engine, input->axe_info.start_range, - input->axe_info.count) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, HG_FAIL, "Unable to cleanup AXE tasks"); - - op_data->hg_handle = handle; - op_data->input = (void *)input; - - if (AXE_SUCCEED != AXEcreate_barrier_task(engine, input->axe_info.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: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_iod_server_file_flush() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_iod_server_file_close * * Purpose: Function shipper registered call for File Close. diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h index 435b0e5..1207abc 100644 --- a/src/H5VLiod_server.h +++ b/src/H5VLiod_server.h @@ -81,7 +81,6 @@ H5_DLL int H5VL_iod_server_eff_init(hg_handle_t handle); H5_DLL int H5VL_iod_server_eff_finalize(hg_handle_t handle); H5_DLL int H5VL_iod_server_file_create(hg_handle_t handle); H5_DLL int H5VL_iod_server_file_open(hg_handle_t handle); -H5_DLL int H5VL_iod_server_file_flush(hg_handle_t handle); H5_DLL int H5VL_iod_server_file_close(hg_handle_t handle); H5_DLL int H5VL_iod_server_attr_create(hg_handle_t handle); H5_DLL int H5VL_iod_server_attr_open(hg_handle_t handle); @@ -149,10 +148,6 @@ H5_DLL void 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); -H5_DLL void 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); H5_DLL void 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[], diff --git a/src/H5VLiod_trans.c b/src/H5VLiod_trans.c index 49c87bc..3ea59e5 100644 --- a/src/H5VLiod_trans.c +++ b/src/H5VLiod_trans.c @@ -109,6 +109,40 @@ H5VL_iod_server_rcxt_acquire_cb(AXE_engine_t UNUSED axe_engine, } break; } + case H5RC_PREV: + { + iod_container_tids_t tids; + uint64_t u; + +#if H5VL_IOD_DEBUG + fprintf(stderr, "Next Acquire Read Context %llu\n", input->c_version); +#endif + if(iod_container_query_tids(coh, &tids, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get container tids status"); + + if(c_version >= tids.latest_rdable) { + acquired_version = tids.latest_rdable; + if(iod_trans_start(coh, &acquired_version, NULL, 0, IOD_TRANS_RD, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't acquire read context"); + break; + } + + acquired_version = IOD_TID_UNKNOWN; + u=c_version; + + for(u=c_version; u>=0; u--) { + if(iod_trans_start(coh, &u, NULL, 0, IOD_TRANS_RD, NULL) < 0) + continue; + acquired_version = u; + break; + } + + if(IOD_TID_UNKNOWN == acquired_version) { + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, + "can't get a read version before %llu\n", c_version); + } + break; + } default: HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "invalid acquire request"); } -- cgit v0.12