From 6edac6e2df7e30807bd41b09765a44c37d1f1bc1 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 25 Sep 2012 16:29:40 -0500 Subject: [svn-r22812] Purpose: Mainly to add SWMR flush dependencies to the free space manager (H5FS) code. Also fixes a few issues with the local heap and the fixed array code, and brings the MANIFEST up to date. Tested on: jam --- MANIFEST | 5 + src/H5FA.c | 168 ++++++++++++----------- src/H5FAcache.c | 297 +++++++++++++++++++++-------------------- src/H5FAdbg.c | 160 +++++++++++----------- src/H5FAdblkpage.c | 62 ++++----- src/H5FAdblock.c | 108 +++++++-------- src/H5FAhdr.c | 109 +++++++-------- src/H5FAint.c | 2 - src/H5FApkg.h | 130 +++++++++--------- src/H5FAprivate.h | 31 ++--- src/H5FAstat.c | 18 +-- src/H5FAtest.c | 101 +++++++------- src/H5FS.c | 381 ++++++++++++++++++++++++++++++----------------------- src/H5FScache.c | 256 ++++++++++++++++++++--------------- src/H5FSdbg.c | 127 +++++++++--------- src/H5FSpkg.h | 23 ++-- src/H5FSprivate.h | 21 +-- src/H5FSpublic.h | 2 +- src/H5FSsection.c | 372 ++++++++++++++++++++++----------------------------- src/H5FSstat.c | 14 +- src/H5FStest.c | 29 ++-- src/H5HL.c | 41 ++---- src/H5HLcache.c | 90 ++----------- src/H5HLdbg.c | 4 +- src/H5HLdblk.c | 9 +- src/H5HLint.c | 21 +-- src/H5HLprfx.c | 5 +- src/Makefile.am | 3 +- src/Makefile.in | 72 +++++----- 29 files changed, 1297 insertions(+), 1364 deletions(-) diff --git a/MANIFEST b/MANIFEST index c485649..d805477 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1034,10 +1034,15 @@ ./test/space_overflow.c _DO_NOT_DISTRIBUTE_ ./test/specmetaread.h5 ./test/stab.c +./test/swmr_addrem_writer.c ./test/swmr_common.c ./test/swmr_common.h ./test/swmr_generator.c ./test/swmr_reader.c +./test/swmr_remove_reader.c +./test/swmr_remove_writer.c +./test/swmr_sparse_reader.c +./test/swmr_sparse_writer.c ./test/swmr_writer.c ./test/tarray.c ./test/tarrold.h5 diff --git a/src/H5FA.c b/src/H5FA.c index 92647fe..75ac465 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -15,12 +15,12 @@ /*------------------------------------------------------------------------- * - * Created: H5FA.c - * April 2009 - * Vailin Choi + * Created: H5FA.c + * April 2009 + * Vailin Choi * - * Purpose: Implements a Fixed Array for storing elements - * of datasets with fixed dimensions + * Purpose: Implements a Fixed Array for storing elements + * of datasets with fixed dimensions. * *------------------------------------------------------------------------- */ @@ -39,11 +39,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Vprivate.h" /* Vector functions */ /****************/ @@ -76,9 +76,9 @@ * client class.. */ const H5FA_class_t *const H5FA_client_class_g[] = { - H5FA_CLS_CHUNK, /* 0 - H5FA_CLS_CHUNK_ID */ - H5FA_CLS_FILT_CHUNK, /* 1 - H5FA_CLS_FILT_CHUNK_ID */ - H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */ + H5FA_CLS_CHUNK, /* 0 - H5FA_CLS_CHUNK_ID */ + H5FA_CLS_FILT_CHUNK, /* 1 - H5FA_CLS_FILT_CHUNK_ID */ + H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */ }; @@ -100,14 +100,14 @@ H5FL_BLK_DEFINE(native_elmt); /*------------------------------------------------------------------------- - * Function: H5FA_create + * Function: H5FA_create * - * Purpose: Creates a new fixed array (header) in the file. + * Purpose: Creates a new fixed array (header) in the file. * - * Return: Pointer to fixed array wrapper on success + * Return: Pointer to fixed array wrapper on success * NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -136,24 +136,24 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Create fixed array header */ if(HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, dxpl_id, cparam, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "can't create fixed array header") + H5E_THROW(H5E_CANTINIT, "can't create fixed array header") /* Allocate fixed array wrapper */ if(NULL == (fa = H5FL_MALLOC(H5FA_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") /* Lock the array header into memory */ if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, ctx_udata, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Point fixed array wrapper at header and bump it's ref count */ fa->hdr = hdr; if(H5FA__hdr_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") /* Increment # of files using this array header */ if(H5FA__hdr_fuse_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") /* Set file pointer for this array open context */ fa->f = f; @@ -164,7 +164,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); CATCH if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") if(!ret_value) if(fa && H5FA_close(fa, dxpl_id) < 0) H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") @@ -173,14 +173,14 @@ END_FUNC(PRIV) /* end H5FA_create() */ /*------------------------------------------------------------------------- - * Function: H5FA_open + * Function: H5FA_open * - * Purpose: Opens an existing fixed array in the file. + * Purpose: Opens an existing fixed array in the file. * - * Return: Pointer to array wrapper on success + * Return: Pointer to array wrapper on success * NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -241,13 +241,13 @@ END_FUNC(PRIV) /* end H5FA_open() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_nelmts + * Function: H5FA_get_nelmts * - * Purpose: Query the current number of elements in array + * Purpose: Query the current number of elements in array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -275,13 +275,13 @@ END_FUNC(PRIV) /* end H5FA_get_nelmts() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_addr + * Function: H5FA_get_addr * - * Purpose: Query the address of the array + * Purpose: Query the address of the array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -310,13 +310,13 @@ END_FUNC(PRIV) /* end H5FA_get_addr() */ /*------------------------------------------------------------------------- - * Function: H5FA_set + * Function: H5FA_set * - * Purpose: Set an element of a fixed array + * Purpose: Set an element of a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -362,13 +362,13 @@ HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx /* Protect data block */ if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, hdr->dblk_addr, hdr->stats.nelmts, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)hdr->dblk_addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", (unsigned long long)hdr->dblk_addr) /* Check for paging data block */ if(!dblock->npages) { - /* Set element in data block */ - HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); - dblock_cache_flags |= H5AC__DIRTIED_FLAG; + /* Set element in data block */ + HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { /* paging */ size_t page_idx; /* Index of page within data block */ @@ -381,33 +381,33 @@ HDfprintf(stderr, "%s: fixed array data block address not defined!\n", FUNC, idx elmt_idx = (size_t)(idx % dblock->dblk_page_nelmts); /* Get the address of the data block page */ - dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + + dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + ((hsize_t)page_idx * dblock->dblk_page_size); /* Check for using last page, to set the number of elements on the page */ - if((page_idx + 1) == dblock->npages) - dblk_page_nelmts = dblock->last_page_nelmts; - else - dblk_page_nelmts = dblock->dblk_page_nelmts; + if((page_idx + 1) == dblock->npages) + dblk_page_nelmts = dblock->last_page_nelmts; + else + dblk_page_nelmts = dblock->dblk_page_nelmts; /* Check if the page has been created yet */ if(!H5V_bit_get(dblock->dblk_page_init, page_idx)) { - /* Create the data block page */ - if(H5FA__dblk_page_create(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts) < 0) - H5E_THROW(H5E_CANTCREATE, "unable to create data block page") + /* Create the data block page */ + if(H5FA__dblk_page_create(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts) < 0) + H5E_THROW(H5E_CANTCREATE, "unable to create data block page") - /* Mark data block page as initialized in data block */ - H5V_bit_set(dblock->dblk_page_init, page_idx, TRUE); - dblock_cache_flags |= H5AC__DIRTIED_FLAG; - } /* end if */ + /* Mark data block page as initialized in data block */ + H5V_bit_set(dblock->dblk_page_init, page_idx, TRUE); + dblock_cache_flags |= H5AC__DIRTIED_FLAG; + } /* end if */ /* Protect the data block page */ - if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts, H5AC_WRITE))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) + if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts, H5AC_WRITE))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Set the element in the data block page */ - HDmemcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); - dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; + HDmemcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); + dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; } /* end else */ CATCH @@ -426,13 +426,13 @@ END_FUNC(PRIV) /* end H5FA_set() */ /*------------------------------------------------------------------------- - * Function: H5FA_get + * Function: H5FA_get * - * Purpose: Get an element of a fixed array + * Purpose: Get an element of a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -528,13 +528,13 @@ END_FUNC(PRIV) /* end H5FA_get() */ /*------------------------------------------------------------------------- - * Function: H5FA_close + * Function: H5FA_close * - * Purpose: Close a fixed array + * Purpose: Close a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -629,13 +629,13 @@ END_FUNC(PRIV) /* end H5FA_close() */ /*------------------------------------------------------------------------- - * Function: H5FA_delete + * Function: H5FA_delete * - * Purpose: Delete a fixed array + * Purpose: Delete a fixed array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -683,16 +683,16 @@ END_FUNC(PRIV) /* end H5FA_delete() */ /*------------------------------------------------------------------------- - * Function: H5FA_iterate + * Function: H5FA_iterate * - * Purpose: Iterate over the elements of a fixed array + * Purpose: Iterate over the elements of a fixed array * - * Note: This is not very efficient, we should be iterating directly - * over the fixed array's direct block [pages]. + * Note: This is not very efficient, we should be iterating directly + * over the fixed array's direct block [pages]. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -702,8 +702,8 @@ herr_t, SUCCEED, FAIL, H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata)) /* Local variables */ - uint8_t *elmt = NULL; - hsize_t u; + uint8_t *elmt = NULL; + hsize_t u; /* * Check arguments. @@ -714,7 +714,7 @@ H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata)) /* Allocate space for a native array element */ if(NULL == (elmt = H5FL_BLK_MALLOC(native_elmt, fa->hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") /* Iterate over all elements in array */ for(u = 0; u < fa->hdr->stats.nelmts; u++) { @@ -734,7 +734,7 @@ H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata)) CATCH if(elmt) - elmt = H5FL_BLK_FREE(native_elmt, elmt); + elmt = H5FL_BLK_FREE(native_elmt, elmt); END_FUNC(PRIV) /* end H5FA_iterate() */ @@ -748,7 +748,6 @@ END_FUNC(PRIV) /* end H5FA_iterate() */ * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2012 * *------------------------------------------------------------------------- @@ -773,7 +772,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Set the shared array header's file context for this operation */ hdr->f = fa->f; - /* Set up flush dependency between parent entry and extensible array header */ + /* Set up flush dependency between parent entry and fixed array header */ if(H5FA__create_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on file metadata") @@ -791,7 +790,6 @@ END_FUNC(PRIV) /* end H5FA_depend() */ * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2012 * *------------------------------------------------------------------------- @@ -816,7 +814,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Set the shared array header's file context for this operation */ hdr->f = fa->f; - /* Remove flush dependency between parent entry and extensible array header */ + /* Remove flush dependency between parent entry and fixed array header */ if(H5FA__destroy_flush_depend(parent_entry, (H5AC_info_t *)hdr) < 0) H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on file metadata") diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 5c567a2..9bcdd70 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAcache.c + * Created: H5FAcache.c * - * Purpose: Implement fixed array metadata cache methods. + * Purpose: Implement fixed array metadata cache methods. * *------------------------------------------------------------------------- */ @@ -37,12 +37,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ @@ -145,14 +145,14 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{ /*------------------------------------------------------------------------- - * Function: H5FA__cache_hdr_load + * Function: H5FA__cache_hdr_load * - * Purpose: Loads a fixed array header from the disk. + * Purpose: Loads a fixed array header from the disk. * - * Return: Success: Pointer to a new fixed array - * Failure: NULL + * Return: Success: Pointer to a new fixed array + * Failure: NULL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -162,13 +162,13 @@ H5FA_hdr_t *, NULL, NULL, H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)) /* Local variables */ - H5FA_cls_id_t id; /* ID of fixed array class, as found in file */ - H5FA_hdr_t *hdr = NULL; /* Fixed array info */ - size_t size; /* Header size */ + H5FA_cls_id_t id; /* ID of fixed array class, as found in file */ + H5FA_hdr_t *hdr = NULL; /* Fixed array info */ + size_t size; /* Header size */ H5WB_t *wb = NULL; /* Wrapped buffer for header data */ uint8_t hdr_buf[H5FA_HDR_BUF_SIZE]; /* Buffer for header */ - uint8_t *buf; /* Pointer to header buffer */ - const uint8_t *p; /* Pointer into raw data buffer */ + uint8_t *buf; /* Pointer to header buffer */ + 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 */ @@ -178,73 +178,74 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)) /* Allocate space for the fixed array data structure */ if(NULL == (hdr = H5FA__hdr_alloc(f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header") /* Set the fixed array header's address */ hdr->addr = addr; /* Wrap the local buffer for serialized info */ if(NULL == (wb = H5WB_wrap(hdr_buf, sizeof(hdr_buf)))) - H5E_THROW(H5E_CANTINIT, "can't wrap buffer") + H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the 'base' size of the fixed array header on disk */ size = H5FA_HEADER_SIZE(hdr); /* Get a pointer to a buffer that's large enough for serialized header */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) - H5E_THROW(H5E_CANTGET, "can't get actual buffer") + H5E_THROW(H5E_CANTGET, "can't get actual buffer") /* Read header from disk */ if(H5F_block_read(f, H5FD_MEM_FARRAY_HDR, addr, size, dxpl_id, buf) < 0) - H5E_THROW(H5E_READERROR, "can't read fixed array header") + H5E_THROW(H5E_READERROR, "can't read fixed array header") /* Get temporary pointer to serialized header */ p = buf; /* Magic number */ if(HDmemcmp(p, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") + H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5FA_HDR_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array header version") + H5E_THROW(H5E_VERSION, "wrong fixed array header version") /* Fixed array class */ id = (H5FA_cls_id_t)*p++; if(id >= H5FA_NUM_CLS_ID) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") hdr->cparam.cls = H5FA_client_class_g[id]; /* General array creation/configuration information */ - hdr->cparam.raw_elmt_size = *p++; /* Element size in file (in bytes) */ - hdr->cparam.max_dblk_page_nelmts_bits = *p++; /* Log2(Max. # of elements in data block page) - - i.e. # of bits needed to store max. # of - elements in data block page. */ + hdr->cparam.raw_elmt_size = *p++; /* Element size in file (in bytes) */ + hdr->cparam.max_dblk_page_nelmts_bits = *p++; /* Log2(Max. # of elements in data block page) - + * i.e. # of bits needed to store max. # of + * elements in data block page. + */ /* Array statistics */ - H5F_DECODE_LENGTH(f, p, hdr->cparam.nelmts); /* Number of elements */ + H5F_DECODE_LENGTH(f, p, hdr->cparam.nelmts); /* Number of elements */ /* Internal information */ - H5F_addr_decode(f, &p, &hdr->dblk_addr); /* Address of index block */ + H5F_addr_decode(f, &p, &hdr->dblk_addr); /* Address of index block */ /* Check for data block */ if(H5F_addr_defined(hdr->dblk_addr)) { - H5FA_dblock_t dblock; /* Fake data block for computing size */ - size_t dblk_page_nelmts; /* # of elements per data block page */ - - /* Set up fake data block for computing size on disk */ - dblock.hdr = hdr; - dblock.dblk_page_init_size = 0; - dblock.npages = 0; - dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; - if(hdr->cparam.nelmts > dblk_page_nelmts) { - dblock.npages = (size_t)(((hdr->cparam.nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - dblock.dblk_page_init_size = (dblock.npages + 7) / 8; - } /* end if */ + H5FA_dblock_t dblock; /* Fake data block for computing size */ + size_t dblk_page_nelmts; /* # of elements per data block page */ + + /* Set up fake data block for computing size on disk */ + dblock.hdr = hdr; + dblock.dblk_page_init_size = 0; + dblock.npages = 0; + dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; + if(hdr->cparam.nelmts > dblk_page_nelmts) { + dblock.npages = (size_t)(((hdr->cparam.nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + dblock.dblk_page_init_size = (dblock.npages + 7) / 8; + } /* end if */ /* Compute Fixed Array data block size for hdr statistics */ - hdr->stats.dblk_size = (size_t)H5FA_DBLOCK_SIZE(&dblock); + hdr->stats.dblk_size = (size_t)H5FA_DBLOCK_SIZE(&dblock); } /* end if */ /* Sanity check */ @@ -263,11 +264,11 @@ H5FA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)) /* Verify checksum */ if(stored_chksum != computed_chksum) - H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for fixed array header") + H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for fixed array header") /* Finish initializing fixed array header */ if(H5FA__hdr_init(hdr, udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") + H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") HDassert(hdr->size == size); /* Set return value */ @@ -277,7 +278,7 @@ CATCH /* Release resources */ if(wb && H5WB_unwrap(wb) < 0) - H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") if(!ret_value) if(hdr && H5FA__hdr_dest(hdr) < 0) H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header") @@ -286,13 +287,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_load() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_hdr_flush + * Function: H5FA__cache_hdr_flush * - * Purpose: Flushes a dirty fixed array header to disk. + * Purpose: Flushes a dirty fixed array header to disk. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -356,12 +357,12 @@ H5FA__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); - /* Write the array header. */ + /* Write the array header. */ HDassert((size_t)(p - buf) == size); - if(H5F_block_write(f, H5FD_MEM_FARRAY_HDR, addr, size, dxpl_id, buf) < 0) + if(H5F_block_write(f, H5FD_MEM_FARRAY_HDR, addr, size, dxpl_id, buf) < 0) H5E_THROW(H5E_WRITEERROR, "unable to save fixed array header to disk") - hdr->cache_info.is_dirty = FALSE; + hdr->cache_info.is_dirty = FALSE; } /* end if */ if(destroy) @@ -372,19 +373,19 @@ CATCH /* Release resources */ if(wb && H5WB_unwrap(wb) < 0) - H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") END_FUNC(STATIC) /* end H5FA__cache_hdr_flush() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_hdr_dest + * Function: H5FA__cache_hdr_dest * - * Purpose: Destroys a fixed array header in memory. + * Purpose: Destroys a fixed array header in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -425,13 +426,13 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_dest() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_hdr_clear + * Function: H5FA__cache_hdr_clear * - * Purpose: Mark a fixed array header in memory as non-dirty. + * Purpose: Mark a fixed array header in memory as non-dirty. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -456,15 +457,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_clear() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_hdr_size + * Function: H5FA__cache_hdr_size * - * Purpose: Compute the size in bytes of a fixed array header - * on disk, and return it in *size_ptr. On failure, - * the value of *size_ptr is undefined. + * Purpose: Compute the size in bytes of a fixed array header + * on disk, and return it in *size_ptr. On failure, + * the value of *size_ptr is undefined. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -487,14 +488,14 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_size() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblock_load + * Function: H5FA__cache_dblock_load * - * Purpose: Loads a fixed array data block from the disk. + * Purpose: Loads a fixed array data block from the disk. * - * Return: Success: Pointer to a new fixed array data block - * Failure: NULL + * Return: Success: Pointer to a new fixed array data block + * Failure: NULL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -522,14 +523,14 @@ H5FA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) /* Allocate the fixed array data block */ if(NULL == (dblock = H5FA__dblock_alloc(udata->hdr, udata->nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") /* Set the fixed array data block's information */ dblock->addr = addr; /* Wrap the local buffer for serialized info */ if(NULL == (wb = H5WB_wrap(dblock_buf, sizeof(dblock_buf)))) - H5E_THROW(H5E_CANTINIT, "can't wrap buffer") + H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the size of the fixed array data block on disk */ if(!dblock->npages) @@ -539,36 +540,36 @@ H5FA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) /* Get a pointer to a buffer that's large enough for serialized info */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) - H5E_THROW(H5E_CANTGET, "can't get actual buffer") + H5E_THROW(H5E_CANTGET, "can't get actual buffer") /* Read data block from disk */ if(H5F_block_read(f, H5FD_MEM_FARRAY_DBLOCK, addr, size, dxpl_id, buf) < 0) - H5E_THROW(H5E_READERROR, "can't read fixed array data block") + H5E_THROW(H5E_READERROR, "can't read fixed array data block") /* Get temporary pointer to serialized header */ p = buf; /* Magic number */ if(HDmemcmp(p, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") + H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5FA_DBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array data block version") + H5E_THROW(H5E_VERSION, "wrong fixed array data block version") /* Fixed array type */ if(*p++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(f, &p, &arr_addr); if(H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header address") + H5E_THROW(H5E_BADVALUE, "wrong fixed array header address") /* Page initialization flags */ if(dblock->npages > 0) { - HDmemcpy(dblock->dblk_page_init, p, dblock->dblk_page_init_size); + HDmemcpy(dblock->dblk_page_init, p, dblock->dblk_page_init_size); p += dblock->dblk_page_init_size; } /* end if */ @@ -599,7 +600,7 @@ H5FA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) /* Verify checksum */ if(stored_chksum != computed_chksum) - H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for fixed array data block") + H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for fixed array data block") /* Set return value */ ret_value = dblock; @@ -608,7 +609,7 @@ CATCH /* Release resources */ if(wb && H5WB_unwrap(wb) < 0) - H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") if(!ret_value) if(dblock && H5FA__dblock_dest(dblock) < 0) H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") @@ -617,13 +618,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_load() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblock_flush + * Function: H5FA__cache_dblock_flush * - * Purpose: Flushes a dirty fixed array data block to disk. + * Purpose: Flushes a dirty fixed array data block to disk. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -680,11 +681,11 @@ H5FA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F_addr_encode(f, &p, dblock->hdr->addr); /* Page init flags */ - if(dblock->npages > 0) { - /* Store the 'page init' bitmasks */ + if(dblock->npages > 0) { + /* Store the 'page init' bitmasks */ HDmemcpy(p, dblock->dblk_page_init, dblock->dblk_page_init_size); p += dblock->dblk_page_init_size; - } /* end if */ + } /* end if */ /* Only encode elements if the data block is not paged */ if(!dblock->npages) { @@ -703,12 +704,12 @@ H5FA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); - /* Write the data block */ + /* Write the data block */ HDassert((size_t)(p - buf) == size); - if(H5F_block_write(f, H5FD_MEM_FARRAY_DBLOCK, addr, size, dxpl_id, buf) < 0) + if(H5F_block_write(f, H5FD_MEM_FARRAY_DBLOCK, addr, size, dxpl_id, buf) < 0) H5E_THROW(H5E_WRITEERROR, "unable to save fixed array data block to disk") - dblock->cache_info.is_dirty = FALSE; + dblock->cache_info.is_dirty = FALSE; } /* end if */ if(destroy) @@ -719,19 +720,19 @@ CATCH /* Release resources */ if(wb && H5WB_unwrap(wb) < 0) - H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") END_FUNC(STATIC) /* end H5FA__cache_dblock_flush() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblock_dest + * Function: H5FA__cache_dblock_dest * - * Purpose: Destroys a fixed array data block in memory. + * Purpose: Destroys a fixed array data block in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -773,13 +774,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_dest() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblock_clear + * Function: H5FA__cache_dblock_clear * - * Purpose: Mark a fixed array data block in memory as non-dirty. + * Purpose: Mark a fixed array data block in memory as non-dirty. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -811,7 +812,6 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_clear() */ * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2012 * *------------------------------------------------------------------------- @@ -854,15 +854,14 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblock_size + * Function: H5FA__cache_dblock_size * - * Purpose: Compute the size in bytes of a fixed array data block - * on disk, and return it in *size_ptr. On failure, - * the value of *size_ptr is undefined. + * Purpose: Compute the size in bytes of a fixed array data block + * on disk, and return it in *size_ptr. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED (Can't fail) * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -888,14 +887,14 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_size() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblk_page_load + * Function: H5FA__cache_dblk_page_load * - * Purpose: Loads a fixed array data block page from the disk. + * Purpose: Loads a fixed array data block page from the disk. * - * Return: Success: Pointer to a new fixed array data block page - * Failure: NULL + * Return: Success: Pointer to a new fixed array data block page + * Failure: NULL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -905,13 +904,13 @@ H5FA_dblk_page_t *, NULL, NULL, H5FA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata)) /* Local variables */ - H5FA_dblk_page_t *dblk_page = NULL; /* Data block page info */ + H5FA_dblk_page_t *dblk_page = NULL; /* Data block page info */ H5FA_dblk_page_cache_ud_t *udata = (H5FA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ - size_t size; /* Data block page size */ + size_t size; /* Data block page size */ H5WB_t *wb = NULL; /* Wrapped buffer for data block page data */ uint8_t dblk_page_buf[H5FA_DBLK_PAGE_BUF_SIZE]; /* Buffer for data block page */ - uint8_t *buf; /* Pointer to data block page buffer */ - const uint8_t *p; /* Pointer into raw data buffer */ + uint8_t *buf; /* Pointer to data block page buffer */ + 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 */ @@ -925,25 +924,25 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); /* Allocate the fixed array data block page */ if(NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") /* Set the fixed array data block's information */ dblk_page->addr = addr; /* Wrap the local buffer for serialized info */ if(NULL == (wb = H5WB_wrap(dblk_page_buf, sizeof(dblk_page_buf)))) - H5E_THROW(H5E_CANTINIT, "can't wrap buffer") + H5E_THROW(H5E_CANTINIT, "can't wrap buffer") /* Compute the size of the fixed array data block page on disk */ size = H5FA_DBLK_PAGE_SIZE(dblk_page, udata->nelmts); /* Get a pointer to a buffer that's large enough for serialized info */ if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size))) - H5E_THROW(H5E_CANTGET, "can't get actual buffer") + H5E_THROW(H5E_CANTGET, "can't get actual buffer") /* Read data block page from disk */ if(H5F_block_read(f, H5FD_MEM_FARRAY_DBLK_PAGE, addr, size, dxpl_id, buf) < 0) - H5E_THROW(H5E_READERROR, "can't read fixed array data block page") + H5E_THROW(H5E_READERROR, "can't read fixed array data block page") /* Get temporary pointer to serialized header */ p = buf; @@ -974,7 +973,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); /* Verify checksum */ if(stored_chksum != computed_chksum) - H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for fixed array data block page") + H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for fixed array data block page") /* Set return value */ ret_value = dblk_page; @@ -983,7 +982,7 @@ CATCH /* Release resources */ if(wb && H5WB_unwrap(wb) < 0) - H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") if(!ret_value) if(dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") @@ -992,13 +991,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_load() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblk_page_flush + * Function: H5FA__cache_dblk_page_flush * - * Purpose: Flushes a dirty fixed array data block page to disk. + * Purpose: Flushes a dirty fixed array data block page to disk. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -1053,12 +1052,12 @@ H5FA__cache_dblk_page_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t ad /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); - /* Write the data block */ + /* Write the data block */ HDassert((size_t)(p - buf) == size); - if(H5F_block_write(f, H5FD_MEM_FARRAY_DBLK_PAGE, addr, size, dxpl_id, buf) < 0) + if(H5F_block_write(f, H5FD_MEM_FARRAY_DBLK_PAGE, addr, size, dxpl_id, buf) < 0) H5E_THROW(H5E_WRITEERROR, "unable to save fixed array data block page to disk") - dblk_page->cache_info.is_dirty = FALSE; + dblk_page->cache_info.is_dirty = FALSE; } /* end if */ if(destroy) @@ -1069,22 +1068,22 @@ CATCH /* Release resources */ if(wb && H5WB_unwrap(wb) < 0) - H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") + H5E_THROW(H5E_CLOSEERROR, "can't close wrapped buffer") END_FUNC(STATIC) /* end H5FA__cache_dblk_page_flush() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblk_page_dest + * Function: H5FA__cache_dblk_page_dest * - * Purpose: Destroys a fixed array data block page in memory. + * Purpose: Destroys a fixed array data block page in memory. * - * Note: Does _not_ free the space for the page on disk, that is + * Note: Does _not_ free the space for the page on disk, that is * handled through the data block that "owns" the page. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -1111,13 +1110,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_dest() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblk_page_clear + * Function: H5FA__cache_dblk_page_clear * - * Purpose: Mark a fixed array data block page in memory as non-dirty. + * Purpose: Mark a fixed array data block page in memory as non-dirty. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -1142,15 +1141,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_clear() */ /*------------------------------------------------------------------------- - * Function: H5FA__cache_dblk_page_size + * Function: H5FA__cache_dblk_page_size * - * Purpose: Compute the size in bytes of a fixed array data block page - * on disk, and return it in *size_ptr. On failure, - * the value of *size_ptr is undefined. + * Purpose: Compute the size in bytes of a fixed array data block page + * on disk, and return it in *size_ptr. On failure, + * the value of *size_ptr is undefined. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED (Can't fail) * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 9bb90af..4995007 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAdbg.c + * Created: H5FAdbg.c * - * Purpose: Dump debugging information about a fixed array. + * Purpose: Dump debugging information about a fixed array. * *------------------------------------------------------------------------- */ @@ -37,11 +37,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5Oprivate.h" /* Object Header */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5Oprivate.h" /* Object Header */ +#include "H5Vprivate.h" /* Vector functions */ /****************/ @@ -80,13 +80,13 @@ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_debug + * Function: H5FA__hdr_debug * - * Purpose: Prints debugging info about a fixed array header. + * Purpose: Prints debugging info about a fixed array header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -97,8 +97,8 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr)) /* Local variables */ - H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ - void *dbg_ctx = NULL; /* Fixed array debugging context */ + H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ + void *dbg_ctx = NULL; /* Fixed array debugging context */ /* Check arguments */ HDassert(f); @@ -113,58 +113,58 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, if(cls->crt_dbg_ctx) { /* Create debugging context */ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") } /* end if */ /* Load the fixed array header */ if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, addr, dbg_ctx, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Print opening message */ HDfprintf(stream, "%*sFixed Array Header...\n", indent, ""); /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Header size:", - hdr->size); + "Header size:", + hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", - (unsigned)hdr->cparam.raw_elmt_size); + "Raw Element Size:", + (unsigned)hdr->cparam.raw_elmt_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", - hdr->cparam.cls->nat_elmt_size); + "Native Element Size (on this platform):", + hdr->cparam.cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max. # of elements in data block page:", - (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); + "Max. # of elements in data block page:", + (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Fixed Array:", hdr->stats.nelmts); + "Number of elements in Fixed Array:", hdr->stats.nelmts); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Fixed Array Data Block Address:", hdr->dblk_addr); + "Fixed Array Data Block Address:", hdr->dblk_addr); CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__hdr_debug() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_debug + * Function: H5FA__dblock_debug * - * Purpose: Prints debugging info about a fixed array data block. + * Purpose: Prints debugging info about a fixed array data block. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -177,7 +177,7 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Local variables */ H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ - void *dbg_ctx = NULL; /* Fixed array context */ + void *dbg_ctx = NULL; /* Fixed array context */ size_t u; /* Local index variable */ /* Check arguments */ @@ -194,12 +194,12 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde if(cls->crt_dbg_ctx) { /* Create debugging context */ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") } /* end if */ /* Load the fixed array header */ if(NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Protect data block */ if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, addr, hdr->cparam.nelmts, H5AC_READ))) @@ -210,78 +210,76 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Data Block:", hdr->cparam.nelmts); + "Number of elements in Data Block:", hdr->cparam.nelmts); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of pages in Data Block:", dblock->npages); + "Number of pages in Data Block:", dblock->npages); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements per Data Block page:", dblock->dblk_page_nelmts); + "Number of elements per Data Block page:", dblock->dblk_page_nelmts); if(dblock->npages) { /* paging */ - size_t dblk_page_nelmts; /* # of elements in a data block page */ + size_t dblk_page_nelmts; /* # of elements in a data block page */ haddr_t dblk_page_addr; /* Address of a data block page */ size_t page_idx; /* Page index within data block */ - HDfprintf(stream, "%*sPaging:\n", indent, ""); + HDfprintf(stream, "%*sPaging:\n", indent, ""); - /* Iterate over the pages */ - dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); - dblk_page_nelmts = dblock->dblk_page_nelmts; + /* Iterate over the pages */ + dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); + dblk_page_nelmts = dblock->dblk_page_nelmts; - /* Read and print each page's elements in the data block */ - for(page_idx = 0; page_idx < dblock->npages; page_idx++) { - if(!H5V_bit_get(dblock->dblk_page_init, page_idx)) { - HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, - "Page %Zu:", page_idx, "empty"); + /* Read and print each page's elements in the data block */ + for(page_idx = 0; page_idx < dblock->npages; page_idx++) { + if(!H5V_bit_get(dblock->dblk_page_init, page_idx)) { + HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, + "Page %Zu:", page_idx, "empty"); - } /* end if */ + } /* end if */ else { /* get the page */ H5FA_dblk_page_t *dblk_page; /* Pointer to a data block page */ - hsize_t nelmts_left; /* Remaining elements in the last data block page */ + hsize_t nelmts_left; /* Remaining elements in the last data block page */ /* Check for last page */ - if(((page_idx + 1) == dblock->npages) && (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) - dblk_page_nelmts = (size_t)nelmts_left; - - if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts, H5AC_READ))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) - - HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); - for(u = 0; u < dblk_page_nelmts; u++) { - /* Call the class's 'debug' callback */ - if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ - if(H5FA__dblk_page_unprotect(dblk_page, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") - - /* Advance to next page address */ - dblk_page_addr += dblock->dblk_page_size; - } /* paging */ - } /* end for npages */ + if(((page_idx + 1) == dblock->npages) && (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) + dblk_page_nelmts = (size_t)nelmts_left; + + if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts, H5AC_READ))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) + + HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); + for(u = 0; u < dblk_page_nelmts; u++) { + /* Call the class's 'debug' callback */ + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + if(H5FA__dblk_page_unprotect(dblk_page, dxpl_id, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + + /* Advance to next page address */ + dblk_page_addr += dblock->dblk_page_size; + } /* paging */ + } /* end for npages */ } /* end if */ else { /* not paging */ - /* Print the elements in the data block */ - HDfprintf(stream, "%*sElements:\n", indent, ""); - for(u = 0; u < hdr->cparam.nelmts; u++) { - /* Call the class's 'debug' callback */ - if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ + /* Print the elements in the data block */ + HDfprintf(stream, "%*sElements:\n", indent, ""); + for(u = 0; u < hdr->cparam.nelmts; u++) { + /* Call the class's 'debug' callback */ + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ } /* end else */ CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") if(dblock && H5FA__dblock_unprotect(dblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_FARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__dblock_debug() */ diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index b5ef82c..4184ee5 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAdblkpage.c + * Created: H5FAdblkpage.c * - * Purpose: Data block page routines for fixed array. + * Purpose: Data block page routines for fixed array. * *------------------------------------------------------------------------- */ @@ -37,10 +37,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5FLprivate.h" /* Free Lists */ /****************/ @@ -86,13 +86,13 @@ H5FL_BLK_DEFINE(page_elmts); /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_alloc + * Function: H5FA__dblk_page_alloc * - * Purpose: Allocate fixed array data block page + * Purpose: Allocate fixed array data block page * - * Return: Non-NULL pointer to data block on success/NULL on failure + * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -109,11 +109,11 @@ H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts)) /* Allocate memory for the data block */ if(NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") /* Share common array information */ if(H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") dblk_page->hdr = hdr; /* Set non-zero internal fields */ @@ -136,13 +136,13 @@ END_FUNC(PKG) /* end H5FA__dblk_page_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_create + * Function: H5FA__dblk_page_create * - * Purpose: Creates a new fixed array data block page in the file + * Purpose: Creates a new fixed array data block page in the file * - * Return: Valid file address on success/HADDR_UNDEF on failure + * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -163,7 +163,7 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); /* Allocate the data block page */ if(NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") /* Set info about data block page on disk */ dblk_page->addr = addr; @@ -178,7 +178,7 @@ HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); /* Cache the new fixed array data block page */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache") + H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache") CATCH if(ret_value < 0) @@ -192,14 +192,14 @@ END_FUNC(PKG) /* end H5FA__dblk_page_create() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_protect + * Function: H5FA__dblk_page_protect * - * Purpose: Convenience wrapper around protecting fixed array data + * Purpose: Convenience wrapper around protecting fixed array data * block page * - * Return: Non-NULL pointer to data block page on success/NULL on failure + * Return: Non-NULL pointer to data block page on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -234,14 +234,14 @@ END_FUNC(PKG) /* end H5FA__dblk_page_protect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_unprotect + * Function: H5FA__dblk_page_unprotect * - * Purpose: Convenience wrapper around unprotecting fixed array + * Purpose: Convenience wrapper around unprotecting fixed array * data block page * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -270,13 +270,13 @@ END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblk_page_dest + * Function: H5FA__dblk_page_dest * - * Purpose: Destroys a fixed array data block page in memory. + * Purpose: Destroys a fixed array data block page in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -293,7 +293,7 @@ H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page)) /* Check if buffer for data block page elements has been initialized */ if(dblk_page->elmts) { /* Free buffer for data block page elements */ - dblk_page->elmts = H5FL_BLK_FREE(page_elmts, dblk_page->elmts); + dblk_page->elmts = H5FL_BLK_FREE(page_elmts, dblk_page->elmts); } /* end if */ /* Decrement reference count on shared info */ diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c index 80e2159..ea24d27 100644 --- a/src/H5FAdblock.c +++ b/src/H5FAdblock.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAdblock.c + * Created: H5FAdblock.c * - * Purpose: Data block routines for fixed arrays. + * Purpose: Data block routines for fixed arrays. * *------------------------------------------------------------------------- */ @@ -37,11 +37,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -89,13 +89,13 @@ H5FL_BLK_DEFINE(fa_page_init); /*------------------------------------------------------------------------- - * Function: H5FA__dblock_alloc + * Function: H5FA__dblock_alloc * - * Purpose: Allocate fixed array data block + * Purpose: Allocate fixed array data block * - * Return: Non-NULL pointer to data block on success/NULL on failure + * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -113,11 +113,11 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr, hsize_t nelmts)) /* Allocate memory for the data block */ if(NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") /* Share common array information */ if(H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") dblock->hdr = hdr; /* Set non-zero internal fields */ @@ -131,19 +131,19 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr, hsize_t nelmts)) /* Safely assign the number of pages */ H5_ASSIGN_OVERFLOW(/* To: */ dblock->npages, /* From: */ npages, /* From: */ hsize_t, /* To: */ size_t); - /* Sanity check that we have at least 1 page */ - HDassert(dblock->npages > 0); + /* Sanity check that we have at least 1 page */ + HDassert(dblock->npages > 0); /* Compute size of 'page init' flag array, in bytes */ - dblock->dblk_page_init_size = (dblock->npages + 7) / 8; - HDassert(dblock->dblk_page_init_size > 0); + dblock->dblk_page_init_size = (dblock->npages + 7) / 8; + HDassert(dblock->dblk_page_init_size > 0); - /* Allocate space for 'page init' flags */ - if(NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask") + /* Allocate space for 'page init' flags */ + if(NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask") - /* Compute data block page size */ - dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; + /* Compute data block page size */ + dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; /* Compute the # of elements on last page */ if(0 == nelmts % dblock->dblk_page_nelmts) @@ -156,8 +156,8 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr, hsize_t nelmts)) /* Allocate buffer for elements in data block */ H5_CHECK_OVERFLOW(dblk_size, /* From: */hsize_t, /* To: */size_t); - if(NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") + if(NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") } /* end else */ /* Set the return value */ @@ -173,13 +173,13 @@ END_FUNC(PKG) /* end H5FA__dblock_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_create + * Function: H5FA__dblock_create * - * Purpose: Creates a fixed array data block in the file + * Purpose: Creates a fixed array data block in the file * - * Return: Valid file address on success/HADDR_UNDEF on failure + * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -204,7 +204,7 @@ HDfprintf(stderr, "%s: Called, hdr->stats.nelmts = %Zu, nelmts = %Zu\n", FUNC, h /* Allocate the data block */ if(NULL == (dblock = H5FA__dblock_alloc(hdr, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") /* Set size of data block on disk */ hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock); @@ -215,7 +215,7 @@ HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); /* Allocate space for the data block on disk */ if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dxpl_id, (hsize_t)dblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block") + H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block") dblock->addr = dblock_addr; /* Don't initialize elements if paged */ @@ -226,7 +226,7 @@ HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); /* Cache the new fixed array data block */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache") + H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache") /* Mark the header dirty (for updating statistics) */ *hdr_dirty = TRUE; @@ -251,13 +251,13 @@ END_FUNC(PKG) /* end H5FA__dblock_create() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_protect + * Function: H5FA__dblock_protect * - * Purpose: Convenience wrapper around protecting fixed array data block + * Purpose: Convenience wrapper around protecting fixed array data block * - * Return: Non-NULL pointer to data block on success/NULL on failure + * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -293,13 +293,13 @@ END_FUNC(PKG) /* end H5FA__dblock_protect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_unprotect + * Function: H5FA__dblock_unprotect * - * Purpose: Convenience wrapper around unprotecting fixed array data block + * Purpose: Convenience wrapper around unprotecting fixed array data block * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -327,13 +327,13 @@ END_FUNC(PKG) /* end H5FA__dblock_unprotect() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_delete + * Function: H5FA__dblock_delete * - * Purpose: Delete a data block + * Purpose: Delete a data block * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -395,13 +395,13 @@ END_FUNC(PKG) /* end H5FA__dblock_delete() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_dest + * Function: H5FA__dblock_dest * - * Purpose: Destroys a fixed array data block in memory. + * Purpose: Destroys a fixed array data block in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -419,16 +419,16 @@ H5FA__dblock_dest(H5FA_dblock_t *dblock)) if(dblock->elmts && !dblock->npages) { /* Free buffer for data block elements */ HDassert(dblock->hdr->cparam.nelmts > 0); - dblock->elmts = H5FL_BLK_FREE(chunk_elmts, dblock->elmts); + dblock->elmts = H5FL_BLK_FREE(chunk_elmts, dblock->elmts); } /* end if */ /* Check if data block is paged */ - if(dblock->npages) { - /* Free buffer for 'page init' bitmask, if there is one */ - HDassert(dblock->dblk_page_init_size > 0); - if(dblock->dblk_page_init) - dblock->dblk_page_init = H5FL_BLK_FREE(fa_page_init, dblock->dblk_page_init); - } /* end if */ + if(dblock->npages) { + /* Free buffer for 'page init' bitmask, if there is one */ + HDassert(dblock->dblk_page_init_size > 0); + if(dblock->dblk_page_init) + dblock->dblk_page_init = H5FL_BLK_FREE(fa_page_init, dblock->dblk_page_init); + } /* end if */ /* Decrement reference count on shared info */ if(H5FA__hdr_decr(dblock->hdr) < 0) diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 23a554a..4fc7a90 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAhdr.c + * Created: H5FAhdr.c * - * Purpose: Array header routines for Fixed Array. + * Purpose: Array header routines for Fixed Array. * *------------------------------------------------------------------------- */ @@ -37,10 +37,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5MFprivate.h" /* File memory management */ /****************/ @@ -82,13 +82,13 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t); /*------------------------------------------------------------------------- - * Function: H5FA__hdr_alloc + * Function: H5FA__hdr_alloc * - * Purpose: Allocate shared Fixed Array header + * Purpose: Allocate shared Fixed Array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -105,10 +105,11 @@ H5FA__hdr_alloc(H5F_t *f)) /* Allocate space for the shared information */ if(NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") /* Set non-zero internal fields */ hdr->addr = HADDR_UNDEF; + hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; /* Set the internal parameters for the array */ hdr->f = f; @@ -127,13 +128,13 @@ END_FUNC(PKG) /* end H5FA__hdr_alloc() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_init + * Function: H5FA__hdr_init * - * Purpose: Initialize shared fixed array header + * Purpose: Initialize shared fixed array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, November 15, 2009 * *------------------------------------------------------------------------- @@ -165,13 +166,13 @@ END_FUNC(PKG) /* end H5FA__hdr_init() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_create + * Function: H5FA__hdr_create * - * Purpose: Creates a new Fixed Array header in the file + * Purpose: Creates a new Fixed Array header in the file * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -196,17 +197,17 @@ HDfprintf(stderr, "%s: Called\n", FUNC); { /* Check for valid parameters */ if(cparam->raw_elmt_size == 0) - H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") + H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") if(cparam->max_dblk_page_nelmts_bits == 0) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") + H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") if(cparam->nelmts == 0) - H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero") + H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero") } #endif /* NDEBUG */ /* Allocate space for the shared information */ if(NULL == (hdr = H5FA__hdr_alloc(f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") hdr->dblk_addr = HADDR_UNDEF; @@ -215,15 +216,15 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Finish initializing fixed array header */ if(H5FA__hdr_init(hdr, ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") + H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") /* Allocate space for the header on disk */ if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, dxpl_id, (hsize_t)hdr->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header") + H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header") /* Cache the new Fixed Array header */ if(H5AC_insert_entry(f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache") + H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache") /* Set address of array header to return */ ret_value = hdr->addr; @@ -244,13 +245,13 @@ END_FUNC(PKG) /* end H5FA__hdr_create() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_incr + * Function: H5FA__hdr_incr * - * Purpose: Increment component reference count on shared array header + * Purpose: Increment component reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -276,13 +277,13 @@ END_FUNC(PKG) /* end H5FA__hdr_incr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_decr + * Function: H5FA__hdr_decr * - * Purpose: Decrement component reference count on shared array header + * Purpose: Decrement component reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -311,13 +312,13 @@ END_FUNC(PKG) /* end H5FA__hdr_decr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_fuse_incr + * Function: H5FA__hdr_fuse_incr * - * Purpose: Increment file reference count on shared array header + * Purpose: Increment file reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -336,13 +337,13 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_incr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_fuse_decr + * Function: H5FA__hdr_fuse_decr * - * Purpose: Decrement file reference count on shared array header + * Purpose: Decrement file reference count on shared array header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -365,13 +366,13 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_modified + * Function: H5FA__hdr_modified * - * Purpose: Mark a fixed array as modified + * Purpose: Mark a fixed array as modified * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -393,13 +394,13 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_delete + * Function: H5FA__hdr_delete * - * Purpose: Delete a fixed array, starting with the header + * Purpose: Delete a fixed array, starting with the header * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -453,13 +454,13 @@ END_FUNC(PKG) /* end H5FA__hdr_delete() */ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_dest + * Function: H5FA__hdr_dest * - * Purpose: Destroys a fixed array header in memory. + * Purpose: Destroys a fixed array header in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5FAint.c b/src/H5FAint.c index 6b48207..b42b3ae 100755 --- a/src/H5FAint.c +++ b/src/H5FAint.c @@ -88,7 +88,6 @@ * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2012 * *------------------------------------------------------------------------- @@ -118,7 +117,6 @@ END_FUNC(PKG) /* end H5FA__create_flush_depend() */ * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2012 * *------------------------------------------------------------------------- diff --git a/src/H5FApkg.h b/src/H5FApkg.h index de472a3..25e90cf 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -62,56 +62,56 @@ #define H5FA_SIZEOF_CHKSUM 4 /* "Standard" size of prefix information for fixed array metadata */ -#define H5FA_METADATA_PREFIX_SIZE(c) ( \ - H5_SIZEOF_MAGIC /* Signature */ \ - + 1 /* Version */ \ - + 1 /* Array type */ \ - + ((c) ? H5FA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ +#define H5FA_METADATA_PREFIX_SIZE(c) ( \ + H5_SIZEOF_MAGIC /* Signature */ \ + + 1 /* Version */ \ + + 1 /* Array type */ \ + + ((c) ? H5FA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ ) /* Size of the Fixed Array header on disk */ -#define H5FA_HEADER_SIZE(h) ( \ - /* General metadata fields */ \ - H5FA_METADATA_PREFIX_SIZE(TRUE) \ - \ - /* General array information */ \ - + 1 /* Element Size */ \ - + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ - \ - /* Fixed Array statistics fields */ \ - + (h)->sizeof_size /* # of elements in the fixed array */ \ - \ - /* Fixed Array Header specific fields */ \ - + (h)->sizeof_addr /* File address of Fixed Array data block */ \ +#define H5FA_HEADER_SIZE(h) ( \ + /* General metadata fields */ \ + H5FA_METADATA_PREFIX_SIZE(TRUE) \ + \ + /* General array information */ \ + + 1 /* Element Size */ \ + + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ + \ + /* Fixed Array statistics fields */ \ + + (h)->sizeof_size /* # of elements in the fixed array */ \ + \ + /* Fixed Array Header specific fields */ \ + + (h)->sizeof_addr /* File address of Fixed Array data block */ \ ) /* Size of the Fixed Array data block prefix on disk */ -#define H5FA_DBLOCK_PREFIX_SIZE(d) ( \ - /* General metadata fields */ \ - H5FA_METADATA_PREFIX_SIZE(TRUE) \ - \ - /* Sanity-checking fields */ \ - + (d)->hdr->sizeof_addr /* File address of Fixed Array header owning the data block */ \ - \ - /* Fixed Array Data Block specific fields */ \ +#define H5FA_DBLOCK_PREFIX_SIZE(d) ( \ + /* General metadata fields */ \ + H5FA_METADATA_PREFIX_SIZE(TRUE) \ + \ + /* Sanity-checking fields */ \ + + (d)->hdr->sizeof_addr /* File address of Fixed Array header owning the data block */ \ + \ + /* Fixed Array Data Block specific fields */ \ + (d)->dblk_page_init_size /* Fixed array data block 'page init' bitmasks (can be 0 if no pages) */ \ ) /* Size of the Fixed Array data block on disk */ -#define H5FA_DBLOCK_SIZE(d) ( \ - /* Data block prefix size */ \ - H5FA_DBLOCK_PREFIX_SIZE(d) \ - \ - /* Fixed Array Elements|Pages of Elements*/ \ - + ((d)->hdr->cparam.nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) \ - + ((d)->npages * H5FA_SIZEOF_CHKSUM) /* Checksum */ \ +#define H5FA_DBLOCK_SIZE(d) ( \ + /* Data block prefix size */ \ + H5FA_DBLOCK_PREFIX_SIZE(d) \ + \ + /* Fixed Array Elements|Pages of Elements*/ \ + + ((d)->hdr->cparam.nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) \ + + ((d)->npages * H5FA_SIZEOF_CHKSUM) /* Checksum */ \ ) /* Size of the Fixed Array data block page on disk */ -#define H5FA_DBLK_PAGE_SIZE(d, nelmts) ( \ - /* Fixed Array Data Block Page */ \ - + (nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block page */ \ - + H5FA_SIZEOF_CHKSUM /* Checksum for each page */ \ +#define H5FA_DBLK_PAGE_SIZE(d, nelmts) ( \ + /* Fixed Array Data Block Page */ \ + + (nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block page */ \ + + H5FA_SIZEOF_CHKSUM /* Checksum for each page */ \ ) /****************************/ @@ -133,15 +133,15 @@ typedef struct H5FA_hdr_t { H5FA_stat_t stats; /* Statistcs for Fixed Array */ /* Computed/cached values (not stored in header) */ - size_t rc; /* Reference count of the header */ - haddr_t addr; /* Address of header in file */ - size_t size; /* Size of header in file */ - H5F_t *f; /* Pointer to file for fixed array */ - hbool_t swmr_write; /* Flag indicating the file is opened with SWMR-write access */ - size_t file_rc; /* Reference count of files using array header */ - hbool_t pending_delete; /* Array is pending deletion */ - size_t sizeof_addr; /* Size of file addresses */ - size_t sizeof_size; /* Size of file sizes */ + size_t rc; /* Reference count of the header */ + haddr_t addr; /* Address of header in file */ + size_t size; /* Size of header in file */ + H5F_t *f; /* Pointer to file for fixed array */ + hbool_t swmr_write; /* Flag indicating the file is opened with SWMR-write access */ + size_t file_rc; /* Reference count of files using array header */ + hbool_t pending_delete; /* Array is pending deletion */ + size_t sizeof_addr; /* Size of file addresses */ + size_t sizeof_size; /* Size of file sizes */ /* Client information (not stored) */ void *cb_ctx; /* Callback context */ @@ -153,22 +153,22 @@ typedef struct H5FA_dblock_t { H5AC_info_t cache_info; /* Fixed array information (stored) */ - uint8_t *dblk_page_init;/* Bitmap of whether a data block page is initialized */ - void *elmts; /* Buffer for elements stored in data block */ + uint8_t *dblk_page_init;/* Bitmap of whether a data block page is initialized */ + void *elmts; /* Buffer for elements stored in data block */ /* Internal array information (not stored) */ - H5FA_hdr_t *hdr; /* Shared array header info */ + H5FA_hdr_t *hdr; /* Shared array header info */ /* Computed/cached values (not stored) */ - haddr_t addr; /* Address of this data block on disk */ - hsize_t size; /* Size of data block on disk */ - size_t npages; /* Nummber of pages in data block (zero if not paged) */ - size_t last_page_nelmts; /* Nummber of elements in last page, if paged */ + haddr_t addr; /* Address of this data block on disk */ + hsize_t size; /* Size of data block on disk */ + size_t npages; /* Nummber of pages in data block (zero if not paged) */ + size_t last_page_nelmts; /* Nummber of elements in last page, if paged */ /* Fixed Array data block information (not stored) */ - size_t dblk_page_nelmts; /* # of elements per data block page */ - size_t dblk_page_size; /* Size of a data block page */ - size_t dblk_page_init_size; /* Size of 'page init' bitmask */ + size_t dblk_page_nelmts; /* # of elements per data block page */ + size_t dblk_page_size; /* Size of a data block page */ + size_t dblk_page_init_size; /* Size of 'page init' bitmask */ } H5FA_dblock_t; /* The fixed array data block page information */ @@ -180,18 +180,18 @@ typedef struct H5FA_dbk_page_t { void *elmts; /* Buffer for elements stored in data block page */ /* Internal array information (not stored) */ - H5FA_hdr_t *hdr; /* Shared array header info */ + H5FA_hdr_t *hdr; /* Shared array header info */ /* Computed/cached values (not stored) */ - haddr_t addr; /* Address of this data block page on disk */ - size_t size; /* Size of data block page on disk */ - size_t nelmts; /* Number of elements in data block page */ + haddr_t addr; /* Address of this data block page on disk */ + size_t size; /* Size of data block page on disk */ + size_t nelmts; /* Number of elements in data block page */ } H5FA_dblk_page_t; /* Fixed array */ struct H5FA_t { - H5FA_hdr_t *hdr; /* Pointer to internal fixed array header info */ - H5F_t *f; /* Pointer to file for fixed array */ + H5FA_hdr_t *hdr; /* Pointer to internal fixed array header info */ + H5F_t *f; /* Pointer to file for fixed array */ }; @@ -199,14 +199,14 @@ struct H5FA_t { /* Info needed for loading data block */ typedef struct H5FA_dblock_cache_ud_t { - H5FA_hdr_t *hdr; /* Shared fixed array information */ + H5FA_hdr_t *hdr; /* Shared fixed array information */ hsize_t nelmts; /* Number of elements in data block */ } H5FA_dblock_cache_ud_t; /* Info needed for loading data block page */ typedef struct H5FA_dblk_page_cache_ud_t { - H5FA_hdr_t *hdr; /* Shared fixed array information */ - size_t nelmts; /* Number of elements in data block page */ + H5FA_hdr_t *hdr; /* Shared fixed array information */ + size_t nelmts; /* Number of elements in data block page */ } H5FA_dblk_page_cache_ud_t; diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h index 0270df1..2ce4a1d 100644 --- a/src/H5FAprivate.h +++ b/src/H5FAprivate.h @@ -47,13 +47,13 @@ /* Fixed Array class IDs */ typedef enum H5FA_cls_id_t { - H5FA_CLS_CHUNK_ID = 0, /* Fixed array is for indexing dataset chunks w/o filters */ - H5FA_CLS_FILT_CHUNK_ID, /* Fixed array is for indexing dataset chunks w/filters */ + H5FA_CLS_CHUNK_ID = 0, /* Fixed array is for indexing dataset chunks w/o filters */ + H5FA_CLS_FILT_CHUNK_ID, /* Fixed array is for indexing dataset chunks w/filters */ /* Start real class IDs at 0 -QAK */ /* (keep these last) */ - H5FA_CLS_TEST_ID, /* Fixed array is for testing (do not use for actual data) */ - H5FA_NUM_CLS_ID /* Number of Fixed Array class IDs (must be last) */ + H5FA_CLS_TEST_ID, /* Fixed array is for testing (do not use for actual data) */ + H5FA_NUM_CLS_ID /* Number of Fixed Array class IDs (must be last) */ } H5FA_cls_id_t; /* @@ -61,9 +61,9 @@ typedef enum H5FA_cls_id_t { * variable of this type that contains class variables and methods. */ typedef struct H5FA_class_t { - H5FA_cls_id_t id; /* ID of Fixed Array class, as found in file */ - const char *name; /* Name of class (for debugging) */ - size_t nat_elmt_size; /* Size of native (memory) element */ + H5FA_cls_id_t id; /* ID of Fixed Array class, as found in file */ + const char *name; /* Name of class (for debugging) */ + size_t nat_elmt_size; /* Size of native (memory) element */ /* Fixed array client callback methods */ void *(*crt_context)(void *udata); /* Create context for other callbacks */ @@ -78,22 +78,23 @@ typedef struct H5FA_class_t { /* Fixed array creation parameters */ typedef struct H5FA_create_t { - const H5FA_class_t *cls; /* Class of Fixed Array to create */ - uint8_t raw_elmt_size; /* Element size in file (in bytes) */ + const H5FA_class_t *cls; /* Class of Fixed Array to create */ + uint8_t raw_elmt_size; /* Element size in file (in bytes) */ uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in a data block page) - - i.e. # of bits needed to store max. # of elements - in a data block page */ - hsize_t nelmts; /* # of elements in array */ + * i.e. # of bits needed to store max. # of elements + * in a data block page + */ + hsize_t nelmts; /* # of elements in array */ } H5FA_create_t; /* Fixed array metadata statistics info */ typedef struct H5FA_stat_t { /* Non-stored (i.e. computed) fields */ - hsize_t hdr_size; /* Size of header */ - hsize_t dblk_size; /* Size of data block */ + hsize_t hdr_size; /* Size of header */ + hsize_t dblk_size; /* Size of data block */ /* Stored fields */ - hsize_t nelmts; /* # of elements */ + hsize_t nelmts; /* # of elements */ } H5FA_stat_t; /* Fixed Array info (forward decl - defined in H5FApkg.h) */ diff --git a/src/H5FAstat.c b/src/H5FAstat.c index bed6c6e..d6509c3 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAstat.c + * Created: H5FAstat.c * - * Purpose: Fixed array metadata statistics functions. + * Purpose: Fixed array metadata statistics functions. * *------------------------------------------------------------------------- */ @@ -37,9 +37,9 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ /****************/ @@ -79,13 +79,13 @@ /*------------------------------------------------------------------------- - * Function: H5FA_get_stats + * Function: H5FA_get_stats * - * Purpose: Query the metadata stats of an array + * Purpose: Query the metadata stats of an array * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5FAtest.c b/src/H5FAtest.c index 1828fa4..4e4b593 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -14,9 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: - * - * Purpose: Fixed array testing functions. + * Purpose: Fixed array testing functions. * */ @@ -36,11 +34,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FApkg.h" /* Fixed Arrays */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Vprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FApkg.h" /* Fixed Arrays */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Vprivate.h" /* Vector functions */ /****************/ @@ -119,14 +117,14 @@ H5FL_DEFINE_STATIC(H5FA__test_ctx_t); /*------------------------------------------------------------------------- - * Function: H5FA__test_crt_context + * Function: H5FA__test_crt_context * - * Purpose: Create context for callbacks + * Purpose: Create context for callbacks * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -140,7 +138,7 @@ H5FA__test_crt_context(void UNUSED *udata)) /* Allocate new context structure */ if(NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -154,14 +152,13 @@ END_FUNC(STATIC) /* end H5FA__test_crt_context() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_dst_context + * Function: H5FA__test_dst_context * - * Purpose: Destroy context for callbacks + * Purpose: Destroy context for callbacks * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -183,14 +180,13 @@ END_FUNC(STATIC) /* end H5FA__test_dst_context() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_fill + * Function: H5FA__test_fill * - * Purpose: Fill "missing elements" in block of elements + * Purpose: Fill "missing elements" in block of elements * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -212,14 +208,13 @@ END_FUNC(STATIC) /* end H5FA__test_fill() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_encode + * Function: H5FA__test_encode * - * Purpose: Encode an element from "native" to "raw" form + * Purpose: Encode an element from "native" to "raw" form * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -257,14 +252,13 @@ END_FUNC(STATIC) /* end H5FA__test_encode() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_decode + * Function: H5FA__test_decode * - * Purpose: Decode an element from "raw" to "native" form + * Purpose: Decode an element from "raw" to "native" form * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -303,14 +297,13 @@ END_FUNC(STATIC) /* end H5FA__test_decode() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_debug + * Function: H5FA__test_debug * - * Purpose: Display an element for debugging + * Purpose: Display an element for debugging * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -336,14 +329,14 @@ END_FUNC(STATIC) /* end H5FA__test_debug() */ /*------------------------------------------------------------------------- - * Function: H5FA__test_crt_dbg_context + * Function: H5FA__test_crt_dbg_context * - * Purpose: Create context for debugging callback + * Purpose: Create context for debugging callback * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, December 1, 2009 * *------------------------------------------------------------------------- @@ -357,7 +350,7 @@ H5FA__test_crt_dbg_context(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t UNUSED /* Allocate new context structure */ if(NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -371,14 +364,13 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- - * Function: H5FA_get_cparam_test + * Function: H5FA_get_cparam_test * - * Purpose: Retrieve the parameters used to create the fixed array + * Purpose: Retrieve the parameters used to create the fixed array * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -399,14 +391,13 @@ END_FUNC(PRIV) /* end H5FA_get_cparam_test() */ /*------------------------------------------------------------------------- - * Function: H5FA_cmp_cparam_test + * Function: H5FA_cmp_cparam_test * - * Purpose: Compare the parameters used to create the fixed array + * Purpose: Compare the parameters used to create the fixed array * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- diff --git a/src/H5FS.c b/src/H5FS.c index 7c09beb..dde203f 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * - * Note: (Used to be in the H5HFflist.c file, prior to the date above) + * Note: (Used to be in the H5HFflist.c file, prior to the date above) * */ @@ -27,16 +27,16 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#define H5FS_PACKAGE /* suppress error about including H5FSpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5MFprivate.h" /* File memory management */ /****************/ /* Local Macros */ @@ -85,21 +85,16 @@ H5FL_DEFINE(H5FS_t); /*------------------------------------------------------------------------- - * Function: H5FS_create + * Function: H5FS_create * - * Purpose: Allocate & initialize file free space info + * Purpose: Allocate & initialize file free space info * - * Return: Success: Pointer to free space structure + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Failure: NULL - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * @@ -124,7 +119,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl * Allocate free space structure */ if(NULL == (fspace = H5FS_new(f, nclasses, classes, cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Initialize creation information for free space manager */ fspace->client = fs_create->client; @@ -132,6 +127,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl fspace->expand_percent = fs_create->expand_percent; fspace->max_sect_addr = fs_create->max_sect_addr; fspace->max_sect_size = fs_create->max_sect_size; + fspace->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; fspace->alignment = alignment; fspace->threshold = threshold; @@ -172,31 +168,25 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_open + * Function: H5FS_open * - * Purpose: Open an existing file free space info structure on disk + * Purpose: Open an existing file free space info structure on disk * - * Return: Success: Pointer to free space structure + * Return: Success: Pointer to free space structure + * Failure: NULL * - * Failure: NULL - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 2, 2006 * - * Modfications: - * - * Vailin Choi, July 29th, 2008 - * Add two more parameters for handling alignment: alignment & threshhold - * *------------------------------------------------------------------------- */ H5FS_t * H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { - H5FS_t *fspace = NULL; /* New free space structure */ - H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *fspace = NULL; /* New free space structure */ + H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ + H5FS_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG @@ -247,15 +237,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_delete - * - * Purpose: Delete a free space manager on disk + * Function: H5FS_delete * - * Return: Success: non-negative + * Purpose: Delete a free space manager on disk * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -388,16 +376,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_close + * Function: H5FS_close * - * Purpose: Destroy & deallocate free list structure, serializing sections + * Purpose: Destroy & deallocate free list structure, serializing sections * in the bins * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -451,9 +437,9 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end if */ - else - /* Sanity check that section info has address */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + else + /* Sanity check that section info has address */ + HDassert(H5F_addr_defined(fspace->sect_addr)); /* Cache the free space section info */ if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) @@ -573,14 +559,14 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_va /*------------------------------------------------------------------------- - * Function: H5FS_new + * Function: H5FS_new * - * Purpose: Create new free space manager structure + * Purpose: Create new free space manager structure * - * Return: Success: non-NULL, pointer to new free space manager struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new free space manager struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -602,7 +588,7 @@ H5FS_new(const H5F_t *f, size_t nclasses, const H5FS_section_class_t *classes[], * Allocate free space structure */ if(NULL == (fspace = H5FL_CALLOC(H5FS_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") /* Set immutable free list parameters */ fspace->nclasses = nclasses; @@ -657,8 +643,7 @@ done: * * Purpose: Collect meta storage info used by the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi * June 19, 2007 @@ -689,8 +674,7 @@ H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size) * * Purpose: Increment reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -730,8 +714,7 @@ done: * * Purpose: Decrement reference count on free space header * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * February 7, 2008 @@ -774,15 +757,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_dirty + * Function: H5FS_dirty * - * Purpose: Mark free space header as dirty + * Purpose: Mark free space header as dirty * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Feb 14 2008 + * Programmer: Quincey Koziol + * Feb 14 2008 * *------------------------------------------------------------------------- */ @@ -811,20 +793,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_alloc_hdr() + * Function: H5FS_alloc_hdr() * - * Purpose: Allocate space for the free-space manager header + * Purpose: Allocate space for the free-space manager header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -833,17 +816,17 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) HDassert(fspace); if(!H5F_addr_defined(fspace->addr)) { - /* Allocate space for the free space header */ - if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") + /* Allocate space for the free space header */ + if(HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, dxpl_id, (hsize_t)H5FS_HEADER_SIZE(f)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") - /* Cache the new free space header (pinned) */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") + /* Cache the new free space header (pinned) */ + if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") } /* end if */ if(fs_addr) - *fs_addr = fspace->addr; + *fs_addr = fspace->addr; done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) @@ -851,20 +834,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_alloc_sect() + * Function: H5FS_alloc_sect() * - * Purpose: Allocate space for the free-space manager section info header + * Purpose: Allocate space for the free-space manager section info header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ herr_t H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -873,22 +857,22 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) HDassert(fspace); if(!H5F_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) { - /* Allocate space for section info from aggregator/vfd (or temp. address space) */ + /* Allocate space for section info from aggregator/vfd (or temp. address space) */ /* (The original version called H5MF_alloc(), but that may cause sect_size to change again) */ /* (This routine is only called during file close operations, so don't allocate from temp. address space) */ if(HADDR_UNDEF == (fspace->sect_addr = H5MF_aggr_vfd_alloc(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info") - fspace->alloc_sect_size = fspace->sect_size; + fspace->alloc_sect_size = fspace->sect_size; - /* Mark free-space header as dirty */ - if(H5FS_dirty(fspace) < 0) + /* Mark free-space header as dirty */ + if(H5FS_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") - /* Cache the free-space section info */ - if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") + /* Cache the free-space section info */ + if(H5AC_insert_entry(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") - fspace->sinfo = NULL; + fspace->sinfo = NULL; } /* end if */ done: @@ -897,13 +881,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_free() + * Function: H5FS_free() * - * Purpose: Free space for free-space manager header and section info header + * Purpose: Free space for free-space manager header and section info header * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Feb 2009 + * Programmer: Vailin Choi + * Feb 2009 * *------------------------------------------------------------------------- */ @@ -911,7 +896,7 @@ herr_t H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) { haddr_t saved_addr; /* Previous address of item */ - unsigned cache_flags; /* Flags for unprotecting cache entries */ + unsigned cache_flags; /* Flags for unprotecting cache entries */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -926,11 +911,11 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) hsize_t saved_size; /* Size of previous section info */ unsigned sinfo_status = 0; /* Section info cache status */ - /* Check whether free-space manager section info is in cache or not */ - if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") + /* Check whether free-space manager section info is in cache or not */ + if(H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") - /* Load free-space manager section info */ + /* Load free-space manager section info */ if(sinfo_status & H5AC_ES__IN_CACHE || !fspace->sinfo) { H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ @@ -938,65 +923,65 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) cache_udata.f = f; cache_udata.dxpl_id = dxpl_id; cache_udata.fspace = fspace; - if(NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") + if(NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC_READ))) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") - /* Unload and release ownership of the free-space manager section info */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") - } /* end if */ + /* Unload and release ownership of the free-space manager section info */ + if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + } /* end if */ - saved_addr = fspace->sect_addr; - saved_size = fspace->alloc_sect_size; + saved_addr = fspace->sect_addr; + saved_size = fspace->alloc_sect_size; - fspace->sect_addr = HADDR_UNDEF; - fspace->alloc_sect_size = 0; + fspace->sect_addr = HADDR_UNDEF; + fspace->alloc_sect_size = 0; - /* Free space for the free-space manager section info */ + /* Free space for the free-space manager section info */ if(!H5F_IS_TMP_ADDR(f, saved_addr)) { if(H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, dxpl_id, saved_addr, saved_size) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections") } /* end if */ - /* Mark free-space manager header as dirty */ - if(H5FS_dirty(fspace) < 0) + /* Mark free-space manager header as dirty */ + if(H5FS_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ if(H5F_addr_defined(fspace->addr)) { unsigned hdr_status = 0; /* Header entry status */ - /* Check whether free-space manager header is in cache or not */ - if(H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0) + /* Check whether free-space manager header is in cache or not */ + if(H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to check metadata cache status for free-space section info") if(hdr_status & H5AC_ES__IN_CACHE) { H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - /* Protect the free-space manager header */ + /* Protect the free-space manager header */ /* (no class information necessary since it's in the cache) */ cache_udata.f = f; cache_udata.nclasses = 0; cache_udata.classes = NULL; cache_udata.cls_init_udata = NULL; - if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") + if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, &cache_udata, H5AC_READ))) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") - /* Unpin the free-space manager header */ - if(H5AC_unpin_entry(fspace) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") + /* Unpin the free-space manager header */ + if(H5AC_unpin_entry(fspace) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") - /* Unload and release ownership of the free-space header */ - if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") - } /* end if */ + /* Unload and release ownership of the free-space header */ + if(H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + } /* end if */ - saved_addr = fspace->addr; - fspace->addr = HADDR_UNDEF; + saved_addr = fspace->addr; + fspace->addr = HADDR_UNDEF; - /* Free space for the free-space manager header */ - if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header") + /* Free space for the free-space manager header */ + if(H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, dxpl_id, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header") } /* end if */ done: @@ -1005,15 +990,92 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_hdr_dest + * Function: H5FS_depend * - * Purpose: Destroys a free space header in memory. + * Purpose: Make a child flush dependency between the free space + * manager's and another piece of metadata in the file. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Dana Robinson + * Fall 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FS_depend(H5AC_info_t *parent_entry, H5FS_t *fs) +{ + /* Local variables */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(fs); + + /* Set up flush dependency between parent entry and free space manager */ + if(H5FS__create_flush_depend(parent_entry, (H5AC_info_t *)fs) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency on file metadata") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FS_depend() */ + + +/*------------------------------------------------------------------------- + * Function: H5FA_undepend + * + * Purpose: Remove a child flush dependency between the free space + * manager's and another piece of metadata in the file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FS_undepend(H5AC_info_t *parent_entry, H5FS_t *fs) +{ + /* Local variables */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef QAK +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* QAK */ + + /* + * Check arguments. + */ + HDassert(fs); + + /* Remove flush dependency between parent entry and free space manager */ + if(H5FS__destroy_flush_depend(parent_entry, (H5AC_info_t *)fs) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency on file metadata") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FS_undepend() */ + + +/*------------------------------------------------------------------------- + * Function: H5FS_hdr_dest + * + * Purpose: Destroys a free space header in memory. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -1051,14 +1113,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_sect_cb + * Function: H5FS_sinfo_free_sect_cb * - * Purpose: Free a size-tracking node for a bin + * Purpose: Free a size-tracking node for a bin * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -1077,20 +1138,18 @@ H5FS_sinfo_free_sect_cb(void *_sect, void UNUSED *key, void *op_data) /* Call the section's class 'free' method on the section */ (*sinfo->fspace->sect_cls[sect->type].free)(sect); - FUNC_LEAVE_NOAPI(0) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_sinfo_free_sect_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_free_node_cb + * Function: H5FS_sinfo_free_node_cb * - * Purpose: Free a size-tracking node for a bin + * Purpose: Free a size-tracking node for a bin * - * Return: Success: non-negative + * Return: SUCCEED (Can't fail) * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, March 11, 2006 * *------------------------------------------------------------------------- @@ -1111,20 +1170,19 @@ H5FS_sinfo_free_node_cb(void *item, void UNUSED *key, void *op_data) /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); - FUNC_LEAVE_NOAPI(0) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_sinfo_free_node_cb() */ /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_dest + * Function: H5FS_sinfo_dest * - * Purpose: Destroys a free space section info in memory. + * Purpose: Destroys a free space section info in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -1177,15 +1235,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_assert + * Function: H5FS_assert * - * Purpose: Verify that the free space manager is mostly sane + * Purpose: Verify that the free space manager is mostly sane * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FScache.c b/src/H5FScache.c index e441398..8719bec 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FScache.c - * May 2 2006 - * Quincey Koziol + * Created: H5FScache.c + * May 2 2006 + * Quincey Koziol * - * Purpose: Implement file free space metadata cache methods. + * Purpose: Implement file free space metadata cache methods. * *------------------------------------------------------------------------- */ @@ -28,18 +28,18 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#define H5FS_PACKAGE /* Suppress error about including H5FSpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ /* Local Macros */ @@ -84,10 +84,12 @@ static herr_t H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, had static herr_t H5FS_cache_hdr_dest(H5F_t *f, H5FS_t *fspace); static herr_t H5FS_cache_hdr_clear(H5F_t *f, H5FS_t *fspace, hbool_t destroy); static herr_t H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t *fspace, size_t *size_ptr); + static H5FS_sinfo_t *H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata); static herr_t H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5FS_sinfo_t *sinfo, unsigned UNUSED * flags_ptr); static herr_t H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo); static herr_t H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy); +static herr_t H5FS_cache_sinfo_notify(H5AC_notify_action_t action, H5FS_sinfo_t *sinfo); static herr_t H5FS_cache_sinfo_size(const H5F_t *f, const H5FS_sinfo_t *sinfo, size_t *size_ptr); @@ -113,7 +115,7 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{ (H5AC_flush_func_t)H5FS_cache_sinfo_flush, (H5AC_dest_func_t)H5FS_cache_sinfo_dest, (H5AC_clear_func_t)H5FS_cache_sinfo_clear, - (H5AC_notify_func_t)NULL, + (H5AC_notify_func_t)H5FS_cache_sinfo_notify, (H5AC_size_func_t)H5FS_cache_sinfo_size, }}; @@ -133,15 +135,14 @@ H5FL_BLK_DEFINE_STATIC(sect_block); /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_load + * Function: H5FS_cache_hdr_load * - * Purpose: Loads a free space manager header from the disk. + * Purpose: Loads a free space manager header from the disk. * * Return: Success: Pointer to a new free space header * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -149,16 +150,16 @@ H5FL_BLK_DEFINE_STATIC(sect_block); static H5FS_t * H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) { - H5FS_t *fspace = NULL; /* Free space header info */ + H5FS_t *fspace = NULL; /* Free space header info */ H5FS_hdr_cache_ud_t *udata = (H5FS_hdr_cache_ud_t *)_udata; /* user data for callback */ H5WB_t *wb = NULL; /* Wrapped buffer for header data */ uint8_t hdr_buf[H5FS_HDR_BUF_SIZE]; /* Buffer for header */ - uint8_t *hdr; /* Pointer to header buffer */ - const uint8_t *p; /* Pointer into raw data buffer */ + uint8_t *hdr; /* Pointer to header buffer */ + 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 */ unsigned nclasses; /* Number of section classes */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -168,7 +169,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Allocate a new free space manager */ if(NULL == (fspace = H5FS_new(udata->f, udata->nclasses, udata->classes, udata->cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set free space manager's internal information */ fspace->addr = udata->addr; @@ -183,23 +184,23 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Read header from disk */ if(H5F_block_read(f, H5FD_MEM_FSPACE_HDR, addr, fspace->hdr_size, dxpl_id, hdr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space header") p = hdr; /* Magic number */ if(HDmemcmp(p, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5FS_HDR_VERSION) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") /* Client ID */ fspace->client = (H5FS_client_t)*p++; if(fspace->client >= H5FS_NUM_CLIENT_ID) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") /* Total space tracked */ H5F_DECODE_LENGTH(udata->f, p, fspace->tot_space); @@ -217,7 +218,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* (only check if we actually have some classes) */ UINT16DECODE(p, nclasses); if(fspace->nclasses > 0 && fspace->nclasses != nclasses) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch") /* Shrink percent */ UINT16DECODE(p, fspace->shrink_percent); @@ -250,7 +251,7 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata) /* Verify checksum */ if(stored_chksum != computed_chksum) - HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") + HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") /* Set return value */ ret_value = fspace; @@ -268,14 +269,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_flush + * Function: H5FS_cache_hdr_flush * - * Purpose: Flushes a dirty free space header to disk. + * Purpose: Flushes a dirty free space header to disk. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * May 2 2006 * *------------------------------------------------------------------------- @@ -330,8 +330,8 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F } /* end if */ } /* end if */ else if(fspace->serial_sect_count > 0) - /* Sanity check that section info has address */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + /* Sanity check that section info has address */ + HDassert(H5F_addr_defined(fspace->sect_addr)); if(fspace->cache_info.is_dirty) { uint8_t *hdr; /* Pointer to header buffer */ @@ -401,17 +401,17 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); - /* Write the free space header. */ + /* Write the free space header. */ HDassert((size_t)(p - hdr) == fspace->hdr_size); - if(H5F_block_write(f, H5FD_MEM_FSPACE_HDR, addr, fspace->hdr_size, dxpl_id, hdr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space header to disk") + if(H5F_block_write(f, H5FD_MEM_FSPACE_HDR, addr, fspace->hdr_size, dxpl_id, hdr) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space header to disk") - fspace->cache_info.is_dirty = FALSE; + fspace->cache_info.is_dirty = FALSE; } /* end if */ if(destroy) if(H5FS_cache_hdr_dest(f, fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") done: /* Release resources */ @@ -423,15 +423,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_dest + * Function: H5FS_cache_hdr_dest * - * Purpose: Destroys a free space header in memory. + * Purpose: Destroys a free space header in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -472,15 +471,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_clear + * Function: H5FS_cache_hdr_clear * - * Purpose: Mark a free space header in memory as non-dirty. + * Purpose: Mark a free space header in memory as non-dirty. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -501,7 +499,7 @@ H5FS_cache_hdr_clear(H5F_t *f, H5FS_t *fspace, hbool_t destroy) if(destroy) if(H5FS_cache_hdr_dest(f, fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") done: FUNC_LEAVE_NOAPI(ret_value) @@ -509,17 +507,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_hdr_size + * Function: H5FS_cache_hdr_size * - * Purpose: Compute the size in bytes of a free space header - * on disk, and return it in *size_ptr. On failure, - * the value of *size_ptr is undefined. + * Purpose: Compute the size in bytes of a free space header + * on disk, and return it in *size_ptr. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -541,15 +537,14 @@ H5FS_cache_hdr_size(const H5F_t UNUSED *f, const H5FS_t *fspace, size_t *size_pt /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_load + * Function: H5FS_cache_sinfo_load * - * Purpose: Loads free space sections from the disk. + * Purpose: Loads free space sections from the disk. * * Return: Success: Pointer to a new free space section info * Failure: NULL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 31 2006 * *------------------------------------------------------------------------- @@ -557,15 +552,15 @@ H5FS_cache_hdr_size(const H5F_t UNUSED *f, const H5FS_t *fspace, size_t *size_pt static H5FS_sinfo_t * H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) { - H5FS_sinfo_t *sinfo = NULL; /* Free space section info */ + H5FS_sinfo_t *sinfo = NULL; /* Free space section info */ H5FS_sinfo_cache_ud_t *udata = (H5FS_sinfo_cache_ud_t *)_udata; /* user data for callback */ haddr_t fs_addr; /* Free space header address */ size_t old_sect_size; /* Old section size */ - uint8_t *buf = NULL; /* Temporary buffer */ - const uint8_t *p; /* Pointer into raw data buffer */ + uint8_t *buf = NULL; /* Temporary buffer */ + 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 */ - H5FS_sinfo_t *ret_value; /* Return value */ + H5FS_sinfo_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -575,7 +570,7 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata /* Allocate a new free space section info */ if(NULL == (sinfo = H5FS_sinfo_new(udata->f, udata->fspace))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Allocate space for the buffer to serialize the sections into */ H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ udata->fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); @@ -584,24 +579,24 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata /* Read buffer from disk */ if(H5F_block_read(f, H5FD_MEM_FSPACE_SINFO, udata->fspace->sect_addr, (size_t)udata->fspace->sect_size, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_READERROR, NULL, "can't read free space sections") /* Deserialize free sections from buffer available */ p = buf; /* Magic number */ if(HDmemcmp(p, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature") p += H5_SIZEOF_MAGIC; /* Version */ if(*p++ != H5FS_SINFO_VERSION) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections version") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections version") /* Address of free space header for these sections */ H5F_addr_decode(udata->f, &p, &fs_addr); if(H5F_addr_ne(fs_addr, udata->fspace->addr)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections") /* Check for any serialized sections */ if(udata->fspace->serial_sect_count > 0) { @@ -684,7 +679,7 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata /* Verify checksum */ if(stored_chksum != computed_chksum) - HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") + HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") /* Sanity check */ HDassert((size_t)(p - (const uint8_t *)buf) == old_sect_size); @@ -704,14 +699,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_serialize_sect_cb + * Function: H5FS_sinfo_serialize_sect_cb * - * Purpose: Skip list iterator callback to serialize free space sections + * Purpose: Skip list iterator callback to serialize free space sections * of a particular size * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -760,14 +755,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_serialize_node_cb + * Function: H5FS_sinfo_serialize_node_cb * - * Purpose: Skip list iterator callback to serialize free space sections + * Purpose: Skip list iterator callback to serialize free space sections * in a bin * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -806,14 +801,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_flush + * Function: H5FS_cache_sinfo_flush * - * Purpose: Flushes a dirty free space section info to disk. + * Purpose: Flushes a dirty free space section info to disk. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * July 31 2006 * *------------------------------------------------------------------------- @@ -916,13 +910,13 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H buf = H5FL_BLK_FREE(sect_block, buf); - sinfo->cache_info.is_dirty = FALSE; + sinfo->cache_info.is_dirty = FALSE; sinfo->dirty = FALSE; } /* end if */ if(destroy) if(H5FS_cache_sinfo_dest(f, sinfo) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space section info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -930,15 +924,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_dest + * Function: H5FS_cache_sinfo_dest * - * Purpose: Destroys a free space section info in memory. + * Purpose: Destroys a free space section info in memory. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -977,15 +970,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_clear + * Function: H5FS_cache_sinfo_clear * - * Purpose: Mark a free space section info in memory as non-dirty. + * Purpose: Mark a free space section info in memory as non-dirty. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -1006,7 +998,7 @@ H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy) if(destroy) if(H5FS_cache_sinfo_dest(f, sinfo) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space section info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1014,17 +1006,67 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_cache_sinfo_size + * Function: H5FS_cache_sinfo_notify + * + * Purpose: Handle cache action notifications * - * Purpose: Compute the size in bytes of a free space section info - * on disk, and return it in *size_ptr. On failure, - * the value of *size_ptr is undefined. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure + * Programmer: Dana Robinson + * Fall 2012 * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + *------------------------------------------------------------------------- + */ +herr_t +H5FS_cache_sinfo_notify(H5AC_notify_action_t action, H5FS_sinfo_t *sinfo) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(sinfo); + + /* Check if the file was opened with SWMR-write access */ + if(sinfo->fspace->swmr_write) { + /* Determine which action to take */ + switch(action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + /* Create flush dependency on extensible array header */ + if(H5FS__create_flush_depend((H5AC_info_t *)sinfo->fspace, (H5AC_info_t *)sinfo) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and header, address = %llu", (unsigned long long)sinfo->fspace->sect_addr) + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on extensible array header */ + if(H5FS__destroy_flush_depend((H5AC_info_t *)sinfo->fspace, (H5AC_info_t *)sinfo) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block and header, address = %llu", (unsigned long long)sinfo->fspace->sect_addr) + break; + + default: +#ifdef NDEBUG + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FS_cache_sinfo_notify() */ + + +/*------------------------------------------------------------------------- + * Function: H5FS_cache_sinfo_size + * + * Purpose: Compute the size in bytes of a free space section info + * on disk, and return it in *size_ptr. + * + * Return: SUCCEED (Can't fail) + * + * Programmer: Quincey Koziol + * July 31 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index fe3ca71..c1c8c29 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSdbg.c - * May 9 2006 - * Quincey Koziol + * Created: H5FSdbg.c + * May 9 2006 + * Quincey Koziol * - * Purpose: Dump debugging information about a free space manager + * Purpose: Dump debugging information about a free space manager * *------------------------------------------------------------------------- */ @@ -28,18 +28,18 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ -#define H5HF_DEBUGGING /* Need access to fractal heap debugging routines */ -#define H5MF_DEBUGGING /* Need access to file space debugging routines */ +#define H5FS_PACKAGE /* Suppress error about including H5FSpkg */ +#define H5HF_DEBUGGING /* Need access to fractal heap debugging routines */ +#define H5MF_DEBUGGING /* Need access to file space debugging routines */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5HFprivate.h" /* Fractal heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5HFprivate.h" /* Fractal heaps */ +#include "H5MFprivate.h" /* File memory management */ /****************/ /* Local Macros */ @@ -77,26 +77,21 @@ /*------------------------------------------------------------------------- - * Function: H5FS_debug + * Function: H5FS_debug * - * Purpose: Prints debugging info about a free space manager. + * Purpose: Prints debugging info about a free space manager. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 - * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Add H5FS_CLIENT_FILE_ID for File Memory Management + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - H5FS_t *fspace = NULL; /* Free space header info */ + H5FS_t *fspace = NULL; /* Free space header info */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -122,7 +117,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int * Load the free space header. */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, addr, &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Print opening message */ HDfprintf(stream, "%*sFree Space Header...\n", indent, ""); @@ -131,45 +126,45 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int * Print the values. */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Free space client:", - (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : - (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); + "Free space client:", + (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : + (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Total free space tracked:", - fspace->tot_space); + "Total free space tracked:", + fspace->tot_space); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Total number of free space sections tracked:", - fspace->tot_sect_count); + "Total number of free space sections tracked:", + fspace->tot_sect_count); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of serializable free space sections tracked:", - fspace->serial_sect_count); + "Number of serializable free space sections tracked:", + fspace->serial_sect_count); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of ghost free space sections tracked:", - fspace->ghost_sect_count); + "Number of ghost free space sections tracked:", + fspace->ghost_sect_count); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of free space section classes:", - fspace->nclasses); + "Number of free space section classes:", + fspace->nclasses); HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, - "Shrink percent:", - fspace->shrink_percent); + "Shrink percent:", + fspace->shrink_percent); HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, - "Expand percent:", - fspace->expand_percent); + "Expand percent:", + fspace->expand_percent); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of bits for section address space:", - fspace->max_sect_addr); + "# of bits for section address space:", + fspace->max_sect_addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Maximum section size:", - fspace->max_sect_size); + "Maximum section size:", + fspace->max_sect_size); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Serialized sections address:", - fspace->sect_addr); + "Serialized sections address:", + fspace->sect_addr); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Serialized sections size used:", - fspace->sect_size); + "Serialized sections size used:", + fspace->sect_size); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Serialized sections size allocated:", - fspace->alloc_sect_size); + "Serialized sections size allocated:", + fspace->alloc_sect_size); done: if(fspace && H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, addr, fspace, H5AC__NO_FLAGS_SET) < 0) @@ -180,15 +175,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_debug + * Function: H5FS_sect_debug * - * Purpose: Prints debugging info about a free space section. + * Purpose: Prints debugging info about a free space section. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 30 2006 + * Programmer: Quincey Koziol + * May 30 2006 * *------------------------------------------------------------------------- */ @@ -219,15 +213,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sects_debug + * Function: H5FS_sects_debug * - * Purpose: Prints debugging info about the free space sections. + * Purpose: Prints debugging info about the free space sections. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 9 2006 + * Programmer: Quincey Koziol + * May 9 2006 * *------------------------------------------------------------------------- */ @@ -235,7 +228,7 @@ herr_t H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int indent, int fwidth, haddr_t fs_addr, haddr_t client_addr) { - H5FS_t *fspace = NULL; /* Free space header info */ + H5FS_t *fspace = NULL; /* Free space header info */ H5FS_client_t client; /* The client of the free space */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -264,7 +257,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int * Load the free space header. */ if(NULL == (fspace = (H5FS_t *)H5AC_protect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC_READ))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") /* Retrieve the client id */ client = fspace->client; @@ -290,8 +283,8 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int break; case H5FS_CLIENT_FILE_ID: - if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") + if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") break; case H5FS_NUM_CLIENT_ID: diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index e22e411..d914e8e 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, May 2, 2006 + * Programmer: Quincey Koziol + * Tuesday, May 2, 2006 * - * Purpose: This file contains declarations which are visible only within - * the H5FS package. Source files outside the H5FS package should - * include H5FSprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5FS package. Source files outside the H5FS package should + * include H5FSprivate.h instead. */ #ifndef H5FS_PACKAGE #error "Do not include this file outside the H5FS package!" @@ -38,11 +38,11 @@ /* #define H5FS_DEBUG_ASSERT */ /* Get package's private header */ -#include "H5FSprivate.h" /* File free space */ +#include "H5FSprivate.h" /* File free space */ /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5SLprivate.h" /* Skip lists */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ @@ -179,6 +179,7 @@ struct H5FS_t { haddr_t addr; /* Address of free space header on disk */ size_t hdr_size; /* Size of free space header on disk */ H5FS_sinfo_t *sinfo; /* Section information */ + hbool_t swmr_write; /* Flag indicating the file is opened with SWMR-write access */ unsigned sinfo_lock_count; /* # of times the section info has been locked */ hbool_t sinfo_protected; /* Whether the section info was protected when locked */ hbool_t sinfo_modified; /* Whether the section info has been modified while locked */ @@ -220,6 +221,12 @@ H5FL_EXTERN(H5FS_t); /* Package Private Prototypes */ /******************************/ +/* Generic routines */ +H5_DLL herr_t H5FS__create_flush_depend(H5AC_info_t *parent_entry, + H5AC_info_t *child_entry); +H5_DLL herr_t H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, + H5AC_info_t *child_entry); + /* Free space manager header routines */ H5_DLL H5FS_t *H5FS_new(const H5F_t *f, size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata); diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index f6a0034..9dd7022 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5FSprivate.h - * May 2 2006 - * Quincey Koziol + * Created: H5FSprivate.h + * May 2 2006 + * Quincey Koziol * - * Purpose: Private header for library accessible file free space routines. + * Purpose: Private header for library accessible file free space routines. * *------------------------------------------------------------------------- */ @@ -31,6 +31,7 @@ #include "H5FSpublic.h" /* Private headers needed by this file */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free Lists */ @@ -127,8 +128,8 @@ struct H5FS_section_info_t { /* Free space client IDs for identifying user of free space */ typedef enum H5FS_client_t { - H5FS_CLIENT_FHEAP_ID = 0, /* Free space is used by fractal heap */ - H5FS_CLIENT_FILE_ID, /* Free space is used by file */ + H5FS_CLIENT_FHEAP_ID = 0, /* Free space is used by fractal heap */ + H5FS_CLIENT_FILE_ID, /* Free space is used by file */ H5FS_NUM_CLIENT_ID /* Number of free space client IDs (must be last) */ } H5FS_client_t; @@ -147,11 +148,11 @@ typedef struct H5FS_stat_t { hsize_t tot_sect_count; /* Total # of sections tracked */ hsize_t serial_sect_count; /* # of serializable sections tracked */ hsize_t ghost_sect_count; /* # of un-serializable sections tracked */ - haddr_t addr; /* Address of free space header on disk */ - hsize_t hdr_size; /* Size of the free-space header on disk */ + haddr_t addr; /* Address of free space header on disk */ + hsize_t hdr_size; /* Size of the free-space header on disk */ haddr_t sect_addr; /* Address of the section info in the file */ hsize_t alloc_sect_size; /* Allocated size of the section info in the file */ - hsize_t sect_size; /* Size of the section info in the file */ + hsize_t sect_size; /* Size of the section info in the file */ } H5FS_stat_t; /* Typedef for iteration operations */ @@ -183,6 +184,8 @@ H5_DLL herr_t H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace); H5_DLL herr_t H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id); H5_DLL herr_t H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id); H5_DLL herr_t H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id); +H5_DLL herr_t H5FS_depend(H5AC_info_t *parent_entry, H5FS_t *fs); +H5_DLL herr_t H5FS_undepend(H5AC_info_t *parent_entry, H5FS_t *fs); /* Free space section routines */ H5_DLL herr_t H5FS_sect_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, diff --git a/src/H5FSpublic.h b/src/H5FSpublic.h index d1bae94..87debe8 100644 --- a/src/H5FSpublic.h +++ b/src/H5FSpublic.h @@ -17,7 +17,7 @@ * * Created: H5FSpublic.h * May 2 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Public declarations for the file free space package. * diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 581d3dc..5e1c853 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -14,10 +14,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * - * Purpose: Free space tracking functions. + * Purpose: Free space tracking functions. * */ @@ -25,17 +25,17 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#define H5FS_PACKAGE /* Suppress error about including H5FSpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* File free space */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5Vprivate.h" /* Vectors and arrays */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* File free space */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5Vprivate.h" /* Vectors and arrays */ /****************/ @@ -111,14 +111,14 @@ H5FL_DEFINE(H5FS_sinfo_t); /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_new + * Function: H5FS_sinfo_new * - * Purpose: Create new section info structure + * Purpose: Create new section info structure * - * Return: Success: non-NULL, pointer to new section info struct - * Failure: NULL + * Return: Success: non-NULL, pointer to new section info struct + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 31, 2006 * *------------------------------------------------------------------------- @@ -140,7 +140,7 @@ HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); /* Allocate the free space header */ if(NULL == (sinfo = H5FL_CALLOC(H5FS_sinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Set non-zero values */ sinfo->nbins = H5V_log2_gen(fspace->max_sect_size); @@ -186,19 +186,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_lock + * Function: H5FS_sinfo_lock * - * Purpose: Make certain the section info for the free space manager is + * Purpose: Make certain the section info for the free space manager is * in memory. * * Either uses existing section info owned by the free space * header, loads section info from disk, or creates new section * info * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -297,15 +296,14 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /*------------------------------------------------------------------------- - * Function: H5FS_sinfo_unlock + * Function: H5FS_sinfo_unlock * - * Purpose: Release the section info, either giving ownership back to + * Purpose: Release the section info, either giving ownership back to * the cache or letting the free space header keep it. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 7, 2008 * *------------------------------------------------------------------------- @@ -461,14 +459,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_serialize_size + * Function: H5FS_sect_serialize_size * - * Purpose: Determine serialized size of all sections in free space manager + * Purpose: Determine serialized size of all sections in free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -525,15 +522,14 @@ HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", "H5FS_sect_serialize_ /*------------------------------------------------------------------------- - * Function: H5FS_sect_increase + * Function: H5FS_sect_increase * - * Purpose: Increase the size of the serialized free space section info + * Purpose: Increase the size of the serialized free space section info * on disk * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -587,16 +583,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_decrease + * Function: H5FS_sect_decrease * - * Purpose: Decrease the size of the serialized free space section info + * Purpose: Decrease the size of the serialized free space section info * on disk * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, May 8, 2006 * *------------------------------------------------------------------------- @@ -646,14 +640,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_size_node_decr + * Function: H5FS_size_node_decr * - * Purpose: Decrement the number of sections of a particular size + * Purpose: Decrement the number of sections of a particular size * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -734,15 +727,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_size + * Function: H5FS_sect_unlink_size * - * Purpose: Remove a section node from size tracking data structures for + * Purpose: Remove a section node from size tracking data structures for * a free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -789,17 +781,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_unlink_rest + * Function: H5FS_sect_unlink_rest * - * Purpose: Finish unlinking a section from the rest of the free space + * Purpose: Finish unlinking a section from the rest of the free space * manager's data structures, after the section has been removed * from the size tracking data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -846,14 +836,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove_real + * Function: H5FS_sect_remove_real * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -888,14 +877,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_remove + * Function: H5FS_sect_remove * - * Purpose: Remove a section from the free space manager + * Purpose: Remove a section from the free space manager * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -933,14 +921,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_size + * Function: H5FS_sect_link_size * - * Purpose: Add a section of free space to the free list bins + * Purpose: Add a section of free space to the free list bins * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * *------------------------------------------------------------------------- @@ -1041,16 +1028,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link_rest + * Function: H5FS_sect_link_rest * - * Purpose: Link a section into the rest of the non-size tracking + * Purpose: Link a section into the rest of the non-size tracking * free space manager data structures * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1093,15 +1078,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_link + * Function: H5FS_sect_link * - * Purpose: Link a section into the internal data structures + * Purpose: Link a section into the internal data structures * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * *------------------------------------------------------------------------- @@ -1145,24 +1128,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_merge + * Function: H5FS_sect_merge * - * Purpose: Attempt to merge a returned free space section with existing + * Purpose: Attempt to merge a returned free space section with existing * free space. * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, May 17, 2006 * - * Modifications: Vailin Choi; Sept 25th 2008 - * Changes to the "shrinking" part-- - * 1. Get last section node in merge-list instead of "less-than" - * node for further iteration - * 2. Remove "can-be-shrunk" section from free-space instead of - * "less-than" section - * *------------------------------------------------------------------------- */ static herr_t @@ -1170,7 +1145,7 @@ H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) { H5FS_section_class_t *sect_cls; /* Section's class */ hbool_t modified; /* Flag to indicate merge or shrink occurred */ - hbool_t remove_sect = FALSE; /* Whether a section should be removed before shrinking */ + hbool_t remove_sect = FALSE; /* Whether a section should be removed before shrinking */ htri_t status; /* Status value */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1302,13 +1277,13 @@ HDfprintf(stderr, "%s: Done merging, (*sect) = {%a, %Hu, %u, %s}\n", FUNC, (*sec HDfprintf(stderr, "%s: Can shrink!\n", FUNC); #endif /* QAK */ - /* Remove SECT from free-space manager */ + /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ - if(remove_sect) { - if(H5FS_sect_remove_real(fspace, *sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") - remove_sect = FALSE; - } /* end if */ + if(remove_sect) { + if(H5FS_sect_remove_real(fspace, *sect) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't remove section from internal data structures") + remove_sect = FALSE; + } /* end if */ /* Shrink the container */ /* (callback can indicate that it has discarded the section by setting *sect to NULL) */ @@ -1332,7 +1307,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); remove_sect = TRUE; } /* end if */ } /* end if */ - } /* end if */ + } /* end if */ /* Indicate successful merge occurred */ modified = TRUE; @@ -1342,7 +1317,7 @@ HDfprintf(stderr, "%s: Can shrink!\n", FUNC); /* Check for section that was shrunk away and next section not shrinking */ if(remove_sect && (*sect != NULL)) - *sect = NULL; + *sect = NULL; #ifdef QAK HDfprintf(stderr, "%s: Done shrinking\n", FUNC); @@ -1361,15 +1336,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_add - * - * Purpose: Add a section of free space to the free list + * Function: H5FS_sect_add * - * Return: Success: non-negative + * Purpose: Add a section of free space to the free list * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * *------------------------------------------------------------------------- @@ -1451,14 +1424,13 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_extend + * Function: H5FS_sect_try_extend * - * Purpose: Try to extend a block using space from a section on the free list + * Purpose: Try to extend a block using space from a section on the free list * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 8, 2008 * *------------------------------------------------------------------------- @@ -1582,15 +1554,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_try_merge + * Function: H5FS_sect_try_merge * - * Purpose: Try to merge/shrink a block + * Purpose: Try to merge/shrink a block * - * Return: TRUE: merged/shrunk - * FALSE: not merged/not shrunk - * Failure: negative + * Return: TRUE: merged/shrunk + * FALSE: not merged/not shrunk + * Failure: negative * - * Programmer: Vailin Choi; June 10, 2009 + * Programmer: Vailin Choi + * June 10, 2009 * *------------------------------------------------------------------------- */ @@ -1600,7 +1573,7 @@ H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t { hbool_t sinfo_valid = FALSE; /* Whether the section info is valid */ hbool_t sinfo_modified = FALSE; /* Whether the section info was modified */ - hsize_t saved_fs_size; /* copy the free-space section size */ + hsize_t saved_fs_size; /* Copy of the free-space section size */ htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1614,18 +1587,18 @@ H5FS_sect_try_merge(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t /* Get a pointer to the section info */ if(H5FS_sinfo_lock(f, dxpl_id, fspace, H5AC_WRITE) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") sinfo_valid = TRUE; saved_fs_size = sect->size; /* Attempt to merge/shrink section with existing sections */ if(H5FS_sect_merge(fspace, §, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") /* Check if section is shrunk and/or merged away completely */ if(!sect) { - sinfo_modified = TRUE; - HGOTO_DONE(TRUE) + sinfo_modified = TRUE; + HGOTO_DONE(TRUE) } /* end if */ else { /* Check if section is merged */ @@ -1647,23 +1620,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find_node + * Function: H5FS_sect_find_node * - * Purpose: Locate a section of free space (in existing free space list + * Purpose: Locate a section of free space (in existing free space list * bins) that is large enough to fulfill request. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 20, 2006 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Modified to handle alignment by going through each bin to find - * a section that is big enough to fulfill "request+fragment for alignment" - * *------------------------------------------------------------------------- */ static htri_t @@ -1695,34 +1661,34 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); #endif /* QAK */ alignment = fspace->alignment; if(!((alignment > 1) && (request >= fspace->threshold))) - alignment = 0; /* no alignment */ + alignment = 0; /* no alignment */ do { /* Check if there's any sections in this bin */ - if(fspace->sinfo->bins[bin].bin_list) { - - if (!alignment) { /* no alignment */ - /* Find the first free space section that is large enough to fulfill request */ - /* (Since the bins use skip lists to track the sizes of the address-ordered - * lists, this is actually a "best fit" algorithm) - */ - /* Look for large enough free space section in this bin */ - if((fspace_node = (H5FS_node_t *)H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { - /* Take first node off of the list (ie. node w/lowest address) */ - if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") - - /* Get section's class */ - cls = &fspace->sect_cls[(*node)->type]; - /* Decrement # of sections in section size node */ - if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") - if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") - /* Indicate that we found a node for the request */ - HGOTO_DONE(TRUE) - } /* end if */ - } /* end if */ + if(fspace->sinfo->bins[bin].bin_list) { + + if (!alignment) { /* no alignment */ + /* Find the first free space section that is large enough to fulfill request */ + /* (Since the bins use skip lists to track the sizes of the address-ordered + * lists, this is actually a "best fit" algorithm) + */ + /* Look for large enough free space section in this bin */ + if((fspace_node = (H5FS_node_t *)H5SL_greater(fspace->sinfo->bins[bin].bin_list, &request))) { + /* Take first node off of the list (ie. node w/lowest address) */ + if(NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") + + /* Get section's class */ + cls = &fspace->sect_cls[(*node)->type]; + /* Decrement # of sections in section size node */ + if(H5FS_size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") + if(H5FS_sect_unlink_rest(fspace, cls, *node) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from non-size tracking data structures") + /* Indicate that we found a node for the request */ + HGOTO_DONE(TRUE) + } /* end if */ + } /* end if */ else { /* alignment is set */ /* get the first node of a certain size in this bin */ curr_size_node = H5SL_first(fspace->sinfo->bins[bin].bin_list); @@ -1791,9 +1757,9 @@ HDfprintf(stderr, "%s: bin = %u\n", FUNC, bin); /* Get the next size node in the bin */ curr_size_node = H5SL_next(curr_size_node); } /* end while of curr_size_node */ - } /* else of alignment */ - } /* if bin_list */ - /* Advance to next larger bin */ + } /* else of alignment */ + } /* if bin_list */ + /* Advance to next larger bin */ bin++; } while(bin < fspace->sinfo->nbins); @@ -1803,22 +1769,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_find + * Function: H5FS_sect_find * - * Purpose: Locate a section of free space (in existing free space list) that + * Purpose: Locate a section of free space (in existing free space list) that * is large enough to fulfill request. * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 7, 2006 * - * Modifications: - * Vailin Choi, July 29th 2008 - * Move H5FS_sect_unlink_rest() to H5FS_sect_find_node() - * *------------------------------------------------------------------------- */ htri_t @@ -1864,7 +1824,7 @@ HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_se #ifdef QAK HDfprintf(stderr, "%s: (*node)->size = %Hu, (*node)->addr = %a, (*node)->type = %u\n", FUNC, (*node)->size, (*node)->addr, (*node)->type); #endif /* QAK */ - } + } } /* end if */ done: @@ -1880,16 +1840,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_sect_cb + * Function: H5FS_iterate_sect_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * of a particular size * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1918,16 +1876,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_iterate_node_cb + * Function: H5FS_iterate_node_cb * - * Purpose: Skip list iterator callback to iterate over free space sections + * Purpose: Skip list iterator callback to iterate over free space sections * in a bin * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -1957,15 +1913,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_iterate + * Function: H5FS_sect_iterate * - * Purpose: Iterate over all the sections managed + * Purpose: Iterate over all the sections managed * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, May 13, 2006 * *------------------------------------------------------------------------- @@ -2025,14 +1979,13 @@ done: /*------------------------------------------------------------------------- - * Function: H5FS_sect_stats + * Function: H5FS_sect_stats * - * Purpose: Retrieve info about the sections managed + * Purpose: Retrieve info about the sections managed * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 30, 2006 * *------------------------------------------------------------------------- @@ -2056,16 +2009,14 @@ H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects) /*------------------------------------------------------------------------- - * Function: H5FS_sect_change_class + * Function: H5FS_sect_change_class * - * Purpose: Make appropriate adjustments to internal data structures when + * Purpose: Make appropriate adjustments to internal data structures when * a section changes class * - * Return: Success: non-negative - * - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 10, 2006 * *------------------------------------------------------------------------- @@ -2228,15 +2179,14 @@ done: #ifdef H5FS_DEBUG_ASSERT /*------------------------------------------------------------------------- - * Function: H5FS_sect_assert + * Function: H5FS_sect_assert * - * Purpose: Verify that the sections managed are mostly sane + * Purpose: Verify that the sections managed are mostly sane * - * Return: Non-negative on success, negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Jul 17 2006 + * Programmer: Quincey Koziol + * Jul 17 2006 * *------------------------------------------------------------------------- */ diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 66c5495..042dc8f 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -22,14 +22,14 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#define H5FS_PACKAGE /* suppress error about including H5FSpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ /* Local Macros */ @@ -72,12 +72,10 @@ * * Purpose: Retrieve metadata statistics for the free-space manager * - * Return: Success: non-negative - * - * Failure: does not fail + * Return: SUCCEED (Can't fail) * * Programmer: Vailin Choi - * August 25th, 2008 + * August 25th, 2008 * *------------------------------------------------------------------------- */ diff --git a/src/H5FStest.c b/src/H5FStest.c index 63ba94c..2549ed2 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -22,15 +22,15 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ -#define H5FS_TESTING /*suppress warning about H5FS testing funcs */ +#define H5FS_PACKAGE /* suppress error about including H5FSpkg */ +#define H5FS_TESTING /* suppress warning about H5FS testing funcs */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FSpkg.h" /* Free-space manager */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FSpkg.h" /* Free-space manager */ /****************/ /* Local Macros */ @@ -72,13 +72,12 @@ * Function: H5FS_get_cparam_test * * Purpose: Retrieve the parameters used to create the free-space manager + * similar to H5HF_get_cparam_test() * - * Return: Success: non-negative + * Return: SUCCEED/FAIL * - * Failure: negative - * - * Programmer: similar to H5HF_get_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ @@ -104,13 +103,13 @@ H5FS_get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) /*------------------------------------------------------------------------- * Function: H5FS_cmp_cparam_test * - * Purpose: Compare the parameters used to create the fractal heap + * Purpose: Compare the parameters used to create the free space manager + * similar to H5HF_cmp_cparam_test() * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: similar to H5HF_cmp_cparam_test() - * Vailin Choi; August 25th, 2008 + * Programmer: Vailin Choi + * August 25th, 2008 * *------------------------------------------------------------------------- */ diff --git a/src/H5HL.c b/src/H5HL.c index 76a6499..8bbc78b 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -103,7 +103,6 @@ H5FL_BLK_DEFINE(lheap_chunk); * Failure: FAIL. addr_p will be HADDR_UNDEF. * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 16 1997 * *------------------------------------------------------------------------- @@ -138,6 +137,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)) heap->single_cache_obj = TRUE; heap->dblk_addr = heap->prfx_addr + (hsize_t)heap->prfx_size; heap->dblk_size = size_hint; + heap->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; if(size_hint) if(NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); @@ -194,11 +194,9 @@ END_FUNC(PRIV) /* end H5HL_create() */ * Purpose: Go through the heap's freelist and determine if we can * eliminate the free blocks at the tail of the buffer. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 16, 2003 * *------------------------------------------------------------------------- @@ -318,7 +316,6 @@ END_FUNC(STATIC) /* H5HL__minimize_heap_space() */ * Failure: NULL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- @@ -408,7 +405,6 @@ END_FUNC(PRIV) /* end H5HL_protect() */ * Failure: Can't fail * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- @@ -431,11 +427,9 @@ END_FUNC(PRIV) /* end H5HL_offset_into() */ * * Purpose: Unprotect the data retrieved by the H5HL_protect call. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu * Sept. 17, 2003 * *------------------------------------------------------------------------- @@ -484,7 +478,6 @@ END_FUNC(PRIV) /* end H5HL_unprotect() */ * Return: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -512,11 +505,9 @@ END_FUNC(STATIC) /* end H5HL__remove_free() */ * * Purpose: Mark heap as dirty * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -557,7 +548,6 @@ END_FUNC(STATIC) /* end H5HL__dirty() */ * Failure: UFAIL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -769,11 +759,9 @@ END_FUNC(PRIV) /* H5HL_insert() */ * in two separate objects, one at the original offset and * one at the first offset past the removed portion. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 16 1997 * *------------------------------------------------------------------------- @@ -915,11 +903,9 @@ END_FUNC(PRIV) /* end H5HL_remove() */ * * Purpose: Deletes a local heap from disk, freeing disk space used. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 22 2003 * *------------------------------------------------------------------------- @@ -990,11 +976,9 @@ END_FUNC(PRIV) /* end H5HL_delete() */ * * Purpose: Retrieves the current size of a heap * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Nov 7 2005 * *------------------------------------------------------------------------- @@ -1041,8 +1025,7 @@ END_FUNC(PRIV) /* end H5HL_get_size() */ * Purpose: Compute the size in bytes of the specified instance of * H5HL_t via H5HL_size() * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi * June 19 2007 @@ -1091,11 +1074,9 @@ END_FUNC(PRIV) /* end H5HL_heapsize() */ * Purpose: Create a child flush dependency between the local heap * and another piece of metadata in the file. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2011 * *------------------------------------------------------------------------- @@ -1122,11 +1103,9 @@ END_FUNC(PRIV) /* end H5HL_depend() */ * Purpose: Remove a child flush dependency between the local heap and * another piece of metadata in the file. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2011 * *------------------------------------------------------------------------- diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 5576e6b..24d6435 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -76,7 +76,6 @@ static herr_t H5HL__prefix_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t H5HL_prfx_t *prfx, unsigned *flags_ptr); static herr_t H5HL__prefix_dest(H5F_t *f, H5HL_prfx_t *prfx); static herr_t H5HL__prefix_clear(H5F_t *f, H5HL_prfx_t *prfx, hbool_t destroy); -static herr_t H5HL__prefix_notify(H5AC_notify_action_t action, H5HL_prfx_t *prfx); static herr_t H5HL__prefix_size(const H5F_t *f, H5HL_prfx_t *prfx, size_t *size_ptr); /* Local heap data block */ @@ -103,7 +102,7 @@ const H5AC_class_t H5AC_LHEAP_PRFX[1] = {{ (H5AC_flush_func_t) H5HL__prefix_flush, (H5AC_dest_func_t) H5HL__prefix_dest, (H5AC_clear_func_t) H5HL__prefix_clear, - (H5AC_notify_func_t) H5HL__prefix_notify, + (H5AC_notify_func_t) NULL, (H5AC_size_func_t) H5HL__prefix_size, }}; @@ -134,11 +133,9 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ * * Purpose: Deserialize the free list for a heap data block * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -206,7 +203,6 @@ END_FUNC(STATIC) /* end H5HL__fl_deserialize() */ * Return: Nothing (void) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -246,7 +242,6 @@ END_FUNC_VOID(STATIC) /* end H5HL__fl_serialize() */ * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -381,11 +376,9 @@ END_FUNC(STATIC) /* end H5HL__prefix_load() */ * Purpose: Flushes a heap from memory to disk if it's dirty. Optionally * deletes the heap from memory. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -483,11 +476,9 @@ END_FUNC(STATIC) /* end H5HL__prefix_flush() */ * * Purpose: Destroys a heap prefix in memory. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 15 2003 * *------------------------------------------------------------------------- @@ -537,11 +528,9 @@ END_FUNC(STATIC) /* end H5HL__prefix_dest() */ * * Purpose: Mark a local heap prefix in memory as non-dirty. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 20 2003 * *------------------------------------------------------------------------- @@ -567,60 +556,13 @@ END_FUNC(STATIC) /* end H5HL__prefix_clear() */ /*------------------------------------------------------------------------- - * Function: H5HL__prefix_notify - * - * Purpose: Handle cache action notifications - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * derobins@hdfgroup.org - * Fall 2011 - * - *------------------------------------------------------------------------- - */ -BEGIN_FUNC(STATIC, ERR, -herr_t, SUCCEED, FAIL, -H5HL__prefix_notify(H5AC_notify_action_t action, H5HL_prfx_t *prfx)) - - /* Sanity check */ - HDassert(prfx); - - /* Check if the file was opened with SWMR-write access */ - if(prfx->heap->swmr_write) { - /* Determine which action to take */ - switch(action) { - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Destroy flush dependency on child */ - if(FAIL == H5HL__destroy_flush_depend((H5AC_info_t *)prfx, (H5AC_info_t *)prfx->heap->dblk)) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between prefix and data block, address of prefix = %llu", (unsigned long long)prfx->heap->prfx_addr); - break; - - default: -#ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache"); -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ - } /* end switch */ - } /* end if */ - -CATCH - /* No special processing on errors */ - -END_FUNC(STATIC) /* end H5HL__prefix_notify() */ - - -/*------------------------------------------------------------------------- * Function: H5HL__prefix_size * * Purpose: Compute the size in bytes of the heap prefix on disk, * and return it in *len_ptr. On failure, the value of *len_ptr * is undefined. * - * Return: Success: SUCCEED - * Failure: Can't fail + * Return: SUCCEED (Can't fail) * * Programmer: John Mainzer * 5/13/04 @@ -656,7 +598,6 @@ END_FUNC(STATIC) /* H5HL__prefix_size() */ * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 5 2010 * *------------------------------------------------------------------------- @@ -716,11 +657,9 @@ END_FUNC(STATIC) /* end H5HL__datablock_load() */ * Purpose: Flushes a heap's data block from memory to disk if it's dirty. * Optionally deletes the heap data block from memory. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 17 1997 * *------------------------------------------------------------------------- @@ -769,11 +708,9 @@ END_FUNC(STATIC) /* end H5HL__datablock_flush() */ * * Purpose: Destroys a local heap data block in memory. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 15 2003 * *------------------------------------------------------------------------- @@ -817,11 +754,9 @@ END_FUNC(STATIC) /* end H5HL__datablock_dest() */ * * Purpose: Mark a local heap data block in memory as non-dirty. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Mar 20 2003 * *------------------------------------------------------------------------- @@ -850,11 +785,9 @@ END_FUNC(STATIC) /* end H5HL__datablock_clear() */ * * Purpose: Handle cache action notifications * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2011 * *------------------------------------------------------------------------- @@ -904,8 +837,7 @@ END_FUNC(STATIC) /* end H5HL__datablock_notify() */ * and return it in *len_ptr. On failure, the value of *len_ptr * is undefined. * - * Return: Success: SUCCEED - * Failure: Can't fail + * Return: SUCCEED (Can't fail) * * Programmer: John Mainzer * 5/13/04 diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 9ff9553..13b1d79 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -32,11 +32,9 @@ * * Purpose: Prints debugging information about a heap. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke - * matzke@llnl.gov * Aug 1 1997 * *------------------------------------------------------------------------- diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c index fff35a1..8878351 100755 --- a/src/H5HLdblk.c +++ b/src/H5HLdblk.c @@ -89,7 +89,6 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -133,11 +132,9 @@ END_FUNC(PKG) /* end H5HL__dblk_new() */ * * Purpose: Destroy a local heap data block object * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -179,11 +176,9 @@ END_FUNC(PKG) /* end H5HL__dblk_dest() */ * * Purpose: Reallocate data block for heap * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- diff --git a/src/H5HLint.c b/src/H5HLint.c index c2119d3..41ded17 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -88,7 +88,6 @@ H5FL_DEFINE_STATIC(H5HL_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 5 2010 * *------------------------------------------------------------------------- @@ -129,11 +128,9 @@ END_FUNC(PKG) /* end H5HL__new() */ * * Purpose: Increment ref. count on heap * - * Return: Success: SUCCEED - * Failure: N/A + * Return: SUCCEED (Can't fail) * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -156,11 +153,9 @@ END_FUNC(PKG) /* end H5HL__inc_rc() */ * * Purpose: Decrement ref. count on heap * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -188,11 +183,9 @@ END_FUNC(PKG) /* end H5HL__dec_rc() */ * * Purpose: Destroys a heap in memory. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu * Jan 15 2003 * *------------------------------------------------------------------------- @@ -234,11 +227,9 @@ END_FUNC(PKG) /* end H5HL__dest() */ * * Purpose: Create a flush dependency between two data structure components * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2011 * *------------------------------------------------------------------------- @@ -266,11 +257,9 @@ END_FUNC(PKG) /* end H5HL__create_flush_depend() */ * * Purpose: Destroy a flush dependency between two data structure components * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Dana Robinson - * derobins@hdfgroup.org * Fall 2011 * *------------------------------------------------------------------------- diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c index 0e702cf..1f7a1a1 100755 --- a/src/H5HLprfx.c +++ b/src/H5HLprfx.c @@ -88,7 +88,6 @@ H5FL_DEFINE_STATIC(H5HL_prfx_t); * Failure: NULL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- @@ -132,11 +131,9 @@ END_FUNC(PKG) /* end H5HL__prfx_new() */ * * Purpose: Destroy a local heap prefix object * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Oct 12 2008 * *------------------------------------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index 0f78a8d..095b048 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -62,7 +62,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5FD.c H5FDcore.c \ H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ - H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ + H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ + H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ H5Gint.c H5Glink.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 597f293..c8e6fd7 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -116,40 +116,40 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5FDfamily.lo H5FDint.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \ H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo \ H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo \ - H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo \ - H5Gcache.lo H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo \ - H5Gint.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \ - H5Goh.lo H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo \ - H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \ - H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \ - H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \ - H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo \ - H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HLprfx.lo \ - H5HLdblk.lo H5HP.lo H5I.lo H5Itest.lo H5L.lo H5Lexternal.lo \ - H5lib_settings.lo H5MF.lo H5MFaggr.lo H5MFdbg.lo \ - H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo H5Oainfo.lo \ - H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \ - H5Obtreek.lo H5Ocache.lo H5Ochunk.lo H5Ocont.lo H5Ocopy.lo \ - H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo \ - H5Oflush.lo H5Ofsinfo.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo \ - H5Olink.lo H5Omessage.lo H5Omtime.lo H5Oname.lo H5Onull.lo \ - H5Opline.lo H5Orefcount.lo H5Osdspace.lo H5Oshared.lo \ - H5Oshmesg.lo H5Ostab.lo H5Ostorage.lo H5Otest.lo H5Ounknown.lo \ - H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo \ - H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo \ - H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo \ - H5Pstrcpl.lo H5Ptest.lo H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo \ - H5S.lo H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \ - H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo \ - H5SMbtree2.lo H5SMcache.lo H5SMmessage.lo H5SMtest.lo H5ST.lo \ - H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo \ - H5Tconv.lo H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo \ - H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo \ - H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo \ - H5Tprecis.lo H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo H5TS.lo \ - H5V.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \ - H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \ - H5Ztrans.lo + H5FSint.lo H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo \ + H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo H5Gdense.lo \ + H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \ + H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo H5Gstab.lo \ + H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \ + H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \ + H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \ + H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \ + H5HGcache.lo H5HGdbg.lo H5HGquery.lo H5HL.lo H5HLcache.lo \ + H5HLdbg.lo H5HLint.lo H5HLprfx.lo H5HLdblk.lo H5HP.lo H5I.lo \ + H5Itest.lo H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo \ + H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \ + H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \ + H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \ + H5Ochunk.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \ + H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oflush.lo H5Ofsinfo.lo \ + H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo \ + H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo \ + H5Osdspace.lo H5Oshared.lo H5Oshmesg.lo H5Ostab.lo \ + H5Ostorage.lo H5Otest.lo H5Ounknown.lo H5P.lo H5Pacpl.lo \ + H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo H5Pfapl.lo \ + H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo H5Plapl.lo \ + H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo \ + H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo \ + H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \ + H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo \ + H5SMmessage.lo H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo \ + H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \ + H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \ + H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \ + H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \ + H5Tvisit.lo H5Tvlen.lo H5TS.lo H5V.lo H5WB.lo H5Z.lo \ + H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ + H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -524,7 +524,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5FD.c H5FDcore.c \ H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ - H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ + H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ + H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ H5Gint.c H5Glink.c \ @@ -797,6 +798,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FScache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSdbg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSsection.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSstat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FStest.Plo@am__quote@ -- cgit v0.12