summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5B2.c335
-rw-r--r--src/H5B2cache.c152
-rw-r--r--src/H5B2dbg.c95
-rw-r--r--src/H5B2pkg.h31
-rw-r--r--src/H5B2public.h3
-rw-r--r--src/H5B2test.c68
-rw-r--r--src/H5Spkg.h3
-rw-r--r--src/H5Stest.c51
-rw-r--r--src/H5Tconv.c16
9 files changed, 296 insertions, 458 deletions
diff --git a/src/H5B2.c b/src/H5B2.c
index 7b81dbf..f1fd069 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -68,6 +68,7 @@
/********************/
/* Helper functions */
+static herr_t H5B2_shared_free(void *_shared);
static herr_t H5B2_create_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
H5B2_node_ptr_t *node_ptr);
static herr_t H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
@@ -176,13 +177,13 @@ H5B2_shared_init (H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
{
H5B2_shared_t *shared = NULL; /* Shared B-tree information */
unsigned u; /* Local index variable */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_shared_init)
/* Allocate space for the shared information */
- if(NULL==(shared = H5FL_CALLOC(H5B2_shared_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree shared information")
+ if(NULL == (shared = H5FL_CALLOC(H5B2_shared_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree shared information")
/* Assign user's information */
shared->split_percent = split_percent;
@@ -191,50 +192,50 @@ H5B2_shared_init (H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
shared->rrec_size = rrec_size;
/* Compute derived information */
- shared->internal_nrec = H5B2_NUM_INT_REC(f,shared->node_size,shared->rrec_size);
- shared->split_int_nrec = (shared->internal_nrec * shared->split_percent)/100;
- shared->merge_int_nrec = (shared->internal_nrec * shared->merge_percent)/100;
+ shared->internal_nrec = H5B2_NUM_INT_REC(f, shared->node_size, shared->rrec_size);
+ shared->split_int_nrec = (shared->internal_nrec * shared->split_percent) / 100;
+ shared->merge_int_nrec = (shared->internal_nrec * shared->merge_percent) / 100;
- shared->leaf_nrec = H5B2_NUM_LEAF_REC(shared->node_size,shared->rrec_size);
- shared->split_leaf_nrec = (shared->leaf_nrec * shared->split_percent)/100;
- shared->merge_leaf_nrec = (shared->leaf_nrec * shared->merge_percent)/100;
+ shared->leaf_nrec = H5B2_NUM_LEAF_REC(shared->node_size, shared->rrec_size);
+ shared->split_leaf_nrec = (shared->leaf_nrec * shared->split_percent) / 100;
+ shared->merge_leaf_nrec = (shared->leaf_nrec * shared->merge_percent) / 100;
/* Assign common type information */
shared->type = type;
/* Allocate "page" for node I/O */
- if((shared->page=H5FL_BLK_MALLOC(node_page,shared->node_size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if((shared->page = H5FL_BLK_MALLOC(node_page, shared->node_size)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
#ifdef H5_USING_PURIFY
HDmemset(shared->page,0,shared->node_size);
#endif /* H5_USING_PURIFY */
/* Create factory for internal node native record storage */
- if((shared->int_fac=H5FL_fac_init(type->nrec_size*shared->internal_nrec))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal node native key block factory")
+ if((shared->int_fac = H5FL_fac_init(type->nrec_size * shared->internal_nrec)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal node native key block factory")
/* Create factory for leaf node native record storage */
- if((shared->leaf_fac=H5FL_fac_init(type->nrec_size*shared->leaf_nrec))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create leaf node native key block factory")
+ if((shared->leaf_fac = H5FL_fac_init(type->nrec_size * shared->leaf_nrec)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create leaf node native key block factory")
/* Create factory for internal node node pointer storage */
- if((shared->node_ptr_fac=H5FL_fac_init(sizeof(H5B2_node_ptr_t)*(shared->internal_nrec+1)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal node node pointer block factory")
+ if((shared->node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (shared->internal_nrec + 1))) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create internal node node pointer block factory")
/* Allocate array of pointers to internal node native keys */
- if((shared->nat_off=H5FL_SEQ_MALLOC(size_t,MAX(shared->internal_nrec,shared->leaf_nrec)))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if((shared->nat_off = H5FL_SEQ_MALLOC(size_t, MAX(shared->internal_nrec, shared->leaf_nrec))) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize offsets in native key block */
- for(u=0; u<MAX(shared->internal_nrec,shared->leaf_nrec); u++)
+ for(u = 0; u < MAX(shared->internal_nrec, shared->leaf_nrec); u++)
shared->nat_off[u]=type->nrec_size*u;
/* Make shared B-tree info reference counted */
- if(NULL==(bt2->shared=H5RC_create(shared,H5B2_shared_free)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
+ if(NULL == (bt2->shared = H5RC_create(shared, H5B2_shared_free)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info")
done:
- if(ret_value<0)
+ if(ret_value < 0)
if(shared)
H5B2_shared_free(shared);
@@ -255,11 +256,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5B2_shared_free (void *_shared)
+static herr_t
+H5B2_shared_free(void *_shared)
{
H5B2_shared_t *shared = (H5B2_shared_t *)_shared;
- herr_t ret_value=SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT(H5B2_shared_free)
@@ -268,29 +269,29 @@ H5B2_shared_free (void *_shared)
/* Free the B-tree node buffer */
if(shared->page)
- H5FL_BLK_FREE(node_page,shared->page);
+ H5FL_BLK_FREE(node_page, shared->page);
/* Destroy factory for internal node native record storage */
if(shared->int_fac)
- if(H5FL_fac_term(shared->int_fac)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy internal node native key block factory")
+ if(H5FL_fac_term(shared->int_fac) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy internal node native key block factory")
/* Destroy factory for leaf node native record storage */
if(shared->leaf_fac)
- if(H5FL_fac_term(shared->leaf_fac)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy leaf node native key block factory")
+ if(H5FL_fac_term(shared->leaf_fac) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy leaf node native key block factory")
/* Destroy factory for internal node node pointer storage */
if(shared->node_ptr_fac)
- if(H5FL_fac_term(shared->node_ptr_fac)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy internal node node pointer block factory")
+ if(H5FL_fac_term(shared->node_ptr_fac) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy internal node node pointer block factory")
/* Free the array of offsets into the native key block */
if(shared->nat_off)
H5FL_SEQ_FREE(size_t,shared->nat_off);
/* Free the shared B-tree info itself */
- H5FL_FREE(H5B2_shared_t,shared);
+ H5FL_FREE(H5B2_shared_t, shared);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -309,16 +310,6 @@ done:
* koziol@ncsa.uiuc.edu
* Jan 31 2005
*
- *
- * Modifications:
- *
- * John Mainzer 6/10/05
- * Removed code setting the is_dirty field of the cache info.
- * This is no longer pemitted, as the cache code is now
- * manageing this field. Since this function uses a call to
- * H5AC_set() (which marks the entry dirty automaticly), no
- * other change is required.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -327,7 +318,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
unsigned split_percent, unsigned merge_percent, haddr_t *addr_p)
{
H5B2_t *bt2 = NULL; /* The new B-tree header information */
- herr_t ret_value=SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5B2_create, FAIL)
@@ -336,41 +327,42 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
*/
HDassert(f);
HDassert(type);
- HDassert(node_size>0);
- HDassert(rrec_size>0);
- HDassert(merge_percent>0 && merge_percent<=100);
- HDassert(split_percent>0 && split_percent<=100);
- HDassert(merge_percent<(split_percent/2));
+ HDassert(node_size > 0);
+ HDassert(rrec_size > 0);
+ HDassert(merge_percent > 0 && merge_percent <= 100);
+ HDassert(split_percent > 0 && split_percent <= 100);
+ HDassert(merge_percent < (split_percent / 2));
+ HDassert(addr_p);
/*
* Allocate file and memory data structures.
*/
- if (NULL==(bt2 = H5FL_MALLOC(H5B2_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree header")
+ if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree header")
/* Assign internal information */
- HDmemset(&bt2->cache_info,0,sizeof(H5AC_info_t));
+ HDmemset(&bt2->cache_info, 0, sizeof(H5AC_info_t));
bt2->depth = 0;
bt2->root.addr = HADDR_UNDEF;
bt2->root.node_nrec = 0;
bt2->root.all_nrec = 0;
/* Initialize shared B-tree info */
- if(H5B2_shared_init(f, bt2, type, node_size, rrec_size, split_percent, merge_percent)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create shared B-tree info")
+ if(H5B2_shared_init(f, bt2, type, node_size, rrec_size, split_percent, merge_percent) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create shared B-tree info")
/* Allocate space for the header on disk */
- if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(f))))
+ if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(f))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree header")
/* Cache the new B-tree node */
- if (H5AC_set(f, dxpl_id, H5AC_BT2_HDR, *addr_p, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_set(f, dxpl_id, H5AC_BT2_HDR, *addr_p, bt2, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree header to cache")
done:
- if (ret_value<0) {
- if (bt2)
- (void)H5B2_cache_hdr_dest(f,bt2);
+ if(ret_value < 0) {
+ if(bt2)
+ (void)H5B2_cache_hdr_dest(f, bt2);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -436,16 +428,6 @@ H5B2_locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off,
* koziol@ncsa.uiuc.edu
* Feb 3 2005
*
- * Modifications:
- *
- * John Mainzer, 6/10/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new bt2_dirtied_ptr
- * parameter to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -640,11 +622,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 9 2005
*
- * John Mainzer, 6/14/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -867,15 +844,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 9 2005
*
- * John Mainzer, 6/14/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
- * parameters to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1146,17 +1114,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 9 2005
*
- * Modifications:
- *
- * John Mainzer, 6/14/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * internal_dirtied_ptr parameter to the function's
- * argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1527,17 +1484,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 10 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
- * parameters to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1869,15 +1815,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 4 2005
*
- * John Mainzer, 6/15/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
- * parameters to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2034,17 +1971,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 4 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * parent_cache_info_dirtied_ptr and internal_dirtied_ptr
- * parameters to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2269,17 +2195,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 4 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * internal_dirtied_ptr parameter to the function's
- * argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2373,13 +2288,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 3 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2461,16 +2369,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 2 2005
*
- * Modifications:
- *
- * John Mainzer, 6/14/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new dirtied_ptr
- * parameter to the function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2614,13 +2512,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 2 2005
*
- * Modifications:
- *
- * John Mainzer, 6/10/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2698,16 +2589,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 2 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to avoid modifying the is_dirty
- * field of the cache info, as that field is now maintained
- * by the cache code. Since this function uses a call to
- * H5AC_set(), and that function presumes that the newly
- * inserted entry is dirty, we need only remove the reference
- * to the is_dirty field.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2779,16 +2660,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 3 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to avoid modifying the is_dirty
- * field of the cache info, as that field is now maintained
- * by the cache code. Since this function uses a call to
- * H5AC_set(), and that function presumes that the newly
- * inserted entry is dirty, we need only remove the reference
- * to the is_dirty field.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2870,13 +2741,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 11 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2973,13 +2837,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 11 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3059,13 +2916,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 23 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3230,13 +3080,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 23 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3409,13 +3252,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 3 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3504,17 +3340,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 3 2005
*
- * Modifications:
- *
- * John Mainzer, 6/14/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
- * In this case, that required adding the new
- * parent_cache_info_dirtied_ptr parameter to the
- * function's argument list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3724,13 +3549,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 25 2005
*
- * Modifications:
- *
- * John Mainzer, 6/15/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3802,13 +3620,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 25 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3866,13 +3677,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3966,13 +3770,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -4063,13 +3860,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 8 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4126,13 +3916,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -4209,13 +3992,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 9 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4270,13 +4046,6 @@ done:
* koziol@ncsa.uiuc.edu
* Mar 10 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 7810aae..0ad3242 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -23,14 +23,22 @@
*-------------------------------------------------------------------------
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
-/* Private headers */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5B2pkg.h" /* B-trees */
#include "H5Eprivate.h" /* Error handling */
-/* Local macros */
+/****************/
+/* Local Macros */
+/****************/
/* B-tree format version #'s */
#define H5B2_HDR_VERSION 0 /* Header */
@@ -38,9 +46,13 @@
#define H5B2_LEAF_VERSION 0 /* Leaf node */
-/* Local typedefs */
+/******************/
+/* Local Typedefs */
+/******************/
-/* Local prototypes */
+/********************/
+/* Local Prototypes */
+/********************/
/* Metadata cache callbacks */
static H5B2_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
@@ -56,7 +68,9 @@ static herr_t H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy
static herr_t H5B2_cache_internal_clear(H5F_t *f, H5B2_internal_t *i, hbool_t destroy);
static herr_t H5B2_cache_internal_size(const H5F_t *f, const H5B2_internal_t *i, size_t *size_ptr);
-/* Package variables */
+/*********************/
+/* Package Variables */
+/*********************/
/* H5B2 inherits cache-like properties from H5AC */
const H5AC_class_t H5AC_BT2_HDR[1] = {{
@@ -88,7 +102,14 @@ const H5AC_class_t H5AC_BT2_INT[1] = {{
(H5AC_size_func_t)H5B2_cache_internal_size,
}};
-/* Static variables */
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
/* Declare a free list to manage B-tree header data to/from disk */
H5FL_BLK_DEFINE_STATIC(header_block);
@@ -113,14 +134,14 @@ H5FL_BLK_DEFINE_STATIC(header_block);
static H5B2_t *
H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void UNUSED *udata)
{
- const H5B2_class_t *type = (const H5B2_class_t *) _type;
+ const H5B2_class_t *type = (const H5B2_class_t *) _type; /* Type of B-tree */
size_t node_size, rrec_size; /* Size info for B-tree */
unsigned split_percent, merge_percent; /* Split & merge info for B-tree */
- H5B2_t *bt2 = NULL;
- size_t size;
- uint8_t *buf = NULL;
+ H5B2_t *bt2 = NULL; /* B-tree info */
+ size_t size; /* Header size */
+ uint8_t *buf = NULL; /* Temporary buffer */
uint8_t *p; /* Pointer into raw data buffer */
- H5B2_t *ret_value;
+ H5B2_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5B2_cache_hdr_load, NULL)
@@ -129,68 +150,72 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
HDassert(H5F_addr_defined(addr));
HDassert(type);
- if (NULL==(bt2 = H5FL_MALLOC(H5B2_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemset(&bt2->cache_info,0,sizeof(H5AC_info_t));
+ /* Allocate space for the B-tree data structure */
+ if(NULL == (bt2 = H5FL_MALLOC(H5B2_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HDmemset(&bt2->cache_info, 0, sizeof(H5AC_info_t));
/* Compute the size of the B-tree header on disk */
size = H5B2_HEADER_SIZE(f);
/* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(header_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ if((buf = H5FL_BLK_MALLOC(header_block, size)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read header from disk */
- if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf)<0)
+ if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree header")
p = buf;
- /* magic number */
- if (HDmemcmp(p, H5B2_HDR_MAGIC, H5B2_SIZEOF_MAGIC))
+ /* Magic number */
+ if(HDmemcmp(p, H5B2_HDR_MAGIC, H5B2_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header signature")
p += H5B2_SIZEOF_MAGIC;
- /* version */
- if (*p++ != H5B2_HDR_VERSION)
+ /* Version */
+ if(*p++ != H5B2_HDR_VERSION)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header version")
+/* XXX: Add metadata flags & checksum to v2 B-tree metadata (like fractal heap) */
+
/* B-tree type */
- if (*p++ != (uint8_t)type->id)
+ if(*p++ != (uint8_t)type->id)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree type")
- /* node size (in bytes) */
+ /* Node size (in bytes) */
UINT32DECODE(p, node_size);
- /* raw key size (in bytes) */
+ /* Raw key size (in bytes) */
UINT16DECODE(p, rrec_size);
- /* depth of tree */
+ /* Depth of tree */
UINT16DECODE(p, bt2->depth);
- /* split & merge %s */
+ /* Split & merge %s */
UINT16DECODE(p, split_percent);
UINT16DECODE(p, merge_percent);
- /* root node pointer */
+ /* Root node pointer */
H5F_addr_decode(f, (const uint8_t **)&p, &(bt2->root.addr));
UINT16DECODE(p, bt2->root.node_nrec);
H5F_DECODE_LENGTH(f, p, bt2->root.all_nrec);
/* Initialize shared B-tree info */
- if(H5B2_shared_init(f, bt2, type, node_size, rrec_size, split_percent, merge_percent)<0)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "can't create shared B-tree info")
+ if(H5B2_shared_init(f, bt2, type, node_size, rrec_size, split_percent, merge_percent) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't create shared B-tree info")
/* Set return value */
ret_value = bt2;
done:
if(buf)
- H5FL_BLK_FREE(header_block,buf);
- if (!ret_value && bt2)
- (void)H5B2_cache_hdr_dest(f,bt2);
+ H5FL_BLK_FREE(header_block, buf);
+ if(!ret_value && bt2)
+ (void)H5B2_cache_hdr_dest(f, bt2);
+
FUNC_LEAVE_NOAPI(ret_value)
-} /*lint !e818 Can't make udata a pointer to const */
+} /* end H5B2_cache_hdr_load() */ /*lint !e818 Can't make udata a pointer to const */
/*-------------------------------------------------------------------------
@@ -220,62 +245,63 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B
if (bt2->cache_info.is_dirty) {
H5B2_shared_t *shared; /* Shared B-tree information */
- uint8_t *buf = NULL;
+ uint8_t *buf = NULL; /* Temporary raw data buffer */
uint8_t *p; /* Pointer into raw data buffer */
- size_t size;
+ size_t size; /* Header size on disk */
/* Get the pointer to the shared B-tree info */
- shared=H5RC_GET_OBJ(bt2->shared);
+ shared = H5RC_GET_OBJ(bt2->shared);
HDassert(shared);
/* Compute the size of the B-tree header on disk */
size = H5B2_HEADER_SIZE(f);
/* Allocate temporary buffer */
- if ((buf=H5FL_BLK_MALLOC(header_block,size))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ if((buf = H5FL_BLK_MALLOC(header_block, size)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
p = buf;
- /* magic number */
+ /* Magic number */
HDmemcpy(p, H5B2_HDR_MAGIC, H5B2_SIZEOF_MAGIC);
p += H5B2_SIZEOF_MAGIC;
- /* version # */
+ /* Version # */
*p++ = H5B2_HDR_VERSION;
- /* b-tree type */
+ /* B-tree type */
*p++ = shared->type->id;
- /* node size (in bytes) */
+ /* Node size (in bytes) */
UINT32ENCODE(p, shared->node_size);
- /* raw key size (in bytes) */
+ /* Raw key size (in bytes) */
UINT16ENCODE(p, shared->rrec_size);
- /* depth of tree */
+ /* Depth of tree */
UINT16ENCODE(p, bt2->depth);
- /* split & merge %s */
+ /* Split & merge %s */
UINT16ENCODE(p, shared->split_percent);
UINT16ENCODE(p, shared->merge_percent);
- /* root node pointer */
+ /* Root node pointer */
H5F_addr_encode(f, &p, bt2->root.addr);
UINT16ENCODE(p, bt2->root.node_nrec);
H5F_ENCODE_LENGTH(f, p, bt2->root.all_nrec);
/* Write the B-tree header. */
- if (H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
+ HDassert((p - buf) == size);
+ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree header to disk")
- H5FL_BLK_FREE(header_block,buf);
+ H5FL_BLK_FREE(header_block, buf);
bt2->cache_info.is_dirty = FALSE;
} /* end if */
- if (destroy)
- if (H5B2_cache_hdr_dest(f,bt2) < 0)
+ if(destroy)
+ if(H5B2_cache_hdr_dest(f, bt2) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree header")
done:
@@ -312,7 +338,7 @@ H5B2_cache_hdr_dest(H5F_t UNUSED *f, H5B2_t *bt2)
H5RC_DEC(bt2->shared);
/* Free B-tree header info */
- H5FL_FREE(H5B2_t,bt2);
+ H5FL_FREE(H5B2_t, bt2);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5B2_cache_hdr_dest() */
@@ -334,7 +360,7 @@ H5B2_cache_hdr_dest(H5F_t UNUSED *f, H5B2_t *bt2)
static herr_t
H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *bt2, hbool_t destroy)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_clear)
@@ -346,8 +372,8 @@ H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *bt2, hbool_t destroy)
/* Reset the dirty flag. */
bt2->cache_info.is_dirty = FALSE;
- if (destroy)
- if (H5B2_cache_hdr_dest(f, bt2) < 0)
+ if(destroy)
+ if(H5B2_cache_hdr_dest(f, bt2) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree header")
done:
@@ -421,7 +447,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
HDassert(bt2_shared);
if (NULL==(leaf = H5FL_MALLOC(H5B2_leaf_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&leaf->cache_info,0,sizeof(H5AC_info_t));
/* Share common B-tree information */
@@ -453,7 +479,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
/* Allocate space for the native keys in memory */
if((leaf->leaf_native=H5FL_FAC_MALLOC(shared->leaf_fac))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys")
/* Set the number of records in the leaf */
leaf->nrec = *nrec;
@@ -463,7 +489,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
for(u=0; u<leaf->nrec; u++) {
/* Decode record */
if((shared->type->decode)(f,p,native)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record")
/* Move to next record */
p += shared->rrec_size;
@@ -532,7 +558,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
for(u=0; u<leaf->nrec; u++) {
/* Encode record */
if((shared->type->encode)(f,p,native)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
p += shared->rrec_size;
@@ -710,7 +736,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nre
HDassert(bt2_shared);
if (NULL==(internal = H5FL_MALLOC(H5B2_internal_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&internal->cache_info,0,sizeof(H5AC_info_t));
/* Share common B-tree information */
@@ -742,11 +768,11 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nre
/* Allocate space for the native keys in memory */
if((internal->int_native=H5FL_FAC_MALLOC(shared->int_fac))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal native keys")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal native keys")
/* Allocate space for the node pointers in memory */
if((internal->node_ptrs=H5FL_FAC_MALLOC(shared->node_ptr_fac))==NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal node pointers")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal node pointers")
/* Set the number of records in the leaf */
internal->nrec = *nrec;
@@ -756,7 +782,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nre
for(u=0; u<internal->nrec; u++) {
/* Decode record */
if((shared->type->decode)(f,p,native)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record")
/* Move to next record */
p += shared->rrec_size;
@@ -838,7 +864,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
for(u=0; u<internal->nrec; u++) {
/* Encode record */
if((shared->type->encode)(f,p,native)<0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record");
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record")
/* Move to next record */
p += shared->rrec_size;
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index 98abd60..687c731 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -23,14 +23,49 @@
*-------------------------------------------------------------------------
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
-/* Private headers */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5B2pkg.h" /* B-trees */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5B2_hdr_debug
@@ -43,50 +78,46 @@
* koziol@ncsa.uiuc.edu
* Feb 2 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth,
const H5B2_class_t *type)
{
- H5B2_t *bt2 = NULL;
- H5B2_shared_t *shared; /* Shared B-tree information */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5B2_t *bt2 = NULL; /* B-tree header info */
+ H5B2_shared_t *shared; /* Shared B-tree information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5B2_hdr_debug, FAIL)
/*
* Check arguments.
*/
- assert(f);
- assert(H5F_addr_defined(addr));
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
+ HDassert(f);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
/*
- * Load the b-tree header.
+ * Load the B-tree header.
*/
- if (NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
+ if(NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
/* Get the pointer to the shared B-tree info */
- shared=H5RC_GET_OBJ(bt2->shared);
- assert(shared);
+ shared = H5RC_GET_OBJ(bt2->shared);
+ HDassert(shared);
+
+ /* Print opening message */
+ HDfprintf(stream, "%*sv2 B-tree Header...\n", indent, "");
/*
* Print the values.
*/
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Tree type ID:",
- ((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" :
+ ((shared->type->id) == H5B2_TEST_ID ? "H5B2_TEST_ID" :
"Unknown!"));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
@@ -135,7 +166,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
shared->merge_leaf_nrec);
done:
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
FUNC_LEAVE_NOAPI(ret_value)
@@ -153,13 +184,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 4 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -205,6 +229,9 @@ H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
bt2 = NULL;
+ /* Print opening message */
+ HDfprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, "");
+
/*
* Print the values.
*/
@@ -271,13 +298,6 @@ done:
* koziol@ncsa.uiuc.edu
* Feb 7 2005
*
- * Modifications:
- *
- * John Mainzer, 6/16/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -323,6 +343,9 @@ H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
bt2 = NULL;
+ /* Print opening message */
+ HDfprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, "");
+
/*
* Print the values.
*/
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index b49ed45..4abf5aa 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -55,15 +55,15 @@
/* Size of the B-tree header on disk */
#define H5B2_HEADER_SIZE(f) ( \
- 4 + /* Signature */ \
- 1 + /* Version */ \
- 1 + /* Tree type */ \
- 4 + /* Node size, in bytes */ \
- 2 + /* Key size, in bytes */ \
- 2 + /* Depth of tree */ \
- 2 + /* Split % of full (as integer, ie. "98" means 98%) */ \
- 2 + /* Merge % of full (as integer, ie. "98" means 98%) */ \
- H5B2_NODE_POINTER_SIZE(f)) /* Node pointer to root node in tree */
+ 4 /* Signature */ \
+ + 1 /* Version */ \
+ + 1 /* Tree type */ \
+ + 4 /* Node size, in bytes */ \
+ + 2 /* Key size, in bytes */ \
+ + 2 /* Depth of tree */ \
+ + 2 /* Split % of full (as integer, ie. "98" means 98%) */ \
+ + 2 /* Merge % of full (as integer, ie. "98" means 98%) */ \
+ + H5B2_NODE_POINTER_SIZE(f)) /* Node pointer to root node in tree */
/* Macro to retrieve pointer to i'th native record for native record buffer */
#define H5B2_NAT_NREC(b,shared,idx) (b+(shared)->nat_off[(idx)])
@@ -179,12 +179,17 @@ H5_DLLVAR const H5B2_class_t H5B2_TEST[1];
/******************************/
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5B2_shared_free (void *_shared);
-H5_DLL herr_t H5B2_shared_init (H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
+
+/* Routines for managing shared B-tree info */
+H5_DLL herr_t H5B2_shared_init(H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type,
size_t node_size, size_t rrec_size, unsigned split_percent, unsigned merge_percent);
+
+/* Metadata cache callbacks */
H5_DLL herr_t H5B2_cache_hdr_dest(H5F_t *f, H5B2_t *b);
H5_DLL herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *l);
H5_DLL herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *i);
+
+/* Debugging routines for dumping file structures */
H5_DLL herr_t H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth, const H5B2_class_t *type);
H5_DLL herr_t H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
@@ -193,8 +198,10 @@ H5_DLL herr_t H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
H5_DLL herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth, const H5B2_class_t *type,
haddr_t hdr_addr, unsigned nrec);
+
+/* Testing routines */
#ifdef H5B2_TESTING
-H5_DLL herr_t H5B2_get_root_addr(H5F_t *f, hid_t dxpl_id,
+H5_DLL herr_t H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id,
const H5B2_class_t *type, haddr_t addr, haddr_t *root_addr);
#endif /* H5B2_TESTING */
diff --git a/src/H5B2public.h b/src/H5B2public.h
index 55a866b..d48aa43 100644
--- a/src/H5B2public.h
+++ b/src/H5B2public.h
@@ -18,10 +18,11 @@
* Jan 31 2005
* Quincey Koziol <koziol@ncsa.uiuc.edu>
*
- * Purpose: Public declarations for the H5B2 package.
+ * Purpose: Public declarations for the v2 B-tree package.
*
*-------------------------------------------------------------------------
*/
+
#ifndef _H5B2public_H
#define _H5B2public_H
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 0428b35..26924e7 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -18,15 +18,33 @@
* Purpose: v2 B-tree testing functions.
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
-/* Private headers */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5B2pkg.h" /* B-trees */
#include "H5Eprivate.h" /* Error handling */
-/* Static Prototypes */
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
static herr_t H5B2_test_store(void *nrecord, const void *udata);
static herr_t H5B2_test_retrieve(void *udata, const void *nrecord);
static herr_t H5B2_test_compare(const void *rec1, const void *rec2);
@@ -37,7 +55,9 @@ static herr_t H5B2_test_decode(const H5F_t *f, const uint8_t *raw,
static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
-/* Package variables */
+/*********************/
+/* Package Variables */
+/*********************/
const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2_TEST_ID, /* Type of B-tree */
sizeof(hsize_t), /* Size of native key */
@@ -49,6 +69,15 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2_test_debug /* Record debugging callback */
}};
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5B2_test_store
@@ -62,8 +91,6 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
* Programmer: Quincey Koziol
* Thursday, February 3, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -89,8 +116,6 @@ H5B2_test_store(void *nrecord, const void *udata)
* Programmer: Quincey Koziol
* Friday, February 25, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -116,8 +141,6 @@ H5B2_test_retrieve(void *udata, const void *nrecord)
* Programmer: Quincey Koziol
* Thursday, February 3, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -141,8 +164,6 @@ H5B2_test_compare(const void *rec1, const void *rec2)
* Programmer: Quincey Koziol
* Thursday, February 3, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -168,8 +189,6 @@ H5B2_test_encode(const H5F_t *f, uint8_t *raw, const void *nrecord)
* Programmer: Quincey Koziol
* Friday, February 4, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -195,8 +214,6 @@ H5B2_test_decode(const H5F_t *f, const uint8_t *raw, void *nrecord)
* Programmer: Quincey Koziol
* Friday, February 4, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -226,23 +243,16 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i
* Programmer: Quincey Koziol
* Saturday, February 26, 2005
*
- * Modifications:
- *
- * John Mainzer, 6/17/05
- * Modified the function to use the new dirtied parameter of
- * of H5AC_unprotect() instead of modifying the is_dirty
- * field of the cache info.
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_root_addr(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
+H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
haddr_t addr, haddr_t *root_addr)
{
- H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED;
+ H5B2_t *bt2 = NULL; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5B2_get_root_addr)
+ FUNC_ENTER_NOAPI_NOINIT(H5B2_get_root_addr_test)
/* Check arguments. */
HDassert(f);
@@ -251,7 +261,7 @@ H5B2_get_root_addr(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
HDassert(root_addr);
/* Look up the B-tree header */
- if (NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_WRITE)))
+ if(NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, type, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
/* Get B-tree root addr */
@@ -259,9 +269,9 @@ H5B2_get_root_addr(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
done:
/* Release B-tree header node */
- if (bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ if(bt2 && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, bt2, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_get_root_addr() */
+} /* H5B2_get_root_addr_test() */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 69330c5..8764fb6 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -220,7 +220,8 @@ H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src);
/* Testing functions */
#ifdef H5S_TESTING
H5_DLL htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2);
-H5_DLL htri_t H5S_inquiry_rebuild_status(hid_t space_id);
+H5_DLL htri_t H5S_get_rebuild_status_test(hid_t space_id);
#endif /* H5S_TESTING */
#endif /*_H5Spkg_H*/
+
diff --git a/src/H5Stest.c b/src/H5Stest.c
index 6df626c..5a1d2b0 100644
--- a/src/H5Stest.c
+++ b/src/H5Stest.c
@@ -44,39 +44,39 @@
dimensionality and shape.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path()
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
H5S_select_shape_same_test(hid_t sid1, hid_t sid2)
{
- H5S_t *space1 = NULL; /* Pointer to 1st dataspace */
- H5S_t *space2 = NULL; /* Pointer to 2nd dataspace */
- htri_t ret_value; /* return value */
+ H5S_t *space1 = NULL; /* Pointer to 1st dataspace */
+ H5S_t *space2 = NULL; /* Pointer to 2nd dataspace */
+ htri_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_shape_same_test, FAIL);
+ FUNC_ENTER_NOAPI(H5S_select_shape_same_test, FAIL)
/* Get dataspace structures */
- if (NULL == (space1=H5I_object_verify(sid1, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
- if (NULL == (space2=H5I_object_verify(sid2, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
+ if(NULL == (space1 = H5I_object_verify(sid1, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(NULL == (space2 = H5I_object_verify(sid2, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Check if the dataspace selections are the same shape */
- if ((ret_value=H5S_select_shape_same(space1,space2))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "unable to compare dataspace selections");
+ if((ret_value = H5S_select_shape_same(space1, space2)) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "unable to compare dataspace selections")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_select_shape_same_test() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S_select_shape_same_test() */
/*--------------------------------------------------------------------------
NAME
- H5S_inquiry_rebuild_status
+ H5S_get_rebuild_status_test
PURPOSE
- Determine the status of rebuild
+ Determine the status of hyperslab rebuild
USAGE
htri_t H5S_inquiry_rebuild_status(hid_t space_id)
hid_t space_id; IN: dataspace id
@@ -86,24 +86,25 @@ done:
Query the status of rebuilding the hyperslab
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
- DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING H5P_get_class_path()
+ DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_inquiry_rebuild_status(hid_t space_id)
+H5S_get_rebuild_status_test(hid_t space_id)
{
- static htri_t ret_value = FAIL; /* return value */
+ H5S_t *space = NULL; /* Pointer to 1st dataspace */
+ htri_t ret_value; /* Return value */
- H5S_t *space1 = NULL; /* Pointer to 1st dataspace */
+ FUNC_ENTER_NOAPI(H5S_get_rebuild_status_test, FAIL)
- FUNC_ENTER_NOAPI(H5S_inquiry_rebuild_status, FAIL);
/* Get dataspace structures */
-if (NULL == (space1=H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
+ if(NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- ret_value= space1->select.sel_info.hslab->diminfo_valid;
+ ret_value = space->select.sel_info.hslab->diminfo_valid;
done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_inquiry_rebuild_status() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5S_get_rebuild_status_test() */
+
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 32f647e..be72c81 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -18,15 +18,15 @@
#define H5T_PACKAGE /*suppress error about including H5Tpkg */
-#include "H5private.h" /*generic functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5FLprivate.h" /*Free Lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
#include "H5HGprivate.h" /* Global Heaps */
-#include "H5Iprivate.h" /*ID functions */
-#include "H5MMprivate.h" /*memory management */
-#include "H5Pprivate.h" /* Property Lists */
-#include "H5Dprivate.h" /* Dataset */
-#include "H5Tpkg.h" /*data-type functions */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Tpkg.h" /* Datatypes */
/* Conversion data for H5T_conv_struct() */
typedef struct H5T_conv_struct_t {