diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5VLiod_dset.c | 26 | ||||
-rw-r--r-- | src/H5VLiod_dtype.c | 67 | ||||
-rw-r--r-- | src/H5VLiod_file.c | 33 | ||||
-rw-r--r-- | src/H5VLiod_group.c | 56 | ||||
-rw-r--r-- | src/H5VLiod_map.c | 56 | ||||
-rw-r--r-- | src/Makefile.in | 2 |
6 files changed, 157 insertions, 83 deletions
diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c index 4503732..fe2b363 100644 --- a/src/H5VLiod_dset.c +++ b/src/H5VLiod_dset.c @@ -174,7 +174,7 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "with Data integrity DISABLED\n"); #endif - if(enable_checksum) { + if((cs_scope & H5_CHECKSUM_IOD) && enable_checksum) { obj_create_hint = (iod_hint_list_t *)malloc(sizeof(iod_hint_list_t) + sizeof(iod_hint_t)); obj_create_hint->num_hint = 1; obj_create_hint->hint[0].key = "iod_obj_enable_checksum"; @@ -237,11 +237,11 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, step ++; /* create the attribute KV object for the dataset */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &attrkv_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &attrkv_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create attribute KV object"); /* create the metadata KV object for the dataset */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); /* set values for the scratch pad object */ @@ -270,10 +270,6 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, step ++; - if(H5P_DEFAULT == input->dcpl_id) - input->dcpl_id = H5Pcopy(H5P_DATASET_CREATE_DEFAULT); - dcpl_id = input->dcpl_id; - /* insert plist metadata */ if(H5VL_iod_insert_plist(mdkv_oh, wtid, dcpl_id, NULL, NULL, NULL) < 0) @@ -327,23 +323,16 @@ done: /* close parent group if it is not the location we started the traversal into */ if(loc_handle.rd_oh.cookie != cur_oh.rd_oh.cookie) { - if(iod_obj_close(cur_oh.rd_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.rd_oh, NULL, NULL); } if(loc_handle.wr_oh.cookie != cur_oh.wr_oh.cookie) { - if(iod_obj_close(cur_oh.wr_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.wr_oh, NULL, NULL); } /* return an UNDEFINED oh to the client if the operation failed */ if(ret_value < 0) { fprintf(stderr, "failed to create Dataset\n"); - if(obj_create_hint) { - free(obj_create_hint); - obj_create_hint = NULL; - } - if(step == 2) { iod_obj_close(mdkv_oh, NULL, NULL); step --; @@ -358,6 +347,11 @@ done: HG_Handler_start_output(op_data->hg_handle, &output); } + if(obj_create_hint) { + free(obj_create_hint); + obj_create_hint = NULL; + } + last_comp = (char *)H5MM_xfree(last_comp); input = (dset_create_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c index 010ba5e..8139cc9 100644 --- a/src/H5VLiod_dtype.c +++ b/src/H5VLiod_dtype.c @@ -68,6 +68,8 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, iod_blob_iodesc_t *file_desc = NULL; /* file descriptor used to write */ scratch_pad sp; int step = 0; + iod_hint_list_t *obj_create_hint = NULL; + hbool_t enable_checksum = FALSE; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -76,6 +78,21 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Start datatype commit %s at %"PRIu64"\n", name, loc_handle.wr_oh); #endif + if(H5P_DEFAULT == input->tcpl_id) + input->tcpl_id = H5Pcopy(H5P_DATATYPE_CREATE_DEFAULT); + tcpl_id = input->tcpl_id; + + /* get the scope for data integrity checks for raw data */ + if(H5Pget_ocpl_enable_checksum(tcpl_id, &enable_checksum) < 0) + HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); + + if((cs_scope & H5_CHECKSUM_IOD) && enable_checksum) { + obj_create_hint = (iod_hint_list_t *)malloc(sizeof(iod_hint_list_t) + sizeof(iod_hint_t)); + obj_create_hint->num_hint = 1; + obj_create_hint->hint[0].key = "iod_obj_enable_checksum"; + obj_create_hint->hint[0].value = "iod_obj_enable_checksum"; + } + /* the traversal will retrieve the location where the datatype needs to be created. The traversal will fail if an intermediate group does not exist. */ @@ -85,11 +102,16 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, #if H5VL_IOD_DEBUG fprintf(stderr, "Creating Datatype ID %"PRIx64" ", dtype_id); - fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64")\n", cur_oh.wr_oh, cur_id); + fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64") ", cur_oh.wr_oh, cur_id); + if(enable_checksum) + fprintf(stderr, "with Data integrity ENABLED\n"); + else + fprintf(stderr, "with Data integrity DISABLED\n"); #endif /* create the datatype */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_BLOB, NULL, NULL, &dtype_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_BLOB, + NULL, NULL, &dtype_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create BLOB"); if (iod_obj_open_read(coh, dtype_id, wtid, NULL, &dtype_oh.rd_oh, NULL) < 0) @@ -100,11 +122,13 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, step ++; /* create the metadata KV object for the datatype */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &mdkv_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); /* create the attribute KV object for the datatype */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &attr_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &attr_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create attribute KV object"); /* set values for the scratch pad object */ @@ -162,8 +186,8 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, dt_cs = H5_checksum_crc64(buf, buf_size); /* write the serialized type value to the BLOB object */ - if(iod_blob_write(dtype_oh.wr_oh, wtid, NULL, mem_desc, file_desc, NULL - /*MSC - IOD fix - &dt_cs*/, NULL) < 0) + if(iod_blob_write(dtype_oh.wr_oh, wtid, NULL, mem_desc, file_desc, + &dt_cs, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write BLOB object"); } else { @@ -175,10 +199,6 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, free(mem_desc); free(file_desc); - if(H5P_DEFAULT == input->tcpl_id) - input->tcpl_id = H5Pcopy(H5P_DATATYPE_CREATE_DEFAULT); - tcpl_id = input->tcpl_id; - /* insert plist metadata */ if(H5VL_iod_insert_plist(mdkv_oh, wtid, tcpl_id, NULL, NULL, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value"); @@ -229,25 +249,20 @@ done: /* close parent group if it is not the location we started the traversal into */ if(loc_handle.rd_oh.cookie != cur_oh.rd_oh.cookie) { - if(iod_obj_close(cur_oh.rd_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.rd_oh, NULL, NULL); } if(loc_handle.wr_oh.cookie != cur_oh.wr_oh.cookie) { - if(iod_obj_close(cur_oh.wr_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.wr_oh, NULL, NULL); } if(ret_value < 0) { if(step == 2) { - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); + iod_obj_close(mdkv_oh, NULL, NULL); step --; } if(step == 1) { - if(iod_obj_close(dtype_oh.rd_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); - if(iod_obj_close(dtype_oh.wr_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); + iod_obj_close(dtype_oh.rd_oh, NULL, NULL); + iod_obj_close(dtype_oh.wr_oh, NULL, NULL); } output.iod_oh.rd_oh.cookie = IOD_OH_UNDEFINED; @@ -255,6 +270,11 @@ done: HG_Handler_start_output(op_data->hg_handle, &output); } + if(obj_create_hint) { + free(obj_create_hint); + obj_create_hint = NULL; + } + input = (dtype_commit_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); last_comp = (char *)H5MM_xfree(last_comp); @@ -367,14 +387,17 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, file_desc->frag[0].len = (iod_size_t)buf_size; /* read the serialized type value from the BLOB object */ - if(iod_blob_read(dtype_oh.rd_oh, rtid, NULL, mem_desc, file_desc, NULL - /*MSC - IOD fix - &iod_cs*/, NULL) < 0) + if(iod_blob_read(dtype_oh.rd_oh, rtid, NULL, mem_desc, file_desc, &iod_cs, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read from BLOB object"); if(iod_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* calculate a checksum for the datatype */ dt_cs = H5_checksum_crc64(buf, buf_size); +#if H5VL_IOD_DEBUG + fprintf(stderr, "IOD BLOB checksum = %016lX Checksum Computed = %016lX\n", + iod_cs, dt_cs); +#endif /* Verifty checksum against one given by IOD */ if(iod_cs != dt_cs) HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "Data Corruption detected when reading datatype"); diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c index 7d78437..edb91bc 100644 --- a/src/H5VLiod_file.c +++ b/src/H5VLiod_file.c @@ -52,6 +52,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t mdkv_id = input->mdkv_id; iod_obj_id_t attrkv_id = input->attrkv_id; iod_obj_id_t oidkv_id = input->oidkv_id; + hid_t fcpl_id; unsigned int mode; /* create mode */ iod_handle_t coh; /* container handle */ iod_handles_t root_oh; /* root object handle */ @@ -60,10 +61,27 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, iod_trans_id_t first_tid = 0; uint32_t cs_scope = 0; iod_hint_list_t *con_open_hint = NULL; + iod_hint_list_t *obj_create_hint = NULL; + hbool_t enable_checksum = FALSE; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT + if(H5P_DEFAULT == input->fcpl_id) + input->fcpl_id = H5Pcopy(H5P_FILE_CREATE_DEFAULT); + fcpl_id = input->fcpl_id; + + /* get the scope for data integrity checks */ + if(H5Pget_ocpl_enable_checksum(fcpl_id, &enable_checksum) < 0) + HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); + + if((cs_scope & H5_CHECKSUM_IOD) && enable_checksum) { + obj_create_hint = (iod_hint_list_t *)malloc(sizeof(iod_hint_list_t) + sizeof(iod_hint_t)); + obj_create_hint->num_hint = 1; + obj_create_hint->hint[0].key = "iod_obj_enable_checksum"; + obj_create_hint->hint[0].value = "iod_obj_enable_checksum"; + } + #if H5VL_IOD_DEBUG fprintf(stderr, "Start file create %s ", input->name); fprintf(stderr, "with MDKV %"PRIx64" ", mdkv_id), @@ -95,8 +113,8 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_IOD(ret, FAIL, "can't start transaction"); /* create the root group */ - root_ret = iod_obj_create(coh, first_tid, NULL, IOD_OBJ_KV, NULL, NULL, - &root_id, NULL); + root_ret = iod_obj_create(coh, first_tid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &root_id, NULL); if(0 == root_ret || -EEXIST == root_ret) { /* root group has been created, open it */ ret = iod_obj_open_write(coh, root_id, first_tid, NULL, &root_oh.wr_oh, NULL); @@ -116,15 +134,16 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, scratch_pad sp; iod_kv_t kv; uint64_t value = 1; - hid_t fcpl_id; /* create the metadata KV object for the root group */ - ret = iod_obj_create(coh, first_tid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL); + ret = iod_obj_create(coh, first_tid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &mdkv_id, NULL); if(ret < 0) HGOTO_ERROR_IOD(ret, FAIL, "can't create metadata KV object"); /* create the attribute KV object for the root group */ - ret = iod_obj_create(coh, first_tid, NULL, IOD_OBJ_KV, NULL, NULL, &attrkv_id, NULL); + ret = iod_obj_create(coh, first_tid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &attrkv_id, NULL); if(ret < 0) HGOTO_ERROR_IOD(ret, FAIL, "can't create attribute KV object"); @@ -161,10 +180,6 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, if(ret < 0) HGOTO_ERROR_IOD(ret, FAIL, "can't open metadata KV"); - /* store metadata */ - if(H5P_DEFAULT == input->fcpl_id) - input->fcpl_id = H5Pcopy(H5P_FILE_CREATE_DEFAULT); - fcpl_id = input->fcpl_id; /* insert plist metadata */ if(H5VL_iod_insert_plist(mdkv_oh, first_tid, fcpl_id, NULL, NULL, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTSET, FAIL, "can't insert link count KV value"); diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c index 94805d7..54a8a04 100644 --- a/src/H5VLiod_group.c +++ b/src/H5VLiod_group.c @@ -61,6 +61,8 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t mdkv_oh; iod_obj_id_t cur_id; char *last_comp = NULL; /* the name of the group obtained from traversal function */ + iod_hint_list_t *obj_create_hint = NULL; + hbool_t enable_checksum = FALSE; hid_t gcpl_id; scratch_pad sp; iod_ret_t ret; @@ -73,6 +75,21 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Start group create %s at %"PRIu64"\n", name, loc_handle.wr_oh); #endif + if(H5P_DEFAULT == input->gcpl_id) + input->gcpl_id = H5Pcopy(H5P_GROUP_CREATE_DEFAULT); + gcpl_id = input->gcpl_id; + + /* get the scope for data integrity checks */ + if(H5Pget_ocpl_enable_checksum(gcpl_id, &enable_checksum) < 0) + HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); + + if((cs_scope & H5_CHECKSUM_IOD) && enable_checksum) { + obj_create_hint = (iod_hint_list_t *)malloc(sizeof(iod_hint_list_t) + sizeof(iod_hint_t)); + obj_create_hint->num_hint = 1; + obj_create_hint->hint[0].key = "iod_obj_enable_checksum"; + obj_create_hint->hint[0].value = "iod_obj_enable_checksum"; + } + /* the traversal will retrieve the location where the group needs to be created. The traversal will fail if an intermediate group does not exist. */ @@ -83,11 +100,16 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, #if H5VL_IOD_DEBUG fprintf(stderr, "Creating Group ID %"PRIx64" (CV %"PRIu64", TR %"PRIu64") ", grp_id, rtid, wtid); - fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64")\n", cur_oh.wr_oh, cur_id); + fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64") ", cur_oh.wr_oh, cur_id); + if(enable_checksum) + fprintf(stderr, "with Data integrity ENABLED\n"); + else + fprintf(stderr, "with Data integrity DISABLED\n"); #endif /* create the group */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &grp_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &grp_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Group"); if((ret = iod_obj_open_read(coh, grp_id, wtid, NULL, &grp_oh.rd_oh, NULL)) < 0) { @@ -102,11 +124,13 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, step += 1; /* create the metadata KV object for the group */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &mdkv_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); /* create the attribute KV object for the group */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &attrkv_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &attrkv_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); /* set values for the scratch pad object */ @@ -135,10 +159,6 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, step ++; - if(H5P_DEFAULT == input->gcpl_id) - input->gcpl_id = H5Pcopy(H5P_GROUP_CREATE_DEFAULT); - gcpl_id = input->gcpl_id; - /* insert plist metadata */ if(H5VL_iod_insert_plist(mdkv_oh, wtid, gcpl_id, NULL, NULL, NULL) < 0) @@ -182,12 +202,10 @@ done: /* close parent group if it is not the location we started the traversal into */ if(loc_handle.rd_oh.cookie != cur_oh.rd_oh.cookie) { - if(iod_obj_close(cur_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.rd_oh, NULL, NULL); } if(loc_handle.wr_oh.cookie != cur_oh.wr_oh.cookie) { - if(iod_obj_close(cur_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.wr_oh, NULL, NULL); } /* return an UNDEFINED oh to the client if the operation failed */ @@ -195,15 +213,12 @@ done: fprintf(stderr, "Failed Group Create\n"); if(step == 2) { - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); + iod_obj_close(mdkv_oh, NULL, NULL); step --; } if(step == 1) { - if(iod_obj_close(grp_oh.rd_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); - if(iod_obj_close(grp_oh.wr_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); + iod_obj_close(grp_oh.rd_oh, NULL, NULL); + iod_obj_close(grp_oh.wr_oh, NULL, NULL); } output.iod_oh.rd_oh.cookie = IOD_OH_UNDEFINED; @@ -211,6 +226,11 @@ done: HG_Handler_start_output(op_data->hg_handle, &output); } + if(obj_create_hint) { + free(obj_create_hint); + obj_create_hint = NULL; + } + last_comp = (char *)H5MM_xfree(last_comp); input = (group_create_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c index 63221bd..f451f12 100644 --- a/src/H5VLiod_map.c +++ b/src/H5VLiod_map.c @@ -67,6 +67,8 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t cur_id; char *last_comp; /* the name of the group obtained from traversal function */ hid_t mcpl_id; + iod_hint_list_t *obj_create_hint = NULL; + hbool_t enable_checksum = FALSE; int step = 0; scratch_pad sp; herr_t ret_value = SUCCEED; @@ -78,6 +80,21 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, name, loc_handle.wr_oh); #endif + if(H5P_DEFAULT == input->mcpl_id) + input->mcpl_id = H5Pcopy(H5P_MAP_CREATE_DEFAULT); + mcpl_id = input->mcpl_id; + + /* get the scope for data integrity checks for raw data */ + if(H5Pget_ocpl_enable_checksum(mcpl_id, &enable_checksum) < 0) + HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); + + if((cs_scope & H5_CHECKSUM_IOD) && enable_checksum) { + obj_create_hint = (iod_hint_list_t *)malloc(sizeof(iod_hint_list_t) + sizeof(iod_hint_t)); + obj_create_hint->num_hint = 1; + obj_create_hint->hint[0].key = "iod_obj_enable_checksum"; + obj_create_hint->hint[0].value = "iod_obj_enable_checksum"; + } + /* the traversal will retrieve the location where the map needs to be created. The traversal will fail if an intermediate group does not exist. */ @@ -87,11 +104,16 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, #if H5VL_IOD_DEBUG fprintf(stderr, "Creating Map ID %"PRIx64") ", map_id); - fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64")\n", cur_oh.wr_oh, cur_id); + fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64") ", cur_oh.wr_oh, cur_id); + if(enable_checksum) + fprintf(stderr, "with Data integrity ENABLED\n"); + else + fprintf(stderr, "with Data integrity DISABLED\n"); #endif /* create the map */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &map_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &map_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Map"); if (iod_obj_open_read(coh, map_id, wtid, NULL, &map_oh.rd_oh, NULL) < 0) @@ -102,11 +124,13 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, step ++; /* create the metadata KV object for the map */ - if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &mdkv_id, NULL) < 0) HGOTO_ERROR2(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, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &attr_id, NULL) < 0) + if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &attr_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object"); /* set values for the scratch pad object */ @@ -134,10 +158,6 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, step ++; - if(H5P_DEFAULT == input->mcpl_id) - input->mcpl_id = H5Pcopy(H5P_MAP_CREATE_DEFAULT); - mcpl_id = input->mcpl_id; - /* insert plist metadata */ if(H5VL_iod_insert_plist(mdkv_oh, wtid, mcpl_id, NULL, NULL, NULL) < 0) @@ -187,12 +207,10 @@ done: /* close parent group if it is not the location we started the traversal into */ if(loc_handle.rd_oh.cookie != cur_oh.rd_oh.cookie) { - if(iod_obj_close(cur_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.rd_oh, NULL, NULL); } if(loc_handle.wr_oh.cookie != cur_oh.wr_oh.cookie) { - if(iod_obj_close(cur_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); + iod_obj_close(cur_oh.wr_oh, NULL, NULL); } /* return an UNDEFINED oh to the client if the operation failed */ @@ -200,15 +218,12 @@ done: fprintf(stderr, "Failed Map Create\n"); if(step == 2) { - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); + iod_obj_close(mdkv_oh, NULL, NULL); step --; } if(step == 1) { - if(iod_obj_close(map_oh.rd_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); - if(iod_obj_close(map_oh.wr_oh, NULL, NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); + iod_obj_close(map_oh.rd_oh, NULL, NULL); + iod_obj_close(map_oh.wr_oh, NULL, NULL); } output.iod_oh.rd_oh.cookie = IOD_OH_UNDEFINED; @@ -216,6 +231,11 @@ done: HG_Handler_start_output(op_data->hg_handle, &output); } + if(obj_create_hint) { + free(obj_create_hint); + obj_create_hint = NULL; + } + last_comp = (char *)H5MM_xfree(last_comp); input = (map_create_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); diff --git a/src/Makefile.in b/src/Makefile.in index ae555c9..29274f6 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -364,6 +364,8 @@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ +MCHECKSUM_CFLAGS = @MCHECKSUM_CFLAGS@ +MCHECKSUM_LIBS = @MCHECKSUM_LIBS@ MERCURY_CFLAGS = @MERCURY_CFLAGS@ MERCURY_LIBS = @MERCURY_LIBS@ MKDIR_P = @MKDIR_P@ |