From 0cba93e0a48754e5cd769178af0cf325fa670878 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 15 Jul 2013 14:15:50 -0500 Subject: [svn-r23901] - update creation of the attribute KV to be when the object is created. --- src/H5VLiod.c | 1 + src/H5VLiod_attr.c | 12 ----- src/H5VLiod_client.c | 131 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/H5VLiod_dset.c | 9 +++- src/H5VLiod_dtype.c | 9 +++- src/H5VLiod_file.c | 9 +++- src/H5VLiod_group.c | 9 +++- src/H5VLiod_map.c | 9 +++- 8 files changed, 164 insertions(+), 25 deletions(-) diff --git a/src/H5VLiod.c b/src/H5VLiod.c index ee2bb91..e126dd0 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -4800,6 +4800,7 @@ H5VL_iod_link_create(H5VL_link_create_type_t create_type, void *_obj, H5VL_loc_p if(NULL == target_obj && obj) { target_obj = obj; } + /* Retrieve the parent info by traversing the path where the link should be created. */ if(H5VL_iod_get_parent_info(target_obj, target_params, ".", diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c index dda7b6a..44229df 100644 --- a/src/H5VLiod_attr.c +++ b/src/H5VLiod_attr.c @@ -170,18 +170,6 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object"); - /* if attribute KV does not exist, create it */ - if(IOD_ID_UNDEFINED == sp.attr_id) { - /* create the attribute KV object for the parent */ - if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, - NULL, NULL, &sp.attr_id, NULL)<0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attr KV"); - - /* set scratch pad in attribute */ - if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); - } - /* open the attribute KV in scratch pad */ if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index b604d60..003d743 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -41,6 +41,17 @@ H5FL_EXTERN(H5VL_iod_group_t); H5FL_EXTERN(H5VL_iod_dset_t); H5FL_EXTERN(H5VL_iod_dtype_t); + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_request_add + * + * Purpose: Adds a request pointer to the Doubly linked list on the + * file. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_request_add(H5VL_iod_file_t *file, H5VL_iod_request_t *request) { @@ -63,6 +74,17 @@ H5VL_iod_request_add(H5VL_iod_file_t *file, H5VL_iod_request_t *request) FUNC_LEAVE_NOAPI(SUCCEED) } + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_request_delete + * + * Purpose: Removes a request pointer from the Doubly linked list on the + * file. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_request_delete(H5VL_iod_file_t *file, H5VL_iod_request_t *request) { @@ -103,6 +125,22 @@ H5VL_iod_request_delete(H5VL_iod_file_t *file, H5VL_iod_request_t *request) FUNC_LEAVE_NOAPI(SUCCEED) } + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_request_wait + * + * Purpose: + * Waits for a particular request to complete. This will test + * the request completion using Mercury's test routine. If the + * request is still pending we test for completion of other requests in + * the file's linked list to try and keep making progress. Once the + * original requests completes, we remove it from the linked list + * and return. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_request_wait(H5VL_iod_file_t *file, H5VL_iod_request_t *request) { @@ -180,6 +218,16 @@ H5VL_iod_request_wait(H5VL_iod_file_t *file, H5VL_iod_request_t *request) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5VL_iod_wait */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_request_wait_all + * + * Purpose: Wait and complete all the requests in the linked list. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_request_wait_all(H5VL_iod_file_t *file) { @@ -218,6 +266,17 @@ H5VL_iod_request_wait_all(H5VL_iod_file_t *file) FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_request_wait_all */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_request_wait_some + * + * Purpose: Wait for some requests on the linked list, particularly + * the ones that are tracked with a particular object. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_request_wait_some(H5VL_iod_file_t *file, const void *object) { @@ -259,6 +318,18 @@ H5VL_iod_request_wait_some(H5VL_iod_file_t *file, const void *object) FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_request_wait_some */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_request_complete + * + * Purpose: Completion calls for every type of request. This checks + * the return status from the server, and frees memory + * allocated by this request. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) { @@ -764,6 +835,17 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_request_complete */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_request_cancel + * + * Purpose: Cancels a particular request by freeing memory + * associated with it. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_request_cancel(H5VL_iod_file_t *file, H5VL_iod_request_t *req) { @@ -1055,8 +1137,21 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_request_cancel */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_get_axe_parents + * + * Purpose: returns the number of axe_id tasks that are associated + * with a particular object. If the parent array is not NULL, + * the axe_ids are returned in parents too. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t -H5VL_iod_get_axe_parents(H5VL_iod_object_t *obj, size_t *count, uint64_t *parents) +H5VL_iod_get_axe_parents(H5VL_iod_object_t *obj, /*IN/OUT*/ size_t *count, + /*OUT*/ uint64_t *parents) { H5VL_iod_file_t *file = obj->file; H5VL_iod_request_t *cur_req = file->request_list_head; @@ -1083,10 +1178,28 @@ H5VL_iod_get_axe_parents(H5VL_iod_object_t *obj, size_t *count, uint64_t *parent FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5VL_iod_get_axe_parents */ + +/*------------------------------------------------------------------------- + * 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, iod_obj_id_t *iod_id, iod_handle_t *iod_oh, - uint64_t *axe_id, char **new_name, H5VL_iod_object_t **last_obj) + const char *name, /*OUT*/iod_obj_id_t *iod_id, + /*OUT*/iod_handle_t *iod_oh, /*OUT*/uint64_t *axe_id, + /*OUT*/char **new_name, /*OUT*/H5VL_iod_object_t **last_obj) { iod_obj_id_t cur_id; iod_handle_t cur_oh; @@ -1224,6 +1337,18 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_get_parent_info */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_get_axe_parents + * + * 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. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ herr_t H5VL_iod_gen_obj_id(int myrank, int nranks, uint64_t cur_index, iod_obj_type_t type, uint64_t *id) diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c index 1710d9c..d2b31d0 100644 --- a/src/H5VLiod_dset.c +++ b/src/H5VLiod_dset.c @@ -52,7 +52,7 @@ H5VL_iod_server_dset_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 dset_id = input->dset_id; /* The ID of the dataset that needs to be created */ iod_handle_t dset_oh, cur_oh, mdkv_oh; - iod_obj_id_t cur_id, mdkv_id; + iod_obj_id_t cur_id, mdkv_id, attr_id; const char *name = input->name; char *last_comp; /* the name of the dataset obtained from the last component in the path */ iod_kv_t kv; @@ -115,6 +115,11 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, /* for the process that succeeded in creating the dataset, update the parent KV, create scratch pad */ if(0 == ret) { + /* create the attribute KV object for the dataset */ + if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, + NULL, NULL, &attr_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); + /* create the metadata KV object for the dataset */ if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) @@ -122,7 +127,7 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, /* set values for the scratch pad object */ sp.mdkv_id = mdkv_id; - sp.attr_id = IOD_ID_UNDEFINED; + sp.attr_id = attr_id; sp.filler1_id = IOD_ID_UNDEFINED; sp.filler2_id = IOD_ID_UNDEFINED; diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c index 06585e8..d5e39a8 100644 --- a/src/H5VLiod_dtype.c +++ b/src/H5VLiod_dtype.c @@ -52,7 +52,7 @@ H5VL_iod_server_dtype_commit_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 dtype_id = input->dtype_id; /* The ID of the datatype that needs to be created */ iod_handle_t dtype_oh, cur_oh, mdkv_oh; - iod_obj_id_t cur_id, mdkv_id; + iod_obj_id_t cur_id, mdkv_id, attr_id; const char *name = input->name; iod_kv_t kv; char *last_comp; /* the name of the datatype obtained from the last component in the path */ @@ -98,9 +98,14 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, 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 datatype */ + if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, + NULL, NULL, &attr_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); + /* set values for the scratch pad object */ sp.mdkv_id = mdkv_id; - sp.attr_id = IOD_ID_UNDEFINED; + sp.attr_id = attr_id; sp.filler1_id = IOD_ID_UNDEFINED; sp.filler2_id = IOD_ID_UNDEFINED; diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c index 3dc9a3e..15db6aa 100644 --- a/src/H5VLiod_file.c +++ b/src/H5VLiod_file.c @@ -52,7 +52,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, unsigned int mode; iod_handle_t coh; iod_handle_t root_oh, mdkv_oh; - iod_obj_id_t mdkv_id; + iod_obj_id_t mdkv_id, attr_id; iod_ret_t ret; herr_t ret_value = SUCCEED; @@ -93,9 +93,14 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, 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, + NULL, NULL, &attr_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); + /* set values for the scratch pad object */ sp.mdkv_id = mdkv_id; - sp.attr_id = IOD_ID_UNDEFINED; + sp.attr_id = attr_id; sp.filler1_id = IOD_ID_UNDEFINED; sp.filler2_id = IOD_ID_UNDEFINED; diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c index c50e902..c59fc64 100644 --- a/src/H5VLiod_group.c +++ b/src/H5VLiod_group.c @@ -55,7 +55,7 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t grp_id = input->grp_id; /* The ID of the group that needs to be created */ const char *name = input->name; /* path relative to loc_id and loc_oh */ iod_handle_t grp_oh, cur_oh, mdkv_oh; - iod_obj_id_t cur_id, mdkv_id; + iod_obj_id_t cur_id, mdkv_id, attr_id; char *last_comp; /* the name of the group obtained from traversal function */ iod_kv_t kv; scratch_pad_t sp; @@ -96,9 +96,14 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, 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 group */ + if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, + NULL, NULL, &attr_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); + /* set values for the scratch pad object */ sp.mdkv_id = mdkv_id; - sp.attr_id = IOD_ID_UNDEFINED; + sp.attr_id = attr_id; sp.filler1_id = IOD_ID_UNDEFINED; sp.filler2_id = IOD_ID_UNDEFINED; diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c index 6511bf5..3c8c8f2 100644 --- a/src/H5VLiod_map.c +++ b/src/H5VLiod_map.c @@ -57,7 +57,7 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, hid_t keytype = input->keytype_id; hid_t valtype = input->valtype_id; iod_handle_t map_oh, cur_oh, mdkv_oh; - iod_obj_id_t cur_id, mdkv_id; + iod_obj_id_t cur_id, mdkv_id, attr_id; char *last_comp; /* the name of the group obtained from traversal function */ iod_kv_t kv; scratch_pad_t sp; @@ -98,9 +98,14 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, 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, + NULL, NULL, &attr_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); + /* set values for the scratch pad object */ sp.mdkv_id = mdkv_id; - sp.attr_id = IOD_ID_UNDEFINED; + sp.attr_id = attr_id; sp.filler1_id = IOD_ID_UNDEFINED; sp.filler2_id = IOD_ID_UNDEFINED; -- cgit v0.12