diff options
author | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2014-03-14 15:37:17 (GMT) |
---|---|---|
committer | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2014-03-14 15:37:17 (GMT) |
commit | 0a98583aa4596b62ac992e60bb9558c5fa1c56aa (patch) | |
tree | 8df0fb05cef1b87ae1830d9030e87f3fdc1cb4a2 | |
parent | 517bbb52b34c81bcdda6e31796f7ffcaec594e67 (diff) | |
download | hdf5-0a98583aa4596b62ac992e60bb9558c5fa1c56aa.zip hdf5-0a98583aa4596b62ac992e60bb9558c5fa1c56aa.tar.gz hdf5-0a98583aa4596b62ac992e60bb9558c5fa1c56aa.tar.bz2 |
[svn-r24798] More fixes to H5X
Add H5VLiod_index.c to cmake
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/H5FF.c | 64 | ||||
-rw-r--r-- | src/H5VLiod.c | 23 | ||||
-rw-r--r-- | src/H5VLiod_client.c | 36 | ||||
-rw-r--r-- | src/H5VLiod_client.h | 8 | ||||
-rw-r--r-- | src/H5VLiod_common.h | 1 | ||||
-rw-r--r-- | src/H5VLiod_server.h | 4 | ||||
-rw-r--r-- | src/H5X.c | 2 |
8 files changed, 95 insertions, 44 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 320b38e..9e6c31a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -656,6 +656,7 @@ IF (HDF5_ENABLE_EFF) ${HDF5_SRC_DIR}/H5Pxapl.c ${HDF5_SRC_DIR}/H5Pxcpl.c ${HDF5_SRC_DIR}/H5Pxxpl.c + ${HDF5_SRC_DIR}/H5VLiod_index.c ) ENDIF (HDF5_ENABLE_INDEXING) SET (H5FF_HDRS @@ -53,6 +53,7 @@ #include "H5VLprivate.h" /* VOL plugins */ #include "H5VLiod.h" /* IOD plugin - tmp */ #include "H5VLiod_client.h" /* Client IOD - tmp */ +#include "H5Xprivate.h" /* Indexing */ #ifdef H5_HAVE_EFF /****************/ @@ -789,7 +790,68 @@ H5Dopen_ff(hid_t loc_id, const char *name, hid_t dapl_id, hid_t rcxt_id, hid_t e /* Get an atom for the dataset */ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") + +#ifdef H5_HAVE_INDEXING + { + H5_priv_request_t *request = NULL; /* private request struct inserted in event queue */ + void **req = NULL; /* pointer to plugin generate requests (NULL if VOL plugin does not support async) */ + H5X_class_t *idx_class = NULL; + void *idx_handle = NULL; + unsigned plugin_id; + size_t metadata_size; + size_t idx_count; + void *metadata; + H5P_genplist_t *xxpl_plist; /* Property list pointer */ + hid_t xapl_id = H5P_INDEX_ACCESS_DEFAULT; + + if (estack_id != H5_EVENT_STACK_NULL) { + /* create the private request */ + if (NULL == (request = (H5_priv_request_t *) H5MM_calloc(sizeof(H5_priv_request_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + request->req = NULL; + req = &request->req; + request->next = NULL; + request->vol_plugin = vol_plugin; + vol_plugin->nrefs ++; + } + + /* Get index info if present */ + if (FAIL == H5VL_iod_dataset_get_index_info(dset, &idx_count, &plugin_id, + &metadata_size, &metadata, rcxt_id, req)) + HGOTO_ERROR(H5E_INDEX, H5E_CANTGET, FAIL, "can't get index info for dataset"); + + if (request && *req) { + if(H5ES_insert(estack_id, request) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to insert request in event stack"); + } + + /* TODO this is synchronous for now as we need the info first */ +// H5ES_wait(estack_id, ); + + if (idx_count) { + /* store the read context ID in the xxpl */ + if(NULL == (xxpl_plist = (H5P_genplist_t *)H5I_object(xapl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(H5P_set(xxpl_plist, H5VL_CONTEXT_ID, &rcxt_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for trans_id"); + + if (NULL == (idx_class = H5X_registered(plugin_id))) + HGOTO_ERROR(H5E_INDEX, H5E_CANTGET, FAIL, "can't get index plugin class"); + + /* Call open of index plugin */ + if (NULL == (idx_handle = idx_class->open(loc_id, ret_value, xapl_id, + metadata_size, metadata))) + HGOTO_ERROR(H5E_INDEX, H5E_CANTOPENOBJ, FAIL, "indexing open callback failed"); + + /* Add idx_handle to dataset */ + if (FAIL == H5VL_iod_dataset_set_index(dset, idx_handle)) + HGOTO_ERROR(H5E_INDEX, H5E_CANTSET, FAIL, "cannot set index to dataset"); + if (FAIL == H5VL_iod_dataset_set_index_plugin_id(dset, plugin_id)) + HGOTO_ERROR(H5E_INDEX, H5E_CANTSET, FAIL, "cannot set index plugin ID to dataset"); + } + } +#endif done: if (ret_value < 0 && dset) diff --git a/src/H5VLiod.c b/src/H5VLiod.c index af6c684..738e233 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -2890,6 +2890,10 @@ H5VL_iod_dataset_create(void *_obj, H5VL_loc_params_t UNUSED loc_params, dset->remote_dset.iod_oh.rd_oh.cookie = IOD_OH_UNDEFINED; dset->remote_dset.iod_oh.wr_oh.cookie = IOD_OH_UNDEFINED; dset->remote_dset.iod_id = IOD_OBJ_INVALID; +#ifdef H5_HAVE_INDEXING + dset->idx_plugin_id = 0; + dset->idx_handle = NULL; +#endif /* Generate IOD IDs for the dset to be created */ H5VL_iod_gen_obj_id(obj->file->my_rank, obj->file->num_procs, @@ -3078,6 +3082,10 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t UNUSED loc_params, const cha dset->remote_dset.dcpl_id = -1; dset->remote_dset.type_id = -1; dset->remote_dset.space_id = -1; +#ifdef H5_HAVE_INDEXING + dset->idx_plugin_id = 0; + dset->idx_handle = NULL; +#endif /* set the input structure for the HG encode routine */ input.coh = obj->file->remote_file.coh; @@ -3120,13 +3128,6 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t UNUSED loc_params, const cha (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"); -#ifdef H5_HAVE_INDEXING - /* TODO create a new req here */ - if (FAIL == H5VL_iod_dataset_get_index_info(dset, &dset->idx_plugin_id, - &dset->metadata_size, &dset->metadata, rcxt_id, req)) - HGOTO_ERROR(H5E_INDEX, H5E_CANTGET, FAIL, "can't get index info for dataset"); -#endif - ret_value = (void *)dset; done: @@ -10297,7 +10298,7 @@ unsigned H5VL_iod_dataset_get_index_plugin_id(void *dset) { H5VL_iod_dset_t *iod_dset = (H5VL_iod_dset_t *) dset; - void *ret_value = NULL; + unsigned ret_value; FUNC_ENTER_NOAPI_NOINIT @@ -10387,8 +10388,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_iod_dataset_get_index_info(void *_dset, unsigned *plugin_id, size_t *metadata_size, - void **metadata, hid_t rcxt_id, void **req) +H5VL_iod_dataset_get_index_info(void *_dset, size_t *count, + unsigned *plugin_id, size_t *metadata_size, + void **metadata, hid_t rcxt_id, void **req) { H5VL_iod_request_t **parent_reqs = NULL; H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *) _dset; @@ -10439,6 +10441,7 @@ H5VL_iod_dataset_get_index_info(void *_dset, unsigned *plugin_id, size_t *metada if (NULL == (info = (H5VL_iod_dataset_get_index_info_t *) H5MM_calloc(sizeof(H5VL_iod_dataset_get_index_info_t)))) HGOTO_ERROR(H5E_INDEX, H5E_NOSPACE, FAIL, "can't allocate info"); + info->count = count; info->plugin_id = plugin_id; info->metadata_size = metadata_size; info->metadata = metadata; diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index e78b295..4c54333 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -33,6 +33,7 @@ #include "H5VLiod.h" /* Iod VOL plugin */ #include "H5VLiod_common.h" #include "H5VLiod_client.h" +#include "H5Xprivate.h" #include "H5WBprivate.h" /* Wrapped Buffers */ #ifdef H5_HAVE_EFF @@ -1660,17 +1661,18 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) } case HG_DSET_GET_INDEX_INFO: { - H5VL_iod_dataset_get_index_info_t *index_info = + H5VL_iod_dataset_get_index_info_t *idx_info = (H5VL_iod_dataset_get_index_info_t *)req->data; - unsigned plugin_id = index_info->output->idx_plugin_id; + unsigned plugin_id = idx_info->output->idx_plugin_id; + size_t count = idx_info->output->idx_count; if(!plugin_id) { HERROR(H5E_INDEX, H5E_BADVALUE, "invalid index plugin ID\n"); req->status = H5ES_STATUS_FAIL; req->state = H5VL_IOD_COMPLETED; } else { - size_t metadata_size = index_info->output->idx_metadata.buf_size; - void *metadata = index_info->output->idx_metadata.buf; + size_t metadata_size = idx_info->output->idx_metadata.buf_size; + void *metadata = idx_info->output->idx_metadata.buf; void *new_metadata; if (!metadata_size) @@ -1681,28 +1683,10 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) if (FAIL == HDmemcpy(new_metadata, metadata, metadata_size)) HGOTO_ERROR(H5E_INDEX, H5E_CANTCOPY, FAIL, "can't copy metadata"); - *index_info->plugin_id = plugin_id; - *index_info->metadata_size = metadata_size; - *index_info->metadata = new_metadata; - - // H5X_class_t *idx_class = NULL; - // H5P_genplist_t *xxpl_plist; /* Property list pointer */ - - // hid_t xapl_id = H5P_INDEX_ACCESS_DEFAULT; - - /* store the transaction ID in the xxpl */ -// if(NULL == (xxpl_plist = (H5P_genplist_t *)H5I_object(xapl_id))) -// HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") -// if(H5P_set(xxpl_plist, H5VL_CONTEXT_ID, &index_info->rcxt_id) < 0) -// HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for trans_id"); - -// if (NULL == (idx_class = H5X_registered(plugin_id))) -// HGOTO_ERROR(H5E_INDEX, H5E_CANTGET, FAIL, "can't get index plugin class"); - - /* TODO registered tmp IDs for file and dset ?? */ -// if (NULL == (idx_handle = idx_class->open(file_id, dataset_id, xapl_id, -// metadata_size, metadata))) -// HGOTO_ERROR(H5E_INDEX, H5E_CANTOPENOBJ, FAIL, "indexing open callback failed"); + if (idx_info->count) *idx_info->count = count; + if (idx_info->plugin_id) *idx_info->plugin_id = plugin_id; + if (idx_info->metadata_size) *idx_info->metadata_size = metadata_size; + if (idx_info->metadata) *idx_info->metadata = new_metadata; } req->data = NULL; diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index 6c179c1..aabf520 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -270,8 +270,6 @@ typedef struct H5VL_iod_dset_t { #ifdef H5_HAVE_INDEXING void *idx_handle; unsigned idx_plugin_id; - size_t metadata_size; - void *metadata; #endif } H5VL_iod_dset_t; @@ -393,6 +391,7 @@ typedef struct H5VL_iod_exists_info_t { #ifdef H5_HAVE_INDEXING /* information about a dataset write request */ typedef struct H5VL_iod_dataset_get_index_info_t { + size_t *count; unsigned *plugin_id; size_t *metadata_size; void **metadata; @@ -500,8 +499,9 @@ H5_DLL herr_t H5VL_iod_dataset_set_index_plugin_id(void *dset, unsigned plugin_i H5_DLL unsigned H5VL_iod_dataset_get_index_plugin_id(void *dset); H5_DLL herr_t H5VL_iod_dataset_set_index_info(void *dset, unsigned plugin_id, size_t metadata_size, void *metadata, hid_t trans_id, void **req); -H5_DLL herr_t H5VL_iod_dataset_get_index_info(void *dset, unsigned *plugin_id, - size_t *metadata_size, void **metadata, hid_t trans_id, void **req); +H5_DLL herr_t H5VL_iod_dataset_get_index_info(void *dset, size_t *count, + unsigned *plugin_id, size_t *metadata_size, void **metadata, + hid_t trans_id, void **req); H5_DLL herr_t H5VL_iod_dataset_remove_index_info(void *dset, hid_t trans_id, void **req); diff --git a/src/H5VLiod_common.h b/src/H5VLiod_common.h index aa71139..f0e42dd 100644 --- a/src/H5VLiod_common.h +++ b/src/H5VLiod_common.h @@ -783,6 +783,7 @@ MERCURY_GEN_PROC(dset_get_index_info_in_t, ((iod_obj_id_t)(mdkv_id))) MERCURY_GEN_PROC(dset_get_index_info_out_t, ((int32_t)(ret)) + ((uint64_t)(idx_count)) ((uint32_t)(idx_plugin_id)) ((binary_buf_t)(idx_metadata))) MERCURY_GEN_PROC(dset_rm_index_info_in_t, diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h index 929da37..b44f528 100644 --- a/src/H5VLiod_server.h +++ b/src/H5VLiod_server.h @@ -192,11 +192,11 @@ H5_DLL void H5VL_iod_server_dset_set_index_info_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_dset_set_index_info_cb(AXE_engine_t axe_engine, +H5_DLL void H5VL_iod_server_dset_get_index_info_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_dset_set_index_info_cb(AXE_engine_t axe_engine, +H5_DLL void H5VL_iod_server_dset_remove_index_info_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); @@ -676,7 +676,7 @@ H5Xget_count_ff(hid_t scope_id, hsize_t *idx_count, hid_t rcxt_id, vol_plugin->nrefs ++; } - /* TODO for now idx_count is flag exist */ + /* Get index info */ if (FAIL == H5VL_iod_dataset_get_index_info(dset, idx_count, NULL, NULL, rcxt_id, req)) HGOTO_ERROR(H5E_INDEX, H5E_CANTSET, FAIL, "cannot get indexing info from dataset"); |