summaryrefslogtreecommitdiffstats
path: root/src/H5HFcache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-12-17 15:07:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-12-17 15:07:35 (GMT)
commit77038a81755bd6c853323ba261c9c671800d7be7 (patch)
tree8c61a206ea1a60c319006aa5dd42604170fa7607 /src/H5HFcache.c
parent9474f434a37ee313be94b0388af4322ecdace648 (diff)
downloadhdf5-77038a81755bd6c853323ba261c9c671800d7be7.zip
hdf5-77038a81755bd6c853323ba261c9c671800d7be7.tar.gz
hdf5-77038a81755bd6c853323ba261c9c671800d7be7.tar.bz2
[svn-r18030] Description:
Bring "brush clearing" changes (whitespace & style issues, mostly) from metadata_journaling branch to the "merging" branch, to converge the trunk and the metadata_journaling branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5HFcache.c')
-rw-r--r--src/H5HFcache.c114
1 files changed, 12 insertions, 102 deletions
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 23bc28e..908188e 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -268,9 +268,6 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
H5HF_hdr_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_load)
-#ifdef QAK
-HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
-#endif /* QAK */
/* Check arguments */
HDassert(f);
@@ -346,7 +343,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
/* Sanity check */
/* (allow for checksum not decoded yet) */
- HDassert((size_t)(p - buf) == (size - H5HF_SIZEOF_CHKSUM));
+ HDassert((size_t)(p - (const uint8_t *)buf) == (size - H5HF_SIZEOF_CHKSUM));
/* Check for I/O filter information to decode */
if(hdr->filter_len > 0) {
@@ -355,7 +352,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
H5O_pline_t *pline; /* Pipeline information from the header on disk */
/* Compute the offset of the filter info in the header */
- filter_info_off = p - buf;
+ filter_info_off = p - (const uint8_t *)buf;
/* Compute the size of the extra filter information */
filter_info_size = hdr->sizeof_size /* Size of size for filtered root direct block */
@@ -401,13 +398,13 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
/* Compute checksum on entire header */
/* (including the filter information, if present) */
- computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
+ computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - buf) == hdr->heap_size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == hdr->heap_size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -416,9 +413,6 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
/* Finish initialization of heap header */
if(H5HF_hdr_finish_init(hdr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header")
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->fspace = %p\n", FUNC, hdr->fspace);
-#endif /* QAK */
/* Set return value */
ret_value = hdr;
@@ -444,11 +438,6 @@ done:
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Feb 24 2006
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
*
*-------------------------------------------------------------------------
*/
@@ -460,9 +449,6 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_flush)
-#ifdef QAK
-HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy);
-#endif /* QAK */
/* check arguments */
HDassert(f);
@@ -676,7 +662,7 @@ H5HF_cache_hdr_size(const H5F_t UNUSED *f, const H5HF_hdr_t *hdr, size_t *size_p
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_hdr_size)
- /* check arguments */
+ /* Check arguments */
HDassert(f);
HDassert(hdr);
HDassert(size_ptr);
@@ -721,9 +707,6 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows
H5HF_indirect_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_load)
-#ifdef QAK
-HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
-#endif /* QAK */
/* Check arguments */
HDassert(f);
@@ -850,22 +833,19 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
iblock->nchildren++;
iblock->max_child = u;
} /* end if */
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr);
-#endif /* QAK */
} /* end for */
/* Sanity check */
HDassert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */
/* Compute checksum on indirect block */
- computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0);
+ computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0);
/* Metadata checksum */
UINT32DECODE(p, stored_chksum);
/* Sanity check */
- HDassert((size_t)(p - buf) == iblock->size);
+ HDassert((size_t)(p - (const uint8_t *)buf) == iblock->size);
/* Verify checksum */
if(stored_chksum != computed_chksum)
@@ -910,12 +890,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 6 2006
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -948,12 +922,6 @@ HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC
/* Get the pointer to the shared heap header */
hdr = iblock->hdr;
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows);
-HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size);
-HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off);
-HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtable.cparam.width);
-#endif /* QAK */
/* Set the shared heap header's file context for this operation */
hdr->f = f;
@@ -984,9 +952,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab
/* Encode indirect block-specific fields */
for(u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) {
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr);
-#endif /* QAK */
/* Encode child block address */
H5F_addr_encode(f, &p, iblock->ents[u].addr);
@@ -997,9 +962,6 @@ HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].add
/* Encode extra information for direct blocks */
if(u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) {
-#ifdef QAK
-HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->filt_ents[u].size, iblock->filt_ents[u].filter_mask);
-#endif /* QAK */
/* Sanity check */
/* (either both the address & size are defined or both are
* not defined)
@@ -1085,9 +1047,6 @@ H5HF_cache_iblock_dest(H5F_t UNUSED *f, H5HF_indirect_t *iblock)
*/
HDassert(iblock);
HDassert(iblock->rc == 0);
-#ifdef QAK
-HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC);
-#endif /* QAK */
/* Set the shared heap header's file context for this operation */
iblock->hdr->f = f;
@@ -1173,7 +1132,7 @@ H5HF_cache_iblock_size(const H5F_t UNUSED *f, const H5HF_indirect_t *iblock, siz
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_size)
- /* check arguments */
+ /* Check arguments */
HDassert(iblock);
HDassert(size_ptr);
@@ -1239,7 +1198,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Allocate block buffer */
/* XXX: Change to using free-list factories */
- if((dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) == NULL)
+ if(NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Check for I/O filters on this heap */
@@ -1252,10 +1211,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size,
/* Check for root direct block */
if(par_info->iblock == NULL) {
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask);
-HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr));
@@ -1264,11 +1219,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr-
filter_mask = hdr->pline_root_direct_filter_mask;
} /* end if */
else {
-#ifdef QAK
-HDfprintf(stderr, "%s: par_info->iblock = %p, par_info->entry = %u\n", FUNC, par_info->iblock, par_info->entry);
-HDfprintf(stderr, "%s: par_info->iblock->filt_ents[%u].size = %Zu, par_info->iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_info->entry, par_info->iblock->filt_ents[par_info->entry].size, par_info->entry, par_info->iblock->filt_ents[par_info->entry].filter_mask);
-HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_info->entry, par_info->iblock->ents[par_info->entry].addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(par_info->iblock->ents[par_info->entry].addr, addr));
@@ -1280,9 +1230,6 @@ HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC,
/* Allocate buffer to perform I/O filtering on */
if(NULL == (read_buf = H5MM_malloc(read_size)))
HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer")
-#ifdef QAK
-HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_buf);
-#endif /* QAK */
/* Read filtered direct block from disk */
if(H5F_block_read(f, H5FD_MEM_FHEAP_DBLOCK, addr, read_size, dxpl_id, read_buf) < 0)
@@ -1290,12 +1237,8 @@ HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_
/* Push direct block data through I/O filter pipeline */
nbytes = read_size;
- if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC,
- filter_cb, &nbytes, &read_size, &read_buf) < 0)
+ if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed")
-#ifdef QAK
-HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nbytes, read_size, read_buf);
-#endif /* QAK */
/* Sanity check */
HDassert(nbytes == dblock->size);
@@ -1341,7 +1284,7 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb
/* Offset of heap within the heap's address space */
UINT64DECODE_VAR(p, dblock->block_off, hdr->heap_off_size);
- /* Encode checksum on direct block, if requested */
+ /* Decode checksum on direct block, if requested */
if(hdr->checksum_dblocks) {
uint32_t stored_chksum; /* Metadata checksum value */
uint32_t computed_chksum; /* Computed metadata checksum value */
@@ -1386,12 +1329,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 27 2006
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1465,15 +1402,8 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Push direct block data through I/O filter pipeline */
nbytes = write_size;
- if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC,
- filter_cb, &nbytes, &write_size, &write_buf) < 0)
+ if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed")
-#ifdef QAK
-HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, write_buf);
-HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off);
-HDfprintf(stderr, "%s: dblock->size = %Zu, dblock->blk = %p\n", FUNC, dblock->size, dblock->blk);
-HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dblock->parent, dblock->par_entry);
-#endif /* QAK */
/* Use the compressed number of bytes as the size to write */
write_size = nbytes;
@@ -1482,10 +1412,6 @@ HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dbl
if(dblock->parent == NULL) {
hbool_t hdr_changed = FALSE; /* Whether the header information changed */
-#ifdef QAK
-HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask);
-HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr));
HDassert(hdr->pline_root_direct_size > 0);
@@ -1498,9 +1424,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr-
/* Check if we need to re-size the block on disk */
if(hdr->pline_root_direct_size != write_size) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC);
-#endif /* QAK */
/* Release direct block's current disk space */
if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)hdr->pline_root_direct_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block")
@@ -1536,10 +1459,6 @@ HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC);
par_iblock = dblock->parent;
par_entry = dblock->par_entry;
-#ifdef QAK
-HDfprintf(stderr, "%s: par_iblock->filt_ents[%u].size = %Zu, par_iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_entry, par_iblock->filt_ents[par_entry].size, par_entry, par_iblock->filt_ents[par_entry].filter_mask);
-HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_entry, par_iblock->ents[par_entry].addr, addr);
-#endif /* QAK */
/* Sanity check */
HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr));
HDassert(par_iblock->filt_ents[par_entry].size > 0);
@@ -1552,9 +1471,6 @@ HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_e
/* Check if we need to re-size the block on disk */
if(par_iblock->filt_ents[par_entry].size != write_size) {
-#ifdef QAK
-HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC);
-#endif /* QAK */
/* Release direct block's current disk space */
if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)par_iblock->filt_ents[par_entry].size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block")
@@ -1588,9 +1504,6 @@ HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC);
} /* end else */
/* Write the direct block */
-#ifdef QAK
-HDfprintf(stderr, "%s: addr = %a, write_size = %Zu\n", FUNC, addr, write_size);
-#endif /* QAK */
if(H5F_block_write(f, H5FD_MEM_FHEAP_DBLOCK, addr, write_size, dxpl_id, write_buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap direct block to disk")
@@ -1635,9 +1548,6 @@ H5HF_cache_dblock_dest(H5F_t UNUSED *f, H5HF_direct_t *dblock)
* Check arguments.
*/
HDassert(dblock);
-#ifdef QAK
-HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock);
-#endif /* QAK */
/* Set the shared heap header's file context for this operation */
dblock->hdr->f = f;