diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5ACprivate.h | 60 | ||||
-rw-r--r-- | src/H5B2cache.c | 15 | ||||
-rw-r--r-- | src/H5F.c | 17 | ||||
-rw-r--r-- | src/H5Fio.c | 8 | ||||
-rw-r--r-- | src/H5Fsuper_cache.c | 13 | ||||
-rw-r--r-- | src/H5HFcache.c | 12 | ||||
-rw-r--r-- | src/H5Ocache.c | 6 | ||||
-rw-r--r-- | src/H5SMcache.c | 2 |
8 files changed, 69 insertions, 64 deletions
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 2f26094..30048ba 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -52,36 +52,36 @@ /* Types of metadata objects cached */ typedef enum { - H5AC_BT_ID = 0, /*B-tree nodes */ - H5AC_SNODE_ID, /*symbol table nodes */ - H5AC_LHEAP_PRFX_ID, /*local heap prefix */ - H5AC_LHEAP_DBLK_ID, /*local heap data block */ - H5AC_GHEAP_ID, /*global heap */ - H5AC_OHDR_ID, /*object header */ - H5AC_OHDR_CHK_ID, /*object header chunk */ - H5AC_OHDR_PROXY_ID, /*object header proxy */ - H5AC_BT2_HDR_ID, /*v2 B-tree header */ - H5AC_BT2_INT_ID, /*v2 B-tree internal node */ - H5AC_BT2_LEAF_ID, /*v2 B-tree leaf node */ - H5AC_FHEAP_HDR_ID, /*fractal heap header */ - H5AC_FHEAP_DBLOCK_ID, /*fractal heap direct block */ - H5AC_FHEAP_IBLOCK_ID, /*fractal heap indirect block */ - H5AC_FSPACE_HDR_ID, /*free space header */ - H5AC_FSPACE_SINFO_ID,/*free space sections */ - H5AC_SOHM_TABLE_ID, /*shared object header message master table */ - H5AC_SOHM_LIST_ID, /*shared message index stored as a list */ - H5AC_EARRAY_HDR_ID, /*extensible array header */ - H5AC_EARRAY_IBLOCK_ID, /*extensible array index block */ - H5AC_EARRAY_SBLOCK_ID, /*extensible array super block */ - H5AC_EARRAY_DBLOCK_ID, /*extensible array data block */ - H5AC_EARRAY_DBLK_PAGE_ID, /*extensible array data block page */ - H5AC_CHUNK_PROXY_ID, /*chunk proxy */ - H5AC_FARRAY_HDR_ID, /*fixed array header */ - H5AC_FARRAY_DBLOCK_ID, /*fixed array data block */ - H5AC_FARRAY_DBLK_PAGE_ID, /*fixed array data block page */ - H5AC_SUPERBLOCK_ID, /* file superblock */ - H5AC_TEST_ID, /*test entry -- not used for actual files */ - H5AC_NTYPES /* Number of types, must be last */ + H5AC_BT_ID = 0, /*B-tree nodes */ + H5AC_SNODE_ID = 1, /*symbol table nodes */ + H5AC_LHEAP_PRFX_ID = 2, /*local heap prefix */ + H5AC_LHEAP_DBLK_ID = 3, /*local heap data block */ + H5AC_GHEAP_ID = 4, /*global heap */ + H5AC_OHDR_ID = 5, /*object header */ + H5AC_OHDR_CHK_ID = 6, /*object header chunk */ + H5AC_OHDR_PROXY_ID = 7, /*object header proxy */ + H5AC_BT2_HDR_ID = 8, /*v2 B-tree header */ + H5AC_BT2_INT_ID = 9, /*v2 B-tree internal node */ + H5AC_BT2_LEAF_ID = 10, /*v2 B-tree leaf node */ + H5AC_FHEAP_HDR_ID = 11, /*fractal heap header */ + H5AC_FHEAP_DBLOCK_ID = 12, /*fractal heap direct block */ + H5AC_FHEAP_IBLOCK_ID = 13, /*fractal heap indirect block */ + H5AC_FSPACE_HDR_ID = 14, /*free space header */ + H5AC_FSPACE_SINFO_ID = 15, /*free space sections */ + H5AC_SOHM_TABLE_ID = 16, /*shared object header message master table */ + H5AC_SOHM_LIST_ID = 17, /*shared message index stored as a list */ + H5AC_EARRAY_HDR_ID = 18, /*extensible array header */ + H5AC_EARRAY_IBLOCK_ID = 19, /*extensible array index block */ + H5AC_EARRAY_SBLOCK_ID = 20, /*extensible array super block */ + H5AC_EARRAY_DBLOCK_ID = 21, /*extensible array data block */ + H5AC_EARRAY_DBLK_PAGE_ID = 22, /*extensible array data block page */ + H5AC_CHUNK_PROXY_ID = 23, /*chunk proxy */ + H5AC_FARRAY_HDR_ID = 24, /*fixed array header */ + H5AC_FARRAY_DBLOCK_ID = 25, /*fixed array data block */ + H5AC_FARRAY_DBLK_PAGE_ID = 26, /*fixed array data block page */ + H5AC_SUPERBLOCK_ID = 27, /*file superblock */ + H5AC_TEST_ID = 28, /*test entry -- not used for actual files */ + H5AC_NTYPES = 29 /*Number of types, must be last */ } H5AC_type_t; /* H5AC_DUMP_STATS_ON_CLOSE should always be FALSE when diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 1d97c63..8074c3e 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -575,7 +575,7 @@ H5B2__cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - uint32_t chk_size; /* Exact size of the node with checksum at the end */ + size_t chk_size; /* Exact size of the node with checksum at the end */ H5B2_internal_t *ret_value; /* Return value */ FUNC_ENTER_STATIC @@ -604,10 +604,9 @@ H5B2__cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) internal->shadowed_prev = NULL; /* Internal node prefix header + records + child pointer triplets: size with checksum at the end */ - chk_size = H5B2_INT_PREFIX_SIZE + (udata->nrec * udata->hdr->rrec_size) + ((udata->nrec + 1) * H5B2_INT_POINTER_SIZE(udata->hdr, udata->depth)); - + chk_size = H5B2_INT_PREFIX_SIZE + (udata->nrec * udata->hdr->rrec_size) + ((size_t)(udata->nrec + 1) * H5B2_INT_POINTER_SIZE(udata->hdr, udata->depth)); /* Read and validate internal node from disk */ - if(H5F_read_check_metadata(f, H5FD_MEM_BTREE, H5AC_BT2_INT_ID, addr, udata->hdr->node_size, chk_size, dxpl_id, udata->hdr->page, &computed_chksum) < 0) + if(H5F_read_check_metadata(f, H5FD_MEM_BTREE, H5AC_BT2_INT_ID, addr, (size_t)udata->hdr->node_size, chk_size, dxpl_id, udata->hdr->page, &computed_chksum) < 0) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 internal node") p = udata->hdr->page; @@ -768,7 +767,7 @@ H5B2__cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t add /* Write the B-tree internal node */ HDassert((size_t)(p - internal->hdr->page) <= internal->hdr->node_size); - if(H5F_block_write(f, H5FD_MEM_BTREE, addr, internal->hdr->node_size, dxpl_id, internal->hdr->page) < 0) + if(H5F_block_write(f, H5FD_MEM_BTREE, addr, (size_t)internal->hdr->node_size, dxpl_id, internal->hdr->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree internal node to disk") internal->cache_info.is_dirty = FALSE; @@ -998,7 +997,7 @@ H5B2__cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - uint32_t chk_size; /* Exact size of the node with checksum at the end */ + size_t chk_size; /* Exact size of the node with checksum at the end */ H5B2_leaf_t *ret_value; /* Return value */ FUNC_ENTER_STATIC @@ -1030,7 +1029,7 @@ H5B2__cache_leaf_load(H5F_t UNUSED *f, hid_t dxpl_id, haddr_t addr, void *_udata chk_size = H5B2_LEAF_PREFIX_SIZE + (udata->nrec * udata->hdr->rrec_size); /* Read and validate leaf node from disk */ - if(H5F_read_check_metadata(f, H5FD_MEM_BTREE, H5AC_BT2_LEAF_ID, addr, udata->hdr->node_size, chk_size, dxpl_id, udata->hdr->page, &computed_chksum) < 0) + if(H5F_read_check_metadata(f, H5FD_MEM_BTREE, H5AC_BT2_LEAF_ID, addr, (size_t)udata->hdr->node_size, chk_size, dxpl_id, udata->hdr->page, &computed_chksum) < 0) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "incorrect metadata checksum for v2 leaf node") p = udata->hdr->page; @@ -1157,7 +1156,7 @@ H5B2__cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H /* Write the B-tree leaf node */ HDassert((size_t)(p - leaf->hdr->page) <= leaf->hdr->node_size); - if(H5F_block_write(f, H5FD_MEM_BTREE, addr, leaf->hdr->node_size, dxpl_id, leaf->hdr->page) < 0) + if(H5F_block_write(f, H5FD_MEM_BTREE, addr, (size_t)leaf->hdr->node_size, dxpl_id, leaf->hdr->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree leaf node to disk") leaf->cache_info.is_dirty = FALSE; @@ -1375,7 +1375,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, if(!file->read_attempts) file->read_attempts = H5F_SWMR_METADATA_READ_ATTEMPTS; /* Turn off accumulator */ - shared->feature_flags = lf->feature_flags & ~H5FD_FEAT_ACCUMULATE_METADATA; + shared->feature_flags = lf->feature_flags & ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if(H5FD_set_feature_flags(lf, shared->feature_flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD") } else @@ -1383,8 +1383,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, /* Determine the # of bins for metdata read retries */ file->retries_nbins = 0; - if(file->read_attempts > 1) - file->retries_nbins = HDlog10((double)(file->read_attempts - 1)) + 1; + if(file->read_attempts > 1) { + double tmp; + tmp = HDlog10((double)(file->read_attempts - 1)); + file->retries_nbins = (unsigned)tmp + 1; + } /* Initialize the tracking for metadata read retries */ for(i = 0; i < H5AC_NTYPES; i++) @@ -3505,9 +3508,10 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) *------------------------------------------------------------------------- */ herr_t -H5F_track_metadata_read_retries(H5F_t *f, H5AC_type_t actype, unsigned retries) +H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries) { unsigned log_ind; /* Index to the array of retries based on log10 of retries */ + double tmp; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3522,11 +3526,12 @@ H5F_track_metadata_read_retries(H5F_t *f, H5AC_type_t actype, unsigned retries) /* Allocate memory for retries */ if(f->retries[actype] == NULL) - if((f->retries[actype] = (uint32_t *)HDcalloc(f->retries_nbins, sizeof(uint32_t))) == NULL) + if((f->retries[actype] = (uint32_t *)HDcalloc((size_t)f->retries_nbins, sizeof(uint32_t))) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Index to retries based on log10 */ - log_ind = HDlog10((double)retries); + tmp = HDlog10((double)retries); + log_ind = (unsigned)tmp; HDassert(log_ind < f->retries_nbins); /* Increment the # of the "retries" */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 6c87284..6c2e8c1 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -304,11 +304,11 @@ H5F_get_checksums(uint8_t *buf, size_t chk_size, uint32_t *s_chksum/*out*/, uint *------------------------------------------------------------------------- */ herr_t -H5F_read_check_metadata(H5F_t *f, H5FD_mem_t type, H5AC_type_t actype, haddr_t addr, size_t read_size, size_t chk_size, +H5F_read_check_metadata(H5F_t *f, H5FD_mem_t type, unsigned actype, haddr_t addr, size_t read_size, size_t chk_size, hid_t dxpl_id, uint8_t *buf/*out*/, uint32_t *chksum/*out*/) { - size_t tries, max_tries; /* The # of read attempts */ - size_t retries; /* The # of retries */ + unsigned tries, max_tries; /* The # of read attempts */ + unsigned retries; /* The # of retries */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ herr_t ret_value = SUCCEED; /* Return value */ @@ -341,7 +341,7 @@ H5F_read_check_metadata(H5F_t *f, H5FD_mem_t type, H5AC_type_t actype, haddr_t a if(retries) { /* Does not track 0 retry */ HDfprintf(stderr, "%s: SUCCESS after %u retries; actype=%u\n", FUNC, retries, actype); if(H5F_track_metadata_read_retries(f, actype, retries) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "cannot track read tries = %u ", retries) } /* Return the computed checksum */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 4216bbe..fece50b 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -123,14 +123,14 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) haddr_t eof; /*end of file address */ uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */ uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */ - const size_t fixed_size = H5F_SUPERBLOCK_FIXED_SIZE; /*fixed sizeof superblock */ + const size_t fixed_size = H5F_SUPERBLOCK_FIXED_SIZE; /*fixed sizeof superblock */ size_t variable_size; /*variable sizeof superblock */ uint8_t *p; /* Temporary pointer into encoding buffer */ unsigned super_vers; /* Superblock version */ hbool_t *dirtied = (hbool_t *)_udata; /* Set up dirtied out value */ - size_t tries, max_tries; /* The # of read attempts to try */ - size_t fixed_tries; /* The # of read attempts to try for the fixed-size portion */ - size_t retries; /* The # of retries */ + unsigned tries, max_tries; /* The # of read attempts to try */ + unsigned fixed_tries; /* The # of read attempts to try for the fixed-size portion */ + unsigned retries; /* The # of retries */ uint32_t computed_chksum; /* Computed checksum */ uint32_t stored_chksum; /* Checksum read from file */ H5F_super_t *ret_value; /* Return value */ @@ -164,6 +164,8 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) sblock->cache_info.flush_me_collectively = TRUE; #endif + H5_CHECK_OVERFLOW(fixed_size, size_t, haddr_t); + /* Get the # of read attempts */ tries = max_tries = f->read_attempts; do { @@ -171,7 +173,6 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) do { /* Read fixed-size portion of the superblock */ p = sbuf; - H5_CHECK_OVERFLOW(fixed_size, size_t, haddr_t); if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, (haddr_t)fixed_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "set end of space allocation request failed") if(H5FD_read(lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, fixed_size, p) < 0) @@ -230,7 +231,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) shared->sizeof_addr = sizeof_addr; /* Keep a local copy also */ /* Retrieve stored and computed checksum */ - H5F_get_checksums(sbuf, fixed_size + H5F_SUPERBLOCK_VARLEN_SIZE_V2(f), &stored_chksum, &computed_chksum); + H5F_get_checksums(sbuf, fixed_size + (size_t)H5F_SUPERBLOCK_VARLEN_SIZE_V2(f), &stored_chksum, &computed_chksum); /* Verify correct checksum */ if(stored_chksum == computed_chksum) diff --git a/src/H5HFcache.c b/src/H5HFcache.c index c91ef1b..b7b4111 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -407,9 +407,9 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) const uint8_t *p; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ - size_t tries, max_tries; /* The # of read attempts */ - size_t fixed_tries; /* The # of read attempts for the minimum portion */ - size_t retries; /* The # of retries */ + unsigned tries, max_tries; /* The # of read attempts */ + unsigned fixed_tries; /* The # of read attempts for the minimum portion */ + unsigned retries; /* The # of retries */ H5HF_hdr_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1314,9 +1314,9 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) haddr_t heap_addr; /* Address of heap header in the file */ uint32_t computed_chksum; /* Computed metadata checksum value */ uint32_t stored_chksum; /* Metadata checksum value */ - size_t tries, max_tries; /* The # of read attempts */ - size_t retries; /* The # of retries */ - size_t chk_size; /* The size for validating checksum */ + unsigned tries, max_tries; /* The # of read attempts */ + unsigned retries; /* The # of retries */ + size_t chk_size; /* The size for validating checksum */ uint8_t *chk_p; /* Pointer to the area for validating checksum */ size_t read_size; /* Size of filtered direct block to read */ H5HF_direct_t *ret_value; /* Return value */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 35d7f44..d682253 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -318,9 +318,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) size_t spec_read_size; /* Size of buffer to speculatively read in */ size_t buf_size; /* Size of prefix+chunk #0 buffer */ haddr_t eoa; /* Relative end of file address */ - size_t tries, max_tries; /* The # of read attempts */ - size_t retries; /* The # of retries */ - size_t fixed_tries; /* The # of read attempts for prefix */ + unsigned tries, max_tries; /* The # of read attempts */ + unsigned retries; /* The # of retries */ + unsigned fixed_tries; /* The # of read attempts for prefix */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ H5O_t *ret_value; /* Return value */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index b01fcdc..5a2e928 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -463,7 +463,7 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t x; /* Counter variable for messages in list */ - uint32_t chk_size; /* Exact size with checksum at the end */ + size_t chk_size; /* Exact size with checksum at the end */ H5SM_list_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT |