diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-01-29 16:39:45 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-01-29 16:39:45 (GMT) |
commit | 27f42f93dbf61accb226f13e40561fdc250af8bb (patch) | |
tree | 41ace8cde1fc2698764f0df0fb720deb83b1281b /src | |
parent | 38e234db27022cd6fe53027be1c4b847524c5450 (diff) | |
download | hdf5-27f42f93dbf61accb226f13e40561fdc250af8bb.zip hdf5-27f42f93dbf61accb226f13e40561fdc250af8bb.tar.gz hdf5-27f42f93dbf61accb226f13e40561fdc250af8bb.tar.bz2 |
[svn-r24660] - update scratch pad data integrity. Works with IOD now.
- add object creation property to enable/disable checksum per object
* Still not used yet.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Pocpl.c | 19 | ||||
-rw-r--r-- | src/H5Sselect.c | 94 | ||||
-rw-r--r-- | src/H5VLiod.c | 80 | ||||
-rw-r--r-- | src/H5VLiod.h | 4 | ||||
-rw-r--r-- | src/H5VLiod_attr.c | 14 | ||||
-rw-r--r-- | src/H5VLiod_common.c | 18 | ||||
-rw-r--r-- | src/H5VLiod_dset.c | 5 | ||||
-rw-r--r-- | src/H5VLiod_dtype.c | 2 | ||||
-rw-r--r-- | src/H5VLiod_file.c | 19 | ||||
-rw-r--r-- | src/H5VLiod_group.c | 2 | ||||
-rw-r--r-- | src/H5VLiod_link.c | 6 | ||||
-rw-r--r-- | src/H5VLiod_map.c | 2 | ||||
-rw-r--r-- | src/H5VLiod_obj.c | 10 | ||||
-rw-r--r-- | src/H5VLiod_server.h | 2 | ||||
-rw-r--r-- | src/H5VLiod_util.c | 6 |
15 files changed, 182 insertions, 101 deletions
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 32f6a1b..cb68496 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -49,6 +49,13 @@ /****************/ /* ========= Object Creation properties ============ */ +#ifdef H5_HAVE_EFF +/* hint for IOD to enable checksums on an object */ +#define H5O_CRT_ENABLE_CHECKSUM_SIZE sizeof(hbool_t) +#define H5O_CRT_ENABLE_CHECKSUM_DEF FALSE +#define H5O_CRT_ENABLE_CHECKSUM_ENC H5P__encode_hbool_t +#define H5O_CRT_ENABLE_CHECKSUM_DEC H5P__decode_hbool_t +#endif /* Definitions for the max. # of attributes to store compactly */ #define H5O_CRT_ATTR_MAX_COMPACT_SIZE sizeof(unsigned) #define H5O_CRT_ATTR_MAX_COMPACT_ENC H5P__encode_unsigned @@ -132,7 +139,9 @@ static const unsigned H5O_def_attr_max_compact_g = H5O_CRT_ATTR_MAX_COMPACT_DEF; static const unsigned H5O_def_attr_min_dense_g = H5O_CRT_ATTR_MIN_DENSE_DEF; /* Default min. dense attribute storage settings */ static const uint8_t H5O_def_ohdr_flags_g = H5O_CRT_OHDR_FLAGS_DEF; /* Default object header flag settings */ static const H5O_pline_t H5O_def_pline_g = H5O_CRT_PIPELINE_DEF; /* Default I/O pipeline setting */ - +#ifdef H5_HAVE_EFF +static const hbool_t H5O_def_enable_checksum_g = H5O_CRT_ENABLE_CHECKSUM_DEF; +#endif /*------------------------------------------------------------------------- @@ -154,6 +163,14 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_STATIC +#ifdef H5_HAVE_EFF + if(H5P_register_real(pclass, H5O_CRT_ENABLE_CHECKSUM_NAME, H5O_CRT_ENABLE_CHECKSUM_SIZE, + &H5O_def_enable_checksum_g, + NULL, NULL, NULL, H5O_CRT_ENABLE_CHECKSUM_ENC, H5O_CRT_ENABLE_CHECKSUM_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#endif + /* Register max. compact attribute storage property */ if(H5P_register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC, diff --git a/src/H5Sselect.c b/src/H5Sselect.c index eabfc09..58d25f6 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2148,32 +2148,22 @@ done: } /* end H5S_get_offsets() */ #ifdef H5_HAVE_EFF - -/*------------------------------------------------------------------------- - * Function: H5S_checksum - * - * Purpose: Computes a checksum for a buffer with a dataspace - * selection using the HDF5 fletcher checksume routines. - * - * Return: Returns a 32-bit value. Every bit of the key affects every bit of - * the return value. Two keys differing by one or two bits will have - * totally different hash values. - * - * Programmer: Mohamad Chaarawi - * June 2013 - * - *------------------------------------------------------------------------- - */ uint64_t H5S_checksum(const void *buf, size_t elmt_size, size_t nelmts, const H5S_t *space) { + H5S_sel_iter_t iter; /* Memory selection iteration info */ + hbool_t iter_init = 0; /* Memory selection iteration info has been initialized */ hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in memory */ hsize_t *off = NULL; /* Pointer to sequence offsets in memory */ size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in memory */ size_t *len = NULL; /* Pointer to sequence lengths in memory */ - H5S_sel_iter_t iter; /* Memory selection iteration info */ - hbool_t iter_init = 0; /* Memory selection iteration info has been initialized */ size_t nseq; /* Number of sequences generated */ + size_t nelem; /* Number of elements used in sequences */ + size_t i; + const uint8_t *p = (const uint8_t *)buf; + const char *hash_method = "crc64"; + size_t hash_size; + mchecksum_object_t checksum; uint64_t ret_value = 0; FUNC_ENTER_NOAPI_NOINIT @@ -2181,57 +2171,39 @@ H5S_checksum(const void *buf, size_t elmt_size, size_t nelmts, const H5S_t *spac len = _len; off = _off; - /* Check for only one element in selection */ - if(nelmts == 1) { - size_t buf_size = elmt_size * nelmts; - - if(H5S_SELECT_OFFSET(space, off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "can't retrieve memory selection offset"); - - ret_value = H5_checksum_crc64(buf, buf_size); - } /* end if */ - else { - size_t nelem; /* Number of elements used in sequences */ - size_t i; - const uint8_t *p = (const uint8_t *)buf; - const char *hash_method = "crc64"; - size_t hash_size; - mchecksum_object_t checksum; - - /* Initialize iterator */ - if(H5S_select_iter_init(&iter, space, elmt_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, 0, "unable to initialize selection iterator") - iter_init = 1; + /* Initialize iterator */ + if(H5S_select_iter_init(&iter, space, elmt_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, 0, "unable to initialize selection iterator") + iter_init = 1; - nseq = 0; + nseq = 0; - /* Initialize checksum */ - mchecksum_init(hash_method, &checksum); + /* Initialize checksum */ + mchecksum_init(hash_method, &checksum); - /* Loop, until all bytes are processed */ - while(nelmts > 0) { - /* Get sequences for selection */ - if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, H5D_IO_VECTOR_SIZE, nelmts, &nseq, - &nelem, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); + /* Loop, until all bytes are processed */ + while(nelmts > 0) { + /* Get sequences for selection */ + if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, H5D_IO_VECTOR_SIZE, nelmts, &nseq, + &nelem, off, len) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); - for(i=0 ; i<nseq ; i++) { - mchecksum_update(checksum, p+off[i], len[i]); - } - nelmts -= nelem; - } /* end while */ + for(i=0 ; i<nseq ; i++) { + mchecksum_update(checksum, p+off[i], len[i]); + } + nelmts -= nelem; + } /* end while */ - /* Get size of checksum */ - hash_size = mchecksum_get_size(checksum); + /* Get size of checksum */ + hash_size = mchecksum_get_size(checksum); - assert(hash_size == sizeof(uint64_t)); + assert(hash_size == sizeof(uint64_t)); - /* get checksum value */ - mchecksum_get(checksum, &ret_value, hash_size, 1); + /* get checksum value */ + mchecksum_get(checksum, &ret_value, hash_size, 1); - /* Destroy checksum */ - mchecksum_destroy(checksum); - } /* end else */ + /* Destroy checksum */ + mchecksum_destroy(checksum); done: /* Release memory selection iterator */ diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 695927e..f39f987 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -973,6 +973,81 @@ done: /*------------------------------------------------------------------------- + * Function: H5Pset_ocpl_enable_checksum + * + * Purpose: Set a boolean flag on the object creation property list + * to indicate to the VOL plugin to enable checksum on the + * object to be created. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * January, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_ocpl_enable_checksum(hid_t ocpl_id, hbool_t flag) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", ocpl_id, flag); + + if(ocpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, &flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_ocpl_enable_checksum() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_ocpl_enable_checksum + * + * Purpose: Retrieve a boolean flag on the object creation property + * list that indicates whether checksuming on this object + * is enabled or not. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * January, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_ocpl_enable_checksum(hid_t ocpl_id, hbool_t *flag/*out*/) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", ocpl_id, flag); + + if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl") + + /* Get the transfer mode */ + if(flag) + if(H5P_get(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_ocpl_enable_checksum() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_dxpl_checksum * * Purpose: Modify the dataset transfer property list to set a @@ -3202,7 +3277,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, char fake_char; int *status = NULL; H5VL_iod_write_info_t *info; /* info struct used to manage I/O parameters once the operation completes*/ - uint64_t internal_cs; /* internal checksum calculated in this function */ + uint64_t internal_cs = 0; /* internal checksum calculated in this function */ H5VL_iod_request_t **parent_reqs = NULL; size_t num_parents = 0; hid_t trans_id; @@ -3367,6 +3442,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, input.trans_num = tr->trans_num; input.rcxt_num = tr->c_version; input.cs_scope = dset->common.file->md_integrity_scope; + input.axe_id = g_axe_id; status = (int *)malloc(sizeof(int)); @@ -3374,7 +3450,7 @@ H5VL_iod_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, printf("Dataset Write, axe id %"PRIu64"\n", g_axe_id); #endif - /* setup info struct for I/O request + /* 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_write_info_t *)H5MM_calloc(sizeof(H5VL_iod_write_info_t)))) HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't allocate a request"); diff --git a/src/H5VLiod.h b/src/H5VLiod.h index 07b74b8..719967e 100644 --- a/src/H5VLiod.h +++ b/src/H5VLiod.h @@ -48,7 +48,7 @@ extern "C" { #define H5D_XFER_CHECKSUM_NAME "checksum" #define H5D_XFER_CHECKSUM_PTR_NAME "checksum_ptr" #define H5D_CRT_APPEND_ONLY_NAME "append_only" - +#define H5O_CRT_ENABLE_CHECKSUM_NAME "enable_obj_checksum" H5_DLL H5VL_class_t *H5VL_iod_init(void); H5_DLL herr_t H5Pset_fapl_iod(hid_t fapl_id, MPI_Comm comm, MPI_Info info); @@ -56,6 +56,8 @@ H5_DLL herr_t EFF_start_server(MPI_Comm comm, MPI_Info info); H5_DLL herr_t EFF_init(MPI_Comm comm, MPI_Info info); H5_DLL herr_t EFF_finalize(void); +H5_DLL herr_t H5Pset_ocpl_enable_checksum(hid_t ocpl_id, hbool_t flag); +H5_DLL herr_t H5Pget_ocpl_enable_checksum(hid_t ocpl_id, hbool_t *flag); H5_DLL herr_t H5Pset_dxpl_checksum(hid_t dxpl_id, uint64_t value); H5_DLL herr_t H5Pget_dxpl_checksum(hid_t dxpl_id, uint64_t *value); H5_DLL herr_t H5Pset_dxpl_checksum_ptr(hid_t dxpl_id, uint64_t *value); diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c index 602060d..d14b7c0 100644 --- a/src/H5VLiod_attr.c +++ b/src/H5VLiod_attr.c @@ -172,7 +172,7 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -313,7 +313,7 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -359,7 +359,7 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -833,7 +833,7 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -944,7 +944,7 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -1076,7 +1076,7 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -1126,7 +1126,7 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_common.c b/src/H5VLiod_common.c index afb6089..38e60fc 100644 --- a/src/H5VLiod_common.c +++ b/src/H5VLiod_common.c @@ -930,8 +930,8 @@ H5_checksum_crc64(const void *buf, size_t buf_size) { const char *hash_method = "crc64"; size_t hash_size; - uint64_t hash; mchecksum_object_t checksum; + uint64_t ret_value = 0; /* Initialize checksum */ mchecksum_init(hash_method, &checksum); @@ -945,12 +945,12 @@ H5_checksum_crc64(const void *buf, size_t buf_size) assert(hash_size == sizeof(uint64_t)); /* get checksum value */ - mchecksum_get(checksum, &hash, hash_size, 1); + mchecksum_get(checksum, &ret_value, hash_size, 1); /* Destroy checksum */ mchecksum_destroy(checksum); - return hash; + return ret_value; } uint64_t @@ -958,9 +958,9 @@ H5_checksum_crc64_segments(hg_bulk_segment_t *segments, size_t count) { const char *hash_method = "crc64"; size_t hash_size; - uint64_t hash; size_t i; mchecksum_object_t checksum; + uint64_t ret_value; /* Initialize checksum */ mchecksum_init(hash_method, &checksum); @@ -976,12 +976,12 @@ H5_checksum_crc64_segments(hg_bulk_segment_t *segments, size_t count) assert(hash_size == sizeof(uint64_t)); /* get checksum value */ - mchecksum_get(checksum, &hash, hash_size, 1); + mchecksum_get(checksum, &ret_value, hash_size, 1); /* Destroy checksum */ mchecksum_destroy(checksum); - return hash; + return ret_value; } uint64_t @@ -989,9 +989,9 @@ H5_checksum_crc64_fragments(void **buf, size_t *buf_size, size_t count) { const char *hash_method = "crc64"; size_t hash_size; - uint64_t hash; size_t i; mchecksum_object_t checksum; + uint64_t ret_value; /* Initialize checksum */ mchecksum_init(hash_method, &checksum); @@ -1007,10 +1007,10 @@ H5_checksum_crc64_fragments(void **buf, size_t *buf_size, size_t count) assert(hash_size == sizeof(uint64_t)); /* get checksum value */ - mchecksum_get(checksum, &hash, hash_size, 1); + mchecksum_get(checksum, &ret_value, hash_size, 1); /* Destroy checksum */ mchecksum_destroy(checksum); - return hash; + return ret_value; } diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c index 43c9eea..1e617f3 100644 --- a/src/H5VLiod_dset.c +++ b/src/H5VLiod_dset.c @@ -231,9 +231,10 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, /* set scratch pad in dataset */ if(cs_scope & H5_CHECKSUM_IOD) { - iod_checksum_t sp_cs; + iod_checksum_t sp_cs = 0; sp_cs = H5_checksum_crc64(&sp, sizeof(sp)); + if (iod_obj_set_scratch(dset_oh.wr_oh, wtid, &sp, &sp_cs, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad"); } @@ -398,7 +399,7 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c index 4b2a9dc..010ba5e 100644 --- a/src/H5VLiod_dtype.c +++ b/src/H5VLiod_dtype.c @@ -326,7 +326,7 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c index 53e90f5..7d78437 100644 --- a/src/H5VLiod_file.c +++ b/src/H5VLiod_file.c @@ -59,6 +59,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, iod_ret_t ret, root_ret; iod_trans_id_t first_tid = 0; uint32_t cs_scope = 0; + iod_hint_list_t *con_open_hint = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -78,8 +79,14 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, if(H5Pget_metadata_integrity_scope(input->fapl_id, &cs_scope) < 0) HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); + if(cs_scope & H5_CHECKSUM_IOD) { + con_open_hint = (iod_hint_list_t *)malloc(sizeof(iod_hint_list_t) + sizeof(iod_hint_t)); + con_open_hint->num_hint = 1; + con_open_hint->hint[0].key = "iod_con_scratch_cksum"; + } + /* Create the Container */ - ret = iod_container_open(input->name, NULL, mode, &coh, NULL); + ret = iod_container_open(input->name, con_open_hint, mode, &coh, NULL); if(ret < 0) HGOTO_ERROR_IOD(ret, FAIL, "can't create container"); @@ -137,6 +144,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, iod_checksum_t sp_cs; sp_cs = H5_checksum_crc64(&sp, sizeof(sp)); + /* set scratch pad in root group */ ret = iod_obj_set_scratch(root_oh.wr_oh, first_tid, &sp, &sp_cs, NULL); if(ret < 0) @@ -214,6 +222,11 @@ done: input = (file_create_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); + if(con_open_hint) { + free(con_open_hint); + con_open_hint = NULL; + } + FUNC_LEAVE_NOAPI_VOID } /* end H5VL_iod_server_file_create_cb() */ @@ -302,7 +315,7 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -519,7 +532,7 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c index 5047009..94805d7 100644 --- a/src/H5VLiod_group.c +++ b/src/H5VLiod_group.c @@ -284,7 +284,7 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_link.c b/src/H5VLiod_link.c index 35ea1c7..89d08d1 100644 --- a/src/H5VLiod_link.c +++ b/src/H5VLiod_link.c @@ -106,7 +106,7 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -303,7 +303,7 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -775,7 +775,7 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c index 277e2ff..63221bd 100644 --- a/src/H5VLiod_map.c +++ b/src/H5VLiod_map.c @@ -284,7 +284,7 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_obj.c b/src/H5VLiod_obj.c index aa60d04..d5d171d 100644 --- a/src/H5VLiod_obj.c +++ b/src/H5VLiod_obj.c @@ -138,7 +138,7 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -352,7 +352,7 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -604,7 +604,7 @@ H5VL_iod_server_object_get_info_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -747,7 +747,7 @@ H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } @@ -855,7 +855,7 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ - if(H5VL_iod_verify_scratch_pad(sp, sp_cs) < 0) + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); } diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h index d18367e..1b004de 100644 --- a/src/H5VLiod_server.h +++ b/src/H5VLiod_server.h @@ -415,7 +415,7 @@ H5_DLL herr_t H5VL_iod_get_metadata(iod_handle_t oh, iod_trans_id_t tid, H5VL_io H5_DLL herr_t H5VL__iod_server_adjust_buffer(hid_t from_type_id, hid_t to_type_id, size_t nelmts, hid_t dxpl_id, size_t size, void **buf, hbool_t *is_vl_data, size_t *_buf_size); -H5_DLL herr_t H5VL_iod_verify_scratch_pad(scratch_pad sp, iod_checksum_t iod_cs); +H5_DLL herr_t H5VL_iod_verify_scratch_pad(scratch_pad *sp, iod_checksum_t iod_cs); H5_DLL herr_t H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size, hbool_t write_op, void *buf, size_t buf_size, iod_checksum_t cs, uint32_t cs_scope, iod_trans_id_t tid); diff --git a/src/H5VLiod_util.c b/src/H5VLiod_util.c index 38780b0..df86b7f 100644 --- a/src/H5VLiod_util.c +++ b/src/H5VLiod_util.c @@ -1060,17 +1060,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_iod_verify_scratch_pad(scratch_pad sp, iod_checksum_t iod_cs) +H5VL_iod_verify_scratch_pad(scratch_pad *sp, iod_checksum_t iod_cs) { iod_checksum_t computed_cs = 0; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT_NOERR - computed_cs = H5_checksum_crc64(&sp, sizeof(sp)); + computed_cs = H5_checksum_crc64(sp, sizeof(scratch_pad)); if(computed_cs != iod_cs) { - fprintf(stderr, "Scratch pad integrity check failed. IOD cs = %"PRIu64", Computed cs = %"PRIu64"", + fprintf(stderr, "Scratch pad integrity check failed. IOD cs = %"PRIu64", Computed cs = %"PRIu64"\n", iod_cs, computed_cs); ret_value = FAIL; } |