diff options
42 files changed, 1282 insertions, 699 deletions
@@ -223,7 +223,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, H5S_t *space; /* Dataspace to use for attribute */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Acreate2, loc_id, FAIL) + FUNC_ENTER_API_META(H5Acreate2, loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("i", "i*siiii", loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); /* check arguments */ @@ -294,7 +294,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5S_t *space; /* Dataspace to use for attribute */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Acreate_by_name, loc_id, FAIL) + FUNC_ENTER_API_META(H5Acreate_by_name, loc_id, H5AC_dxpl_id, FAIL) H5TRACE8("i", "i*s*siiiii", loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); @@ -912,7 +912,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) const H5T_t *mem_type = NULL; herr_t ret_value; - FUNC_ENTER_API_META(H5Awrite, attr_id, FAIL) + FUNC_ENTER_API_META(H5Awrite, attr_id, H5AC_dxpl_id, FAIL) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); /* check arguments */ @@ -1734,7 +1734,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) H5G_loc_t loc; /* Object location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Arename, loc_id, FAIL) + FUNC_ENTER_API_META(H5Arename, loc_id, H5AC_dxpl_id, FAIL) H5TRACE3("e", "i*s*s", loc_id, old_name, new_name); /* check arguments */ @@ -1780,7 +1780,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Arename_by_name, loc_id, FAIL) + FUNC_ENTER_API_META(H5Arename_by_name, loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("e", "i*s*s*si", loc_id, obj_name, old_attr_name, new_attr_name, lapl_id); @@ -2046,7 +2046,7 @@ H5Adelete(hid_t loc_id, const char *name) H5G_loc_t loc; /* Object location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Adelete, loc_id, FAIL) + FUNC_ENTER_API_META(H5Adelete, loc_id, H5AC_dxpl_id, FAIL) H5TRACE2("e", "i*s", loc_id, name); /* check arguments */ @@ -2093,7 +2093,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Adelete_by_name, loc_id, FAIL) + FUNC_ENTER_API_META(H5Adelete_by_name, loc_id, H5AC_dxpl_id, FAIL) H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id); /* check arguments */ @@ -2169,7 +2169,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Adelete_by_idx, loc_id, FAIL) + FUNC_ENTER_API_META(H5Adelete_by_idx, loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "i*sIiIohi", loc_id, obj_name, idx_type, order, n, lapl_id); /* check arguments */ @@ -2232,7 +2232,7 @@ H5Aclose(hid_t attr_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Aclose, attr_id, FAIL) + FUNC_ENTER_API_META(H5Aclose, attr_id, H5AC_dxpl_id, FAIL) H5TRACE1("e", "i", attr_id); /* check arguments */ diff --git a/src/H5AC2.c b/src/H5AC2.c index dfe3671..2d79e9b 100644 --- a/src/H5AC2.c +++ b/src/H5AC2.c @@ -1171,6 +1171,7 @@ H5AC2_end_transaction(hbool_t do_transaction, H5O_loc_t * id_oloc_ptr, hbool_t id_oloc_open, hbool_t transaction_begun, + hid_t dxpl_id, uint64_t trans_num, const char * api_call_name) { @@ -1218,7 +1219,8 @@ H5AC2_end_transaction(hbool_t do_transaction, cache_ptr = f->shared->cache2; - result = H5C2_end_transaction(f, cache_ptr, trans_num, api_call_name); + result = H5C2_end_transaction(f, dxpl_id, cache_ptr, + trans_num, api_call_name); if ( result < 0 ) { diff --git a/src/H5AC2private.h b/src/H5AC2private.h index af4ffa2..cdbe177 100644 --- a/src/H5AC2private.h +++ b/src/H5AC2private.h @@ -307,6 +307,7 @@ H5_DLL herr_t H5AC2_end_transaction(hbool_t do_transaction, struct H5O_loc_t * id_oloc_ptr, hbool_t id_oloc_open, hbool_t transaction_begun, + hid_t dxpl_id, uint64_t trans_num, const char * api_call_name); diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 8569bd4..18fc05b 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -144,7 +144,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5S_t *space; /* Dataspace to use for attribute */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Acreate1, loc_id, FAIL) + FUNC_ENTER_API_META(H5Acreate1, loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, plist_id); /* check arguments */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index ee6c859..1f51eae 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -66,23 +66,23 @@ /* Metadata cache callbacks */ static void *H5B2_cache_hdr_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5B2_cache_hdr_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); +static herr_t H5B2_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5B2_cache_hdr_free_icr(haddr_t addr, size_t len, void *thing); static void *H5B2_cache_internal_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5B2_cache_internal_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); +static herr_t H5B2_cache_internal_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5B2_cache_internal_free_icr(haddr_t addr, size_t len, void *thing); static void *H5B2_cache_leaf_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5B2_cache_leaf_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); +static herr_t H5B2_cache_leaf_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5B2_cache_leaf_free_icr(haddr_t addr, size_t len, void *thing); /*********************/ @@ -271,8 +271,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_cache_hdr_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, +H5B2_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5B2_t *bt2 = (H5B2_t *)_thing; /* Pointer to the b-tree header */ @@ -531,9 +532,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_cache_internal_serialize(const H5F_t *f, haddr_t UNUSED addr, - size_t UNUSED len, void *image, void *_thing, unsigned *flags, - haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) +H5B2_cache_internal_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, + void UNUSED **new_image) { H5B2_shared_t *shared; /* Shared B-tree information */ uint8_t *p; /* Pointer into raw data buffer */ @@ -779,9 +781,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2_cache_leaf_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5B2_cache_leaf_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, + void UNUSED **new_image) { H5B2_shared_t *shared; /* Shared B-tree information */ uint8_t *p; /* Pointer into raw data buffer */ diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 92c8eb0..951068b 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -56,8 +56,9 @@ /* Metadata cache callbacks */ static void *H5B_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5B_serialize(const H5F_t *f, haddr_t addr, size_t len, void *image, - void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); +static herr_t H5B_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, + size_t *new_len, void **new_image); static herr_t H5B_free_icr(haddr_t addr, size_t len, void *thing); @@ -203,9 +204,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, void *image, - void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, - void UNUSED **new_image) +H5B_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, + size_t UNUSED len, void *image, void *_thing, unsigned *flags, + haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5B_t *bt = (H5B_t *)_thing; /* Pointer to the B-tree node */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ @@ -113,6 +113,26 @@ /* + * #defines controlling debugging code. All should be turned off + * before checkin. + */ + +#define H5C2_PRINT_ENTRY_POINTS FALSE + +#if H5C2_PRINT_ENTRY_POINTS +#define H5C2_PRINT_EXIT_POINTS TRUE +#define H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(i) \ + ( ( (i) == H5AC2_FHEAP_HDR_ID ) || \ + ( (i) == H5AC2_FHEAP_DBLOCK_ID ) || \ + ( (i) == H5AC2_FHEAP_IBLOCK_ID ) ) +#else /* H5C2_PRINT_ENTRY_POINTS */ +#define H5C2_PRINT_EXIT_POINTS FALSE +#endif /* H5C2_PRINT_ENTRY_POINTS */ + + + + +/* * Private file-scope variables. */ @@ -212,6 +232,7 @@ static void * H5C2_epoch_marker_deserialize(haddr_t addr, static herr_t H5C2_epoch_marker_image_len(const void * thing, size_t *image_len_ptr); static herr_t H5C2_epoch_marker_serialize(const H5F_t *f, + hid_t dxpl_id, haddr_t addr, size_t len, void * image_ptr, @@ -284,6 +305,7 @@ done: static herr_t H5C2_epoch_marker_serialize(const H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, haddr_t UNUSED addr, size_t UNUSED len, void UNUSED * image_ptr, @@ -1108,6 +1130,14 @@ H5C2_expunge_entry(H5F_t * f, FUNC_ENTER_NOAPI(H5C2_expunge_entry, FAIL) +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) + { + HDfprintf(stdout, "%s: addr = 0x%lX, type = %s.\n", + FUNC, (unsigned long)addr, type->name); + } +#endif /* H5C2_PRINT_ENTRY_POINTS */ + HDassert( f ); HDassert( f->shared ); @@ -1207,6 +1237,13 @@ done: } #endif /* H5C2_DO_EXTREME_SANITY_CHECKS */ +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_expunge_entry() */ @@ -1358,6 +1395,10 @@ H5C2_flush_cache(const H5F_t *f, FUNC_ENTER_NOAPI(H5C2_flush_cache, FAIL) +#if H5C2_PRINT_ENTRY_POINTS + HDfprintf(stdout, "%s: flags = 0x%x.\n", FUNC, flags); +#endif /* H5C2_PRINT_ENTRY_POINTS */ + HDassert( f ); HDassert( f->shared ); @@ -1696,6 +1737,11 @@ done: cache_ptr->flush_in_progress = FALSE; +#if H5C2_PRINT_EXIT_POINTS + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_flush_cache() */ @@ -2456,6 +2502,14 @@ H5C2_insert_entry(H5F_t * f, FUNC_ENTER_NOAPI(H5C2_insert_entry, FAIL) +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) + { + HDfprintf(stdout, "%s: addr = 0x%lX, len = %d, type = %s.\n", FUNC, + (unsigned long)addr, (int)len, type->name); + } +#endif /* JRM */ + HDassert( f ); HDassert( f->shared ); @@ -2703,6 +2757,14 @@ done: } #endif /* H5C2_DO_EXTREME_SANITY_CHECKS */ +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_insert_entry() */ @@ -3097,6 +3159,17 @@ H5C2_mark_pinned_entry_dirty(void * thing, entry_ptr = (H5C2_cache_entry_t *)thing; + +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) + { + HDfprintf(stdout, + "%s: addr = 0x%lX, size_changed = %d, new_size = %d.\n", + FUNC, (unsigned long)(entry_ptr->addr), (int)size_changed, + (int)new_size); + } +#endif /* JRM */ + if ( ! ( entry_ptr->is_pinned ) ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \ @@ -3188,6 +3261,13 @@ H5C2_mark_pinned_entry_dirty(void * thing, done: +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_mark_pinned_entry_dirty() */ @@ -3254,8 +3334,16 @@ H5C2_mark_pinned_or_protected_entry_dirty(void * thing) entry_ptr = (H5C2_cache_entry_t *)thing; +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) + { + HDfprintf(stdout, "%s: addr = 0x%lX, type = %s.\n", FUNC, + (unsigned long)(entry_ptr->addr), entry_ptr->type->name); + } +#endif /* JRM */ + if ( entry_ptr->is_protected ) { -#if 1 /* JRM - uncomment this when possible */ +#if 0 /* JRM - uncomment this when possible */ HDassert( ! ((entry_ptr)->is_read_only) ); #endif /* set the dirtied flag */ @@ -3292,6 +3380,13 @@ H5C2_mark_pinned_or_protected_entry_dirty(void * thing) done: +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_mark_pinned_or_protected_entry_dirty() */ @@ -3371,6 +3466,15 @@ H5C2_rename_entry(H5C2_t * cache_ptr, FUNC_ENTER_NOAPI(H5C2_rename_entry, FAIL) +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) + { + HDfprintf(stdout, "%s: type = %s, old_addr = 0x%lX, new_addr = 0x%lx.\n", + FUNC, type->name, (unsigned long)old_addr, + (unsigned long)new_addr); + } +#endif /* JRM */ + HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); HDassert( type ); @@ -3533,6 +3637,13 @@ done: } #endif /* H5C2_DO_EXTREME_SANITY_CHECKS */ +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_rename_entry() */ @@ -3580,6 +3691,15 @@ H5C2_resize_pinned_entry(void * thing, HDassert( entry_ptr ); HDassert( H5F_addr_defined(entry_ptr->addr) ); +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) + { + HDfprintf(stdout, "%s: type = %s, addr = 0x%lX, new_size = %d.\n", + FUNC, entry_ptr->type->name, (unsigned long)(entry_ptr->addr), + (int)new_size); + } +#endif /* JRM */ + cache_ptr = entry_ptr->cache_ptr; HDassert( cache_ptr ); @@ -3688,6 +3808,13 @@ H5C2_resize_pinned_entry(void * thing, done: +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_resize_pinned_entry() */ @@ -3739,6 +3866,14 @@ H5C2_pin_protected_entry(void * thing) FUNC_ENTER_NOAPI(H5C2_pin_protected_entry, FAIL) +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) + { + HDfprintf(stdout, "%s: addr = 0x%lX, type = %s.\n", FUNC, + (unsigned long)(entry_ptr->addr), entry_ptr->type->name); + } +#endif /* JRM */ + HDassert( entry_ptr ); HDassert( H5F_addr_defined(entry_ptr->addr) ); @@ -3763,6 +3898,13 @@ H5C2_pin_protected_entry(void * thing) done: +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_pin_protected_entry() */ @@ -3890,6 +4032,15 @@ H5C2_protect(H5F_t * f, FUNC_ENTER_NOAPI(H5C2_protect, NULL) +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) + { + HDfprintf(stdout, + "%s: addr = 0x%lX, len = %d, type = %s, flags = 0x%x.\n", + FUNC, (unsigned long)addr, (int)len, type->name, flags); + } +#endif /* JRM */ + /* check args */ HDassert( f ); HDassert( f->shared ); @@ -4229,6 +4380,13 @@ done: } #endif /* H5C2_DO_EXTREME_SANITY_CHECKS */ +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = 0x%lX.\n", + FUNC, (unsigned long)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_protect() */ @@ -5363,6 +5521,14 @@ H5C2_unpin_entry(void *_entry_ptr) FUNC_ENTER_NOAPI(H5C2_unpin_entry, FAIL) +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) + { + HDfprintf(stdout, "%s: addr = 0x%lX, type = %s.\n", FUNC, + (unsigned long)(entry_ptr->addr), entry_ptr->type->name); + } +#endif /* JRM */ + HDassert( entry_ptr ); cache_ptr = entry_ptr->cache_ptr; @@ -5386,6 +5552,13 @@ H5C2_unpin_entry(void *_entry_ptr) done: +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(entry_ptr->type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_unpin_entry() */ @@ -5522,6 +5695,15 @@ H5C2_unprotect(H5F_t * f, FUNC_ENTER_NOAPI(H5C2_unprotect, FAIL) +#if H5C2_PRINT_ENTRY_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) + { + HDfprintf(stdout, + "%s: addr = 0x%lX, type = %s, flags = 0x%x, new_size = %d.\n", + FUNC, (unsigned long)addr, type->name, flags, (int)new_size); + } +#endif /* JRM */ + deleted = ( (flags & H5C2__DELETED_FLAG) != 0 ); dirtied = ( (flags & H5C2__DIRTIED_FLAG) != 0 ); set_flush_marker = ( (flags & H5C2__SET_FLUSH_MARKER_FLAG) != 0 ); @@ -5893,6 +6075,13 @@ done: } #endif /* H5C2_DO_EXTREME_SANITY_CHECKS */ +#if H5C2_PRINT_EXIT_POINTS + if ( H5C2_PRINT_ENTRY_POINT_TARGET_TYPE(type->id) ) { + HDfprintf(stdout, "%s: Exiting with result = %d.\n", + FUNC, (int)ret_value); + } +#endif /* H5C2_PRINT_EXIT_POINTS */ + FUNC_LEAVE_NOAPI(ret_value) } /* H5C2_unprotect() */ @@ -8567,6 +8756,7 @@ H5C2_flush_single_entry(const H5F_t * f, if ( ! ( entry_ptr->image_up_to_date ) ) { if ( entry_ptr->type->serialize(f, + dxpl_id, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr, @@ -8824,6 +9014,10 @@ H5C2_flush_single_entry(const H5F_t * f, entry_ptr->magic = H5C2__H5C2_CACHE_ENTRY_T_BAD_MAGIC; #endif /* NDEBUG */ entry_ptr->cache_ptr = NULL; +#if 0 /* JRM */ + HDfprintf(stdout, "%s: calling free_icr(%d -- %s).\n", FUNC, + type_ptr->id, type_ptr->name); +#endif /* JRM */ if ( type_ptr->free_icr(entry_ptr->addr, entry_ptr->size, (void *)entry_ptr) != SUCCEED ) { diff --git a/src/H5C2journal.c b/src/H5C2journal.c index 008f698..2908428 100644 --- a/src/H5C2journal.c +++ b/src/H5C2journal.c @@ -421,6 +421,7 @@ done: herr_t H5C2_end_transaction(H5F_t * f, + hid_t dxpl_id, H5C2_t * cache_ptr, uint64_t trans_num, const char * api_call_name) @@ -466,7 +467,7 @@ H5C2_end_transaction(H5F_t * f, */ if ( cache_ptr->tl_len > 0 ) { - result = H5C2_journal_transaction(f, cache_ptr); + result = H5C2_journal_transaction(f, dxpl_id, cache_ptr); if ( result != SUCCEED ) { @@ -785,6 +786,7 @@ done: herr_t H5C2_journal_transaction(H5F_t * f, + hid_t dxpl_id, H5C2_t * cache_ptr) { @@ -878,6 +880,7 @@ H5C2_journal_transaction(H5F_t * f, if ( ! ( entry_ptr->image_up_to_date ) ) { result = entry_ptr->type->serialize(f, + dxpl_id, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr, @@ -920,11 +923,11 @@ H5C2_journal_transaction(H5F_t * f, if ( resized ) { - /* in the following protect/unprotect, use default - * dxpl_id as we know that the entry is in cache, + /* in the following protect/unprotect, the dxpl_id + * is irrelement, as we know that the entry is in cache, * and thus no I/O will take place. */ - thing = H5C2_protect(f, H5P_DATASET_XFER_DEFAULT, + thing = H5C2_protect(f, dxpl_id, entry_ptr->type, entry_ptr->addr, entry_ptr->size, NULL, H5C2__NO_FLAGS_SET); @@ -939,7 +942,7 @@ H5C2_journal_transaction(H5F_t * f, "H5C2_protect() failed.") } - result = H5C2_unprotect(f, H5P_DATASET_XFER_DEFAULT, + result = H5C2_unprotect(f, dxpl_id, entry_ptr->type, entry_ptr->addr, thing, H5C2__SIZE_CHANGED_FLAG, new_len); @@ -3806,7 +3809,7 @@ H5C2_jb__eoa(H5C2_jbrb_t * struct_ptr, } /* end if */ /* Write EOA message */ - HDsnprintf(temp, temp_len, "E eoa_value 0x%lx", eoa); + HDsnprintf(temp, temp_len, "E eoa_value 0x%llx", eoa); if ( H5C2_jb__write_to_buffer(struct_ptr, HDstrlen(temp), temp, FALSE, struct_ptr->cur_trans ) < 0 ) { diff --git a/src/H5C2private.h b/src/H5C2private.h index 3f7502f..ba6d751 100644 --- a/src/H5C2private.h +++ b/src/H5C2private.h @@ -230,7 +230,9 @@ typedef struct H5C2_t H5C2_t; * * The typedef for the serialize callback is as follows: * - * typedef herr_t (*H5C_serialize_func_t)(haddr_t addr, + * typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f, + * hid_t dxpl_id, + * haddr_t addr, * size_t len, * void * image_ptr, * void * thing, @@ -241,6 +243,15 @@ typedef struct H5C2_t H5C2_t; * * The parameters of the serialize callback are as follows: * + * f: File pointer -- needed if other metadata cache entries + * must be modified in the process of serializing the + * target entry. + * + * dxpl_id: dxpl_id passed with the file pointer to the cache, and + * passed on to the callback. Necessary as some callbacks + * revise the size and location of the target entry, or + * possibly other entries on serialize. + * * addr: Base address in file of the entry to be serialized. * * This parameter is supplied mainly for sanity checking. @@ -451,6 +462,7 @@ typedef herr_t (*H5C2_image_len_func_t)(const void *thing, #define H5C2__SERIALIZE_RENAMED_FLAG 0x2 typedef herr_t (*H5C2_serialize_func_t)(const H5F_t *f, + hid_t dxpl_id, haddr_t addr, size_t len, void * image_ptr, @@ -1549,6 +1561,7 @@ H5_DLL herr_t H5C2_end_journaling(H5F_t * f, H5C2_t * cache_ptr); H5_DLL herr_t H5C2_end_transaction(H5F_t * f, + hid_t dxpl_id, H5C2_t * cache_ptr, uint64_t trans_num, const char * api_call_name); @@ -1562,6 +1575,7 @@ H5_DLL herr_t H5C2_journal_post_flush(H5C2_t * cache_ptr, H5_DLL herr_t H5C2_journal_pre_flush(H5C2_t * cache_ptr); H5_DLL herr_t H5C2_journal_transaction(H5F_t * f, + hid_t dxpl_id, H5C2_t * cache_ptr); H5_DLL herr_t H5C2_update_for_new_last_trans_on_disk(H5C2_t * cache_ptr, @@ -134,7 +134,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, const H5S_t *space; /* Dataspace for dataset */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Dcreate2, loc_id, FAIL) + FUNC_ENTER_API_META(H5Dcreate2, loc_id, H5AC_dxpl_id, FAIL) H5TRACE7("i", "i*siiiii", loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); @@ -227,7 +227,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, const H5S_t *space; /* Dataspace for dataset */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Dcreate_anon, loc_id, FAIL) + FUNC_ENTER_API_META(H5Dcreate_anon, loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("i", "iiiii", loc_id, type_id, space_id, dcpl_id, dapl_id); /* Check arguments */ @@ -373,7 +373,7 @@ H5Dclose(hid_t dset_id) H5D_t *dset; /* Dataset object to release */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Dclose, dset_id, FAIL) + FUNC_ENTER_API_META(H5Dclose, dset_id, H5AC_dxpl_id, FAIL) H5TRACE1("e", "i", dset_id); /* Check args */ @@ -995,7 +995,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) H5D_t *dset; /* Dataset for this operation */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Dset_extent, dset_id, FAIL) + FUNC_ENTER_API_META(H5Dset_extent, dset_id, H5AC_dxpl_id, FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 2a1eb82..ff45d63 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -148,7 +148,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, const H5S_t *space; /* Dataspace for dataset */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Dcreate1, loc_id, FAIL) + FUNC_ENTER_API_META(H5Dcreate1, loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id); /* Check arguments */ @@ -285,7 +285,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) H5D_t *dset; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Dextend, dset_id, FAIL) + FUNC_ENTER_API_META(H5Dextend, dset_id, H5AC_dxpl_id, FAIL) H5TRACE2("e", "i*h", dset_id, size); /* Check args */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 4013f15..bdbc560 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -221,7 +221,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, char fake_char; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Dwrite, dset_id, FAIL) + FUNC_ENTER_API_META(H5Dwrite, dset_id, dxpl_id, FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); diff --git a/src/H5FScache.c b/src/H5FScache.c index 52ac27d..558405f 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -77,16 +77,16 @@ static herr_t H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void * /* Metadata cache callbacks */ static void *H5FS_cache_hdr_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5FS_cache_hdr_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); +static herr_t H5FS_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5FS_cache_hdr_free_icr(haddr_t addr, size_t len, void *thing); static void *H5FS_cache_sinfo_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5FS_cache_sinfo_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); +static herr_t H5FS_cache_sinfo_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5FS_cache_sinfo_free_icr(haddr_t addr, size_t len, void *thing); /*********************/ @@ -286,9 +286,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_cache_hdr_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5FS_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, + void UNUSED **new_image) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to free space header */ uint8_t *p; /* Pointer into raw data buffer */ @@ -747,9 +748,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS_cache_sinfo_serialize(const H5F_t * f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5FS_cache_sinfo_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t UNUSED addr, + size_t UNUSED len, void *image, void *_thing, unsigned *flags, + haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { herr_t ret_value = SUCCEED; /* Return value */ H5FS_sinfo_t * sinfo = (H5FS_sinfo_t *)_thing; diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 7eee769..0181c6f 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -488,7 +488,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) * Also we must work out how we are going to deal with journaling * in such cases. */ - FUNC_ENTER_API_META(H5Fmount, loc_id, FAIL) + FUNC_ENTER_API_META(H5Fmount, loc_id, H5AC_dxpl_id, FAIL) H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id); /* Check arguments */ @@ -543,7 +543,7 @@ H5Funmount(hid_t loc_id, const char *name) * Also, must decide how we are going to deal with journaling * in such cases. */ - FUNC_ENTER_API_META(H5Funmount, loc_id, FAIL) + FUNC_ENTER_API_META(H5Funmount, loc_id, H5AC_dxpl_id, FAIL) H5TRACE2("e", "i*s", loc_id, name); /* Check args */ @@ -177,7 +177,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, H5G_t *grp = NULL; /* New group created */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Gcreate2, loc_id, FAIL) + FUNC_ENTER_API_META(H5Gcreate2, loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("i", "i*siii", loc_id, name, lcpl_id, gcpl_id, gapl_id); /* Check arguments */ @@ -317,7 +317,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) H5G_t *grp = NULL; hid_t ret_value; - FUNC_ENTER_API_META(H5Gcreate_anon, loc_id, FAIL) + FUNC_ENTER_API_META(H5Gcreate_anon, loc_id, H5AC_dxpl_id, FAIL) H5TRACE3("i", "iii", loc_id, gcpl_id, gapl_id); /* Check arguments */ @@ -693,7 +693,7 @@ H5Gclose(hid_t group_id) herr_t ret_value = SUCCEED; /* Return value */ /* Can this change metadata? If not, no need for a transaction. */ - FUNC_ENTER_API_META(H5Gclose, group_id, FAIL) + FUNC_ENTER_API_META(H5Gclose, group_id, H5AC_dxpl_id, FAIL) H5TRACE1("e", "i", group_id); /* Check args */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index ffcc0e5..d38e30e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -204,7 +204,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) hid_t tmp_gcpl = (-1); /* Temporary group creation property list */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Gcreate1, loc_id, FAIL) + FUNC_ENTER_API_META(H5Gcreate1, loc_id, H5AC_dxpl_id, FAIL) H5TRACE3("i", "i*sz", loc_id, name, size_hint); /* Check arguments */ @@ -326,7 +326,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Glink, cur_loc_id, FAIL) + FUNC_ENTER_API_META(H5Glink, cur_loc_id, H5AC_dxpl_id, FAIL) H5TRACE4("e", "iLl*s*s", cur_loc_id, type, cur_name, new_name); /* Check arguments */ @@ -372,7 +372,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Glink2, cur_loc_id, FAIL) + FUNC_ENTER_API_META(H5Glink2, cur_loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("e", "i*sLli*s", cur_loc_id, cur_name, type, new_loc_id, new_name); /* Check arguments */ @@ -475,7 +475,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Gmove, src_loc_id, FAIL) + FUNC_ENTER_API_META(H5Gmove, src_loc_id, H5AC_dxpl_id, FAIL) H5TRACE3("e", "i*s*s", src_loc_id, src_name, dst_name); /* Call common routine to move the link */ @@ -500,7 +500,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Gmove2, dst_loc_id, FAIL) + FUNC_ENTER_API_META(H5Gmove2, dst_loc_id, H5AC_dxpl_id, FAIL) H5TRACE4("e", "i*si*s", src_loc_id, src_name, dst_loc_id, dst_name); /* Call common routine to move the link */ @@ -582,7 +582,7 @@ H5Gunlink(hid_t loc_id, const char *name) H5G_loc_t loc; /* Group's location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Gunlink, loc_id, FAIL) + FUNC_ENTER_API_META(H5Gunlink, loc_id, H5AC_dxpl_id, FAIL) H5TRACE2("e", "i*s", loc_id, name); /* Check arguments */ @@ -655,7 +655,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Gset_comment, loc_id, FAIL) + FUNC_ENTER_API_META(H5Gset_comment, loc_id, H5AC_dxpl_id, FAIL) H5TRACE3("e", "i*s*s", loc_id, name, comment); if(H5G_loc(loc_id, &loc) < 0) diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 13cf62d..0e918bf 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -77,8 +77,8 @@ static size_t H5G_node_size_real(const H5F_t *f); /* Metadata cache callbacks */ static void *H5G_node_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5G_node_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, +static herr_t H5G_node_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5G_node_free_icr(haddr_t addr, size_t len, void *thing); static herr_t H5G_node_clear(haddr_t addr, size_t len, void *sym); @@ -421,9 +421,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_node_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5G_node_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, + size_t UNUSED len, void *image, void *_thing, unsigned *flags, + haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to the Symbol Table node */ size_t size; /* Size of symbol table node in file */ @@ -898,6 +898,7 @@ done: * *------------------------------------------------------------------------- */ + herr_t H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) { diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 26e539d..1e12edc 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -40,6 +40,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5AC2private.h" /****************/ /* Local Macros */ @@ -77,24 +78,26 @@ static herr_t H5HF_dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dt /* Metadata cache (H5AC2) callbacks */ static void *H5HF_cache_hdr_deserialize(haddr_t addr, size_t len, - const void *image, const void *udata, hbool_t *dirty); -static herr_t H5HF_cache_hdr_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); + const void *image, void *udata, hbool_t *dirty); +static herr_t H5HF_cache_hdr_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5HF_cache_hdr_free_icr(haddr_t addr, size_t len, void *thing); static herr_t H5HF_cache_hdr_image_len(const void *thing, size_t *image_len_ptr); static void *H5HF_cache_iblock_deserialize(haddr_t addr, size_t len, - const void *image, const void *udata, hbool_t *dirty); -static herr_t H5HF_cache_iblock_serialize(const H5F_t * f, haddr_t addr, - size_t len, void *image, void *_thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); + const void *image, void *udata, hbool_t *dirty); +static herr_t H5HF_cache_iblock_serialize(const H5F_t * f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5HF_cache_iblock_free_icr(haddr_t addr, size_t len, void *thing); -static H5HF_direct_t *H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); -static herr_t H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_direct_t *dblock, unsigned UNUSED * flags_ptr); -static herr_t H5HF_cache_dblock_clear(H5F_t *f, H5HF_direct_t *dblock, hbool_t destroy); -static herr_t H5HF_cache_dblock_size(const H5F_t *f, const H5HF_direct_t *dblock, size_t *size_ptr); +static void *H5HF_cache_dblock_deserialize(haddr_t addr, size_t len, + const void *image, void *udata, hbool_t *dirty); +static herr_t H5HF_cache_dblock_serialize(const H5F_t * f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *_thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); + /*********************/ /* Package Variables */ @@ -124,14 +127,16 @@ const H5AC2_class_t H5AC2_FHEAP_IBLOCK[1] = {{ NULL, }}; -/* H5HF direct block inherits cache-like properties from H5AC */ -const H5AC_class_t H5AC_FHEAP_DBLOCK[1] = {{ - H5AC_FHEAP_DBLOCK_ID, - (H5AC_load_func_t)H5HF_cache_dblock_load, - (H5AC_flush_func_t)H5HF_cache_dblock_flush, - (H5AC_dest_func_t)H5HF_cache_dblock_dest, - (H5AC_clear_func_t)H5HF_cache_dblock_clear, - (H5AC_size_func_t)H5HF_cache_dblock_size, +/* H5HF direct block inherits cache-like properties from H5AC2 */ +const H5AC2_class_t H5AC2_FHEAP_DBLOCK[1] = {{ + H5AC2_FHEAP_DBLOCK_ID, + "fractal head direct block", + H5FD_MEM_FHEAP_DBLOCK, + H5HF_cache_dblock_deserialize, + NULL, + H5HF_cache_dblock_serialize, + H5HF_cache_dblock_free_icr, + NULL }}; @@ -270,7 +275,7 @@ H5HF_dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) */ static void * H5HF_cache_hdr_deserialize(haddr_t addr, size_t UNUSED len, - const void *image, const void *_udata, hbool_t UNUSED *dirty) + const void *image, void *_udata, hbool_t UNUSED *dirty) { H5HF_hdr_t *hdr = NULL; /* Fractal heap info */ H5HF_hdr_cache_ud_t *udata = (H5HF_hdr_cache_ud_t *)_udata; @@ -481,9 +486,10 @@ H5HF_cache_hdr_image_len(const void *thing, size_t *image_len_ptr) *------------------------------------------------------------------------- */ static herr_t -H5HF_cache_hdr_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5HF_cache_hdr_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, + void UNUSED **new_image) { herr_t ret_value = SUCCEED; /* Return value */ uint8_t *p; /* Pointer into raw data buffer */ @@ -640,7 +646,7 @@ H5HF_cache_hdr_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) */ static void * H5HF_cache_iblock_deserialize(haddr_t UNUSED addr, size_t UNUSED len, - const void *image, const void *_udata, hbool_t UNUSED *dirty) + const void *image, void *_udata, hbool_t UNUSED *dirty) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_iblock_cache_ud_t *udata = (H5HF_iblock_cache_ud_t *)_udata; /* user data for callback */ @@ -842,9 +848,9 @@ done: */ static herr_t -H5HF_cache_iblock_serialize(const H5F_t *f, haddr_t UNUSED addr, - size_t UNUSED len, void *image, void *_thing, unsigned UNUSED *flags, - haddr_t UNUSED *new_addr, size_t UNUSED *new_len, +H5HF_cache_iblock_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned UNUSED *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { herr_t ret_value = SUCCEED; /* Return value */ @@ -991,11 +997,19 @@ H5HF_cache_iblock_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF_cache_iblock_free_icr() */ + /*------------------------------------------------------------------------- - * Function: H5HF_cache_dblock_load + * Function: H5HF_cache_dblock_deserialize * - * Purpose: Loads a fractal heap direct block from the disk. + * Purpose: Given a direct block disk image, construct and return the + * associated in core representation of the fractal heap + * direct block. + * + * Note that this function is a heavily re-worked version + * of the old H5HF_cache_dblock_load() routine, which had + * to be replaced convert the fractal heap to use the new + * journaling version of the cache. * * Return: Success: Pointer to a new fractal heap direct block * @@ -1005,152 +1019,218 @@ H5HF_cache_iblock_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) * koziol@ncsa.uiuc.edu * Feb 27 2006 * + * Changes: JRM -- 8/10/08 + * Converted from H5HF_cache_dblock_load(). + * *------------------------------------------------------------------------- */ -static H5HF_direct_t * -H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, void *_par_info) + +static void * +H5HF_cache_dblock_deserialize(haddr_t addr, + size_t len, + const void *image, + void *udata, + hbool_t *dirty) { - const size_t *size = (const size_t *)_size; /* Size of block */ - H5HF_hdr_t *hdr; /* Shared fractal heap information */ - H5HF_parent_t *par_info = (H5HF_parent_t *)_par_info; /* Pointer to parent information */ - H5HF_direct_t *dblock = NULL; /* Direct block info */ - const uint8_t *p; /* Pointer into raw data buffer */ - haddr_t heap_addr; /* Address of heap header in the file */ - H5HF_direct_t *ret_value; /* Return value */ + H5HF_dblock_cache_ud_t * ud_ptr; /* pointer to user data */ + H5HF_hdr_t *hdr; /* Shared fractal heap information */ + H5HF_parent_t *par_info; /* Pointer to parent information */ + H5HF_direct_t *dblock = NULL; /* Direct block info */ + const uint8_t *p; /* Pointer into raw data buffer */ + haddr_t heap_addr; /* Address of heap header in the file */ + H5HF_direct_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_load) + FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_deserialize) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(par_info); + HDassert( H5F_addr_defined(addr) ); + HDassert( len > 0 ); + HDassert( image != NULL ); + HDassert( udata != NULL ); + + ud_ptr = (H5HF_dblock_cache_ud_t *)udata; + + par_info = (H5HF_parent_t *)(&(ud_ptr->par_info)); + + HDassert( ud_ptr->f != NULL ); + HDassert( ud_ptr->dblock_size > 0 ); + /* Allocate space for the fractal heap direct block */ - if(NULL == (dblock = H5FL_MALLOC(H5HF_direct_t))) + if( NULL == (dblock = H5FL_MALLOC(H5HF_direct_t)) ) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); + } + HDmemset(&dblock->cache_info, 0, sizeof(H5AC2_info_t)); + /* Get the pointer to the shared heap header */ hdr = par_info->hdr; + /* Set the shared heap header's file context for this operation */ - hdr->f = f; + hdr->f = ud_ptr->f; + /* Share common heap information */ dblock->hdr = hdr; - if(H5HF_hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") + + if( H5HF_hdr_incr(hdr) < 0 ) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, \ + "can't increment reference count on shared heap header") + } + /* Set block's internal information */ - dblock->size = *size; + dblock->size = ud_ptr->dblock_size; dblock->blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dblock->size); + /* Allocate block buffer */ /* XXX: Change to using free-list factories */ - if((dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if( (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) + == NULL ) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, \ + "memory allocation failed") + } + + + /* copy the disk image into the in core image, with filtering + * if appropriate. + */ + + if ( hdr->filter_len > 0 ) { - /* Check for I/O filters on this heap */ - if(hdr->filter_len > 0) { H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */ - size_t nbytes; /* Number of bytes used in buffer, after applying reverse filters */ + size_t nbytes; /* Number of bytes used in buffer, after + * applying reverse filters + */ void *read_buf; /* Pointer to buffer to read in */ size_t read_size; /* Size of filtered direct block to read */ unsigned filter_mask; /* Excluded filters for direct block */ - /* Check for root direct block */ - if(par_info->iblock == NULL) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask); -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr); -#endif /* QAK */ - /* Sanity check */ - HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); + /* Allocate buffer to perform I/O filtering on, and + * then copy the on disk image into it. + * + * Note that one could argue that we should just do the + * filtering in the buffer provided by the cache, and in + * theory there is no reason why we shouldn't. However, + * I can see some scenarios in which this would cause problems, + * and in any case, we have declared it to be constant. Thus + * we will make a copy instead. + */ + if ( NULL == ( read_buf = H5MM_malloc(len)) ) { + + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, \ + "memory allocation failed for pipeline buffer") + } - /* Set up parameters to read filtered direct block */ - read_size = hdr->pline_root_direct_size; - filter_mask = hdr->pline_root_direct_filter_mask; - } /* end if */ - else { #ifdef QAK -HDfprintf(stderr, "%s: par_info->iblock = %p, par_info->entry = %u\n", FUNC, par_info->iblock, par_info->entry); -HDfprintf(stderr, "%s: par_info->iblock->filt_ents[%u].size = %Zu, par_info->iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_info->entry, par_info->iblock->filt_ents[par_info->entry].size, par_info->entry, par_info->iblock->filt_ents[par_info->entry].filter_mask); -HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_info->entry, par_info->iblock->ents[par_info->entry].addr, addr); +HDfprintf(stderr, "%s: len = %Zu, read_buf = %p\n", FUNC, len, read_buf); #endif /* QAK */ - /* Sanity check */ - HDassert(H5F_addr_eq(par_info->iblock->ents[par_info->entry].addr, addr)); - /* Set up parameters to read filtered direct block */ - read_size = par_info->iblock->filt_ents[par_info->entry].size; - filter_mask = par_info->iblock->filt_ents[par_info->entry].filter_mask; - } /* end else */ + /* Copy disk image into read_buf */ + HDmemcpy(read_buf, image, len); - /* Allocate buffer to perform I/O filtering on */ - if(NULL == (read_buf = H5MM_malloc(read_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer") -#ifdef QAK -HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_buf); -#endif /* QAK */ + /* Push direct block data through I/O filter pipeline */ + nbytes = len; + read_size = len; + filter_mask = ud_ptr->filter_mask; - /* Read filtered direct block from disk */ - if(H5F_block_read(f, H5FD_MEM_FHEAP_DBLOCK, addr, read_size, dxpl_id, read_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "can't read fractal heap direct block") + if ( H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, + H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, + &read_buf) < 0 ) { - /* Push direct block data through I/O filter pipeline */ - nbytes = read_size; - if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, - filter_cb, &nbytes, &read_size, &read_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, \ + "output pipeline failed") + } #ifdef QAK HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nbytes, read_size, read_buf); #endif /* QAK */ /* Sanity check */ - HDassert(nbytes == dblock->size); + HDassert( nbytes == dblock->size ); /* Copy un-filtered data into block's buffer */ HDmemcpy(dblock->blk, read_buf, dblock->size); /* Release the read buffer */ H5MM_xfree(read_buf); - } /* end if */ - else { - /* Read direct block from disk */ - if(H5F_block_read(f, H5FD_MEM_FHEAP_DBLOCK, addr, dblock->size, dxpl_id, dblock->blk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "can't read fractal heap direct block") - } /* end else */ + + } else /* no filtering case */ { + + /* just copy the disk image into dblock->blk */ + + /* Sanity check */ + HDassert( len == dblock->size ); + + HDmemcpy(dblock->blk, image, len); + + } /* end no filtering case */ + /* Start decoding direct block */ + p = dblock->blk; + /* Magic number */ - if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap direct block signature") + if ( HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC) ) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, \ + "wrong fractal heap direct block signature") + } + p += H5HF_SIZEOF_MAGIC; + /* Version */ - if(*p++ != H5HF_DBLOCK_VERSION) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") + + if ( *p++ != H5HF_DBLOCK_VERSION ) { + + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, \ + "wrong fractal heap direct block version") + } + /* Address of heap that owns this block (just for file integrity checks) */ - H5F_addr_decode(f, &p, &heap_addr); - if(H5F_addr_ne(heap_addr, hdr->heap_addr)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") + + H5F_addr_decode(ud_ptr->f, &p, &heap_addr); + + if ( H5F_addr_ne(heap_addr, hdr->heap_addr) ) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, \ + "incorrect heap header address for direct block") + } + /* Address of parent block */ + dblock->parent = par_info->iblock; dblock->par_entry = par_info->entry; - if(dblock->parent) { + + if ( dblock->parent ) { + /* Share parent block */ - if(H5HF_iblock_incr(dblock->parent) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared indirect block") + if ( H5HF_iblock_incr(dblock->parent) < 0 ) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, \ + "can't increment reference count on shared indirect block") + } } /* end if */ + /* Offset of heap within the heap's address space */ + UINT64DECODE_VAR(p, dblock->block_off, hdr->heap_off_size); + /* Encode checksum on direct block, if requested */ - if(hdr->checksum_dblocks) { + + if ( hdr->checksum_dblocks ) { + uint32_t stored_chksum; /* Metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -1159,34 +1239,38 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb /* Reset checksum field, for computing the checksum */ /* (Casting away const OK - QAK) */ - HDmemset((uint8_t *)p - H5HF_SIZEOF_CHKSUM, 0, (size_t)H5HF_SIZEOF_CHKSUM); + HDmemset((uint8_t *)p - H5HF_SIZEOF_CHKSUM, 0, + (size_t)H5HF_SIZEOF_CHKSUM); /* Compute checksum on entire direct block */ computed_chksum = H5_checksum_metadata(dblock->blk, dblock->size, 0); /* Verify checksum */ - if(stored_chksum != computed_chksum) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap direct block") + if ( stored_chksum != computed_chksum ) { + + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, \ + "incorrect metadata checksum for fractal heap direct block") + } } /* end if */ /* Sanity check */ - HDassert((size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); + HDassert( (size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) ); /* Set return value */ ret_value = dblock; done: - if(!ret_value && dblock) - (void)H5HF_cache_dblock_dest(f, dblock); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_cache_dblock_load() */ + +} /* H5HF_cache_dblock_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5HF_cache_dblock_flush + * Function: H5HF_cache_dblock_serialize * - * Purpose: Flushes a dirty fractal heap direct block to disk. + * Purpose: Construct the on disk image of the target direct block + * in preparation for writing the direct block to disk. * * Return: Non-negative on success/Negative on failure * @@ -1200,82 +1284,123 @@ done: * entry is resized or renamed as a result of the flush. * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. * + * JRM -- 8/11/08 + * Converted from H5HF_cache_dblock_flush(). + * *------------------------------------------------------------------------- */ -static herr_t -H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5HF_direct_t *dblock, unsigned UNUSED * flags_ptr) + +static herr_t +H5HF_cache_dblock_serialize(const H5F_t * f, + hid_t dxpl_id, + haddr_t addr, + size_t len, + void * image, + void * _thing, + unsigned * flags, + haddr_t * new_addr, + size_t * new_len, + void ** new_image) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ + H5HF_direct_t * dblock; + H5HF_hdr_t * hdr; /* Shared fractal heap information */ + void * write_buf; /* Pointer to buffer to write out */ + size_t write_size; /* Size of buffer to write out */ + uint8_t * p; /* Pointer into raw data buffer */ +#ifndef NDEBUG + hbool_t entry_filtered = FALSE; +#endif - FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_flush) + FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_serialize) /* check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(dblock); + HDassert( f != NULL ); + HDassert( H5F_addr_defined(addr) ); + HDassert( len > 0 ); + HDassert( image != NULL ); + HDassert( _thing != NULL ); - if(dblock->cache_info.is_dirty) { - H5HF_hdr_t *hdr; /* Shared fractal heap information */ - void *write_buf; /* Pointer to buffer to write out */ - size_t write_size; /* Size of buffer to write out */ - uint8_t *p; /* Pointer into raw data buffer */ + dblock = (H5HF_direct_t *)_thing; - /* Get the pointer to the shared heap header */ - hdr = dblock->hdr; + HDassert( dblock->cache_info.is_dirty ); + HDassert( flags != NULL ); + HDassert( new_addr != NULL ); + HDassert( new_len != NULL ); + HDassert( new_image != NULL ); - /* Set the shared heap header's file context for this operation */ - hdr->f = f; + /* set *flags to 0 -- will overwrite if needed */ + *flags = 0; - HDassert(dblock->blk); - p = dblock->blk; + /* Get the pointer to the shared heap header */ + hdr = dblock->hdr; - /* Magic number */ - HDmemcpy(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC); - p += H5HF_SIZEOF_MAGIC; + /* Set the shared heap header's file context for this operation */ + hdr->f = f; - /* Version # */ - *p++ = H5HF_DBLOCK_VERSION; + HDassert(dblock->blk); + p = dblock->blk; - /* Address of heap header for heap which owns this block */ - H5F_addr_encode(f, &p, hdr->heap_addr); + /* Magic number */ + HDmemcpy(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC); + p += H5HF_SIZEOF_MAGIC; - /* Offset of block in heap */ - UINT64ENCODE_VAR(p, dblock->block_off, hdr->heap_off_size); + /* Version # */ + *p++ = H5HF_DBLOCK_VERSION; + + /* Address of heap header for heap which owns this block */ + H5F_addr_encode(f, &p, hdr->heap_addr); + + /* Offset of block in heap */ + UINT64ENCODE_VAR(p, dblock->block_off, hdr->heap_off_size); + + /* Metadata checksum */ + if ( hdr->checksum_dblocks ) { + + uint32_t metadata_chksum; /* Computed metadata checksum value */ + + /* Clear the checksum field, to compute the checksum */ + HDmemset(p, 0, (size_t)H5HF_SIZEOF_CHKSUM); + + /* Compute checksum on entire direct block */ + metadata_chksum = H5_checksum_metadata(dblock->blk, dblock->size, 0); /* Metadata checksum */ - if(hdr->checksum_dblocks) { - uint32_t metadata_chksum; /* Computed metadata checksum value */ + UINT32ENCODE(p, metadata_chksum); + } /* end if */ + + /* Sanity check */ + HDassert( (size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) ); + + /* Check for I/O filters on this heap */ + if(hdr->filter_len > 0) { +#ifndef NDEBUG + entry_filtered = TRUE; +#endif /* NDEBUG */ - /* Clear the checksum field, to compute the checksum */ - HDmemset(p, 0, (size_t)H5HF_SIZEOF_CHKSUM); + H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */ + size_t nbytes; /* Number of bytes used */ + unsigned filter_mask; /* Filter mask for block */ - /* Compute checksum on entire direct block */ - metadata_chksum = H5_checksum_metadata(dblock->blk, dblock->size, 0); + /* Allocate buffer to perform I/O filtering on */ + write_size = dblock->size; + if ( NULL == (write_buf = H5MM_malloc(write_size)) ) { - /* Metadata checksum */ - UINT32ENCODE(p, metadata_chksum); - } /* end if */ + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, \ + "memory allocation failed for pipeline buffer") + } - /* Sanity check */ - HDassert((size_t)(p - dblock->blk) == H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); + HDmemcpy(write_buf, dblock->blk, write_size); - /* Check for I/O filters on this heap */ - if(hdr->filter_len > 0) { - H5Z_cb_t filter_cb = {NULL, NULL}; /* Filter callback structure */ - size_t nbytes; /* Number of bytes used */ - unsigned filter_mask; /* Filter mask for block */ - - /* Allocate buffer to perform I/O filtering on */ - write_size = dblock->size; - if(NULL == (write_buf = H5MM_malloc(write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") - HDmemcpy(write_buf, dblock->blk, write_size); - - /* Push direct block data through I/O filter pipeline */ - nbytes = write_size; - if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, - filter_cb, &nbytes, &write_size, &write_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed") + /* Push direct block data through I/O filter pipeline */ + nbytes = write_size; + + if ( H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, + filter_cb, &nbytes, &write_size, &write_buf) < 0 ) { + + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, \ + "output pipeline failed") + } #ifdef QAK HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, write_buf); HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); @@ -1283,143 +1408,210 @@ HDfprintf(stderr, "%s: dblock->size = %Zu, dblock->blk = %p\n", FUNC, dblock->si HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dblock->parent, dblock->par_entry); #endif /* QAK */ - /* Use the compressed number of bytes as the size to write */ - write_size = nbytes; + /* Use the compressed number of bytes as the size to write */ + write_size = nbytes; - /* Check for root direct block */ - if(dblock->parent == NULL) { - hbool_t hdr_changed = FALSE; /* Whether the header information changed */ + /* Check for root direct block */ + if( dblock->parent == NULL ) { + hbool_t hdr_changed = FALSE; /* Whether the header information + * changed + */ #ifdef QAK HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask); HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr); #endif /* QAK */ - /* Sanity check */ - HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); - HDassert(hdr->pline_root_direct_size > 0); - /* Check if the filter mask changed */ - if(hdr->pline_root_direct_filter_mask != filter_mask) { - hdr->pline_root_direct_filter_mask = filter_mask; - hdr_changed = TRUE; - } /* end if */ + /* Sanity check */ + HDassert( H5F_addr_eq(hdr->man_dtable.table_addr, addr) ); + HDassert( hdr->pline_root_direct_size > 0 ); + + /* Check if the filter mask changed */ + if ( hdr->pline_root_direct_filter_mask != filter_mask ) { + + hdr->pline_root_direct_filter_mask = filter_mask; + hdr_changed = TRUE; + } /* end if */ - /* Check if we need to re-size the block on disk */ - if(hdr->pline_root_direct_size != write_size) { + /* Check if we need to re-size the block on disk */ + if ( hdr->pline_root_direct_size != write_size ) { #ifdef QAK HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); #endif /* QAK */ - /* Release direct block's current disk space */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)hdr->pline_root_direct_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") - - /* Allocate space for the compressed direct block */ - if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") - - /* Let the metadata cache know, if the block moved */ - if(!H5F_addr_eq(hdr->man_dtable.table_addr, addr)) - if(H5AC_rename(f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move direct block") - - /* Update information about compressed direct block's location & size */ - hdr->man_dtable.table_addr = addr; - hdr->pline_root_direct_size = write_size; - - /* Note that heap header was modified */ - hdr_changed = TRUE; - } /* end if */ - - /* Check if heap header was modified */ - if(hdr_changed) - if(H5HF_hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + /* Release direct block's current disk space */ + if( H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, + (hsize_t)hdr->pline_root_direct_size) < 0 ) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, \ + "unable to free fractal heap direct block"); + } + + /* Allocate space for the compressed direct block */ + if ( HADDR_UNDEF == + (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, + (hsize_t)write_size)) ) { + + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, \ + "file allocation failed for fractal heap direct block") + } + + *flags |= H5C2__SERIALIZE_RESIZED_FLAG; + *new_len = write_size; + + /* Let the metadata cache know, if the block moved */ + if ( ! H5F_addr_eq(hdr->man_dtable.table_addr, addr) ) { + + *flags |= H5C2__SERIALIZE_RENAMED_FLAG; + *new_addr = addr; + } + + /* Update information about compressed direct block's + * location & size + */ + hdr->man_dtable.table_addr = addr; + hdr->pline_root_direct_size = write_size; + + /* Note that heap header was modified */ + hdr_changed = TRUE; } /* end if */ - else { - hbool_t par_changed = FALSE; /* Whether the parent's information changed */ - H5HF_indirect_t *par_iblock; /* Parent indirect block */ - unsigned par_entry; /* Entry in parent indirect block */ - /* Get parent information */ - par_iblock = dblock->parent; - par_entry = dblock->par_entry; + /* Check if heap header was modified */ + if ( hdr_changed ) { + + if ( H5HF_hdr_dirty(hdr) < 0 ) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, \ + "can't mark heap header as dirty") + } + } + } /* end if */ + else { + + hbool_t par_changed = FALSE; /* Whether the parent's + * information changed + */ + H5HF_indirect_t *par_iblock; /* Parent indirect block */ + unsigned par_entry; /* Entry in parent indirect block */ + + /* Get parent information */ + par_iblock = dblock->parent; + par_entry = dblock->par_entry; #ifdef QAK HDfprintf(stderr, "%s: par_iblock->filt_ents[%u].size = %Zu, par_iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_entry, par_iblock->filt_ents[par_entry].size, par_entry, par_iblock->filt_ents[par_entry].filter_mask); HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_entry, par_iblock->ents[par_entry].addr, addr); #endif /* QAK */ - /* Sanity check */ - HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); - HDassert(par_iblock->filt_ents[par_entry].size > 0); + /* Sanity check */ + HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); + HDassert(par_iblock->filt_ents[par_entry].size > 0); - /* Check if the filter mask changed */ - if(par_iblock->filt_ents[par_entry].filter_mask != filter_mask) { - par_iblock->filt_ents[par_entry].filter_mask = filter_mask; - par_changed = TRUE; - } /* end if */ + /* Check if the filter mask changed */ + if ( par_iblock->filt_ents[par_entry].filter_mask != filter_mask ) { + + par_iblock->filt_ents[par_entry].filter_mask = filter_mask; + par_changed = TRUE; + } /* end if */ - /* Check if we need to re-size the block on disk */ - if(par_iblock->filt_ents[par_entry].size != write_size) { + /* Check if we need to re-size the block on disk */ + if ( par_iblock->filt_ents[par_entry].size != write_size ) { #ifdef QAK HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); #endif /* QAK */ - /* Release direct block's current disk space */ - if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)par_iblock->filt_ents[par_entry].size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") - - /* Allocate space for the compressed direct block */ - if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") - - /* Let the metadata cache know, if the block moved */ - if(!H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)) - if(H5AC_rename(f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRENAME, FAIL, "unable to move direct block") - - /* Update information about compressed direct block's location & size */ - par_iblock->ents[par_entry].addr = addr; - par_iblock->filt_ents[par_entry].size = write_size; - - /* Note that parent was modified */ - par_changed = TRUE; - } /* end if */ - - /* Check if parent was modified */ - if(par_changed) - if(H5HF_iblock_dirty(par_iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") - } /* end else */ - } /* end if */ - else { - write_buf = dblock->blk; - write_size = dblock->size; - } /* end else */ + /* Release direct block's current disk space */ + if ( H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, + (hsize_t)par_iblock->filt_ents[par_entry].size) < 0 ) { - /* Write the direct block */ -#ifdef QAK -HDfprintf(stderr, "%s: addr = %a, write_size = %Zu\n", FUNC, addr, write_size); -#endif /* QAK */ - if(H5F_block_write(f, H5FD_MEM_FHEAP_DBLOCK, addr, write_size, dxpl_id, write_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap direct block to disk") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, \ + "unable to free fractal heap direct block") + } + + /* Allocate space for the compressed direct block */ + if ( HADDR_UNDEF == + (addr = H5MF_alloc(f, H5FD_MEM_FHEAP_DBLOCK, + dxpl_id, (hsize_t)write_size)) ) { + + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, \ + "file allocation failed for fractal heap direct block") + } + + *flags |= H5C2__SERIALIZE_RESIZED_FLAG; + *new_len = write_size; + + /* Let the metadata cache know, if the block moved */ + if( ! H5F_addr_eq(par_iblock->ents[par_entry].addr, addr) ) { + + *flags |= H5C2__SERIALIZE_RENAMED_FLAG; + *new_addr = addr; + } + + /* Update information about compressed direct + * block's location & size + */ + par_iblock->ents[par_entry].addr = addr; + par_iblock->filt_ents[par_entry].size = write_size; - /* Release the write buffer, if it was allocated */ - if(write_buf != dblock->blk) - H5MM_xfree(write_buf); + /* Note that parent was modified */ + par_changed = TRUE; + } /* end if */ + + /* Check if parent was modified */ + if ( par_changed ) { - dblock->cache_info.is_dirty = FALSE; + if ( H5HF_iblock_dirty(par_iblock) < 0 ) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, \ + "can't mark heap header as dirty") + } + } + } /* end else */ } /* end if */ + else { + write_buf = dblock->blk; + write_size = dblock->size; + } /* end else */ + + if ( write_size == len ) { + + HDassert( *flags == 0 ); + HDassert( write_buf != NULL ); + HDassert( ( entry_filtered ) || ( write_buf == dblock->blk ) ); + + HDmemcpy(image, write_buf, write_size); + + if ( write_buf != dblock->blk ) { + + H5MM_xfree(write_buf); + } + + } else { + + /* on disk image has been resized, and possibly renamed -- *flags, + * *new_len, and *new_addr should all be setup by now. + * Thus all we need to do here is the old image, and allocate + * space for the new image. + */ + + HDassert( *flags != 0 ); + HDassert( write_buf != NULL ); + HDassert( *new_len = write_size ); + HDassert( write_buf != dblock->blk ); + + H5MM_xfree(image); - if(destroy) - if(H5HF_cache_dblock_dest(f, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") + *new_image = write_buf; + + } done: + FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF_cache_dblock_flush() */ + +} /* H5HF_cache_dblock_serialize() */ + /*------------------------------------------------------------------------- - * Function: H5HF_cache_dblock_dest + * Function: H5HF_cache_dblock_free_icr * * Purpose: Destroys a fractal heap direct block in memory. * @@ -1429,110 +1621,68 @@ done: * koziol@ncsa.uiuc.edu * Feb 27 2006 * + * Changes: John Mainzer -- 8/11/08 + * Converted from H5HF_cache_dblock_dest(). + * *------------------------------------------------------------------------- */ -/* ARGSUSED */ -herr_t -H5HF_cache_dblock_dest(H5F_t UNUSED *f, H5HF_direct_t *dblock) + +herr_t +H5HF_cache_dblock_free_icr(haddr_t UNUSED addr, + size_t UNUSED len, + void *thing) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ + H5HF_direct_t * dblock; - FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_dest) + FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_free_icr) /* * Check arguments. */ - HDassert(dblock); + HDassert( thing ); + + dblock = (H5HF_direct_t *)thing; + #ifdef QAK HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock); #endif /* QAK */ /* Set the shared heap header's file context for this operation */ - dblock->hdr->f = f; + /* This doesn't seem to be necessary, and at present, we don't pass + * in the file pointer to this callback -- will comment it out + * for now. + * -- JRM + */ + /* dblock->hdr->f = f; */ /* Decrement reference count on shared fractal heap info */ - HDassert(dblock->hdr); - if(H5HF_hdr_decr(dblock->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") - if(dblock->parent) - if(H5HF_iblock_decr(dblock->parent) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HDassert( dblock->hdr != NULL ); - /* Free block's buffer */ - dblock->blk = H5FL_BLK_FREE(direct_block, dblock->blk); + if ( H5HF_hdr_decr(dblock->hdr) < 0 ) { - /* Free fractal heap direct block info */ - H5FL_FREE(H5HF_direct_t, dblock); + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, \ + "can't decrement reference count on shared heap header") + } -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_cache_dblock_dest() */ + if ( dblock->parent ) { - -/*------------------------------------------------------------------------- - * Function: H5HF_cache_dblock_clear - * - * Purpose: Mark a fractal heap direct block in memory as non-dirty. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Feb 27 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5HF_cache_dblock_clear(H5F_t *f, H5HF_direct_t *dblock, hbool_t destroy) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_dblock_clear) + if ( H5HF_iblock_decr(dblock->parent) < 0 ) { - /* - * Check arguments. - */ - HDassert(dblock); + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, \ + "can't decrement reference count on shared indirect block") + } + } - /* Reset the dirty flag. */ - dblock->cache_info.is_dirty = FALSE; + /* Free block's buffer */ + dblock->blk = H5FL_BLK_FREE(direct_block, dblock->blk); - if(destroy) - if(H5HF_cache_dblock_dest(f, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") + /* Free fractal heap direct block info */ + H5FL_FREE(H5HF_direct_t, dblock); done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5HF_cache_dblock_clear() */ - -/*------------------------------------------------------------------------- - * Function: H5HF_cache_dblock_size - * - * Purpose: Compute the size in bytes of a fractal heap direct block - * 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 - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Feb 24 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5HF_cache_dblock_size(const H5F_t UNUSED *f, const H5HF_direct_t *dblock, size_t *size_ptr) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_dblock_size) - - /* check arguments */ - HDassert(dblock); - HDassert(size_ptr); - - /* Set size value */ - *size_ptr = dblock->size; + FUNC_LEAVE_NOAPI(ret_value) - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5HF_cache_dblock_size() */ +} /* end H5HF_cache_dblock_free_icr() */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index f42e616..33267ab 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -429,7 +429,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, /* * Load the heap direct block */ - if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, addr, block_size, NULL, 0, H5AC_READ))) + if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, addr, block_size, NULL, 0, H5AC2_READ))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") /* Print opening message */ @@ -505,7 +505,7 @@ H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, H5_buffer_dump(stream, indent, dblock->blk, marker, (size_t)0, dblock->size); done: - if(dblock && H5AC_unprotect(f, dxpl_id, H5AC_FHEAP_DBLOCK, addr, dblock, H5AC__NO_FLAGS_SET) < 0) + if(dblock && H5AC2_unprotect(f, dxpl_id, H5AC2_FHEAP_DBLOCK, addr, (size_t)0, dblock, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block") if(hdr && H5AC2_unprotect(f, dxpl_id, H5AC2_FHEAP_HDR, hdr_addr, (size_t)0, hdr, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 9de7bb8..8ded761 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -115,10 +115,11 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fractal heap direct block") /* Reset the metadata cache info for the heap header */ - HDmemset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); + HDmemset(&dblock->cache_info, 0, sizeof(H5AC2_info_t)); /* Share common heap information */ dblock->hdr = hdr; + if(H5HF_hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") @@ -131,11 +132,13 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo dblock->block_off += hdr->man_dtable.row_block_off[par_row]; dblock->block_off += hdr->man_dtable.row_block_size[par_row] * (par_entry % hdr->man_dtable.cparam.width); H5_ASSIGN_OVERFLOW(/* To: */ dblock->size, /* From: */ hdr->man_dtable.row_block_size[par_row], /* From: */ hsize_t, /* To: */ size_t); + } /* end if */ else { /* Must be the root direct block */ dblock->block_off = 0; dblock->size = hdr->man_dtable.cparam.start_block_size; + } /* end else */ dblock->blk_off_size = H5HF_SIZEOF_OFFSET_LEN(dblock->size); free_space = dblock->size - H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); @@ -178,7 +181,7 @@ HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); } /* end else */ /* Cache the new fractal heap direct block */ - if(H5AC_set(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + if(H5AC2_set(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, dblock->size, dblock, H5AC2__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache") /* Increase the allocated heap size */ @@ -192,7 +195,7 @@ HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); done: if(ret_value < 0) if(dblock) - (void)H5HF_cache_dblock_dest(hdr->f, dblock); + H5HF_cache_dblock_free_icr(dblock_addr, dblock->size, (void *)dblock); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_man_dblock_create() */ @@ -330,7 +333,7 @@ HDfprintf(stderr, "%s: Before releasing direct block's space, dblock_addr = %a, HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") /* Remove direct block from metadata cache */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DIRTIED_FLAG|H5AC__DELETED_FLAG) < 0) + if(H5AC2_unprotect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, (size_t)0, dblock, H5AC2__DIRTIED_FLAG|H5AC2__DELETED_FLAG) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") dblock = NULL; @@ -469,8 +472,8 @@ done: /*------------------------------------------------------------------------- * Function: H5HF_man_dblock_protect * - * Purpose: Convenience wrapper around H5AC_protect on a direct block - * (Use H5AC_unprotect to unprotect it for now) + * Purpose: Convenience wrapper around H5AC2_protect on a direct block + * (Use H5AC2_unprotect to unprotect it for now) * * Return: Pointer to direct block on success, NULL on failure * @@ -481,13 +484,26 @@ done: *------------------------------------------------------------------------- */ H5HF_direct_t * -H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, - size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry, - H5AC_protect_t rw) +H5HF_man_dblock_protect(H5HF_hdr_t *hdr, + hid_t dxpl_id, + haddr_t dblock_addr, + size_t dblock_size, + H5HF_indirect_t *par_iblock, + unsigned par_entry, + H5AC2_protect_t rw) { - H5HF_parent_t par_info; /* Parent info for loading block */ - H5HF_direct_t *dblock; /* Direct block from cache */ - H5HF_direct_t *ret_value; /* Return value */ + size_t odi_size; /* On disk image size of the direct block. + * Note that there is no necessary relation + * between this value, and the actual + * direct block size, as conpression may + * reduce the size of the on disk image, + * and check sums may increase it. + */ + H5HF_dblock_cache_ud_t ud; /* parent and other infor for + * deserializing direct block + */ + H5HF_direct_t *dblock; /* Direct block from cache */ + H5HF_direct_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_protect) #ifdef QAK @@ -502,19 +518,62 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr HDassert(dblock_size > 0); /* Set up parent info */ - par_info.hdr = hdr; - par_info.iblock = par_iblock; - par_info.entry = par_entry; + ud.par_info.hdr = hdr; + ud.par_info.iblock = par_iblock; + ud.par_info.entry = par_entry; + + /* set up the file pointer in the user data */ + ud.f = hdr->f; + + /* set up the direct block size */ + ud.dblock_size = dblock_size; + + /* compute the on disk image size -- observe that odi_size and + * dblock_size will be identical if there is no filtering. + */ + if ( hdr->filter_len > 0 ) { + + if ( par_iblock == NULL ) { + + odi_size = hdr->pline_root_direct_size; + ud.filter_mask = hdr->pline_root_direct_filter_mask; + + } else { + + /* Sanity check */ + HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, + dblock_addr)); + + /* Set up parameters to read filtered direct block */ + odi_size = par_iblock->filt_ents[par_entry].size; + ud.filter_mask = par_iblock->filt_ents[par_entry].filter_mask; + + } + } else { + + odi_size = dblock_size; + + } /* Protect the direct block */ - if(NULL == (dblock = H5AC_protect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, &dblock_size, &par_info, rw))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block") + if(NULL == (dblock = H5AC2_protect(hdr->f, + dxpl_id, + H5AC2_FHEAP_DBLOCK, + dblock_addr, + odi_size, + (void *)&ud, + rw))) { + + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, \ + "unable to protect fractal heap direct block") + } /* Set the return value */ ret_value = dblock; done: FUNC_LEAVE_NOAPI(ret_value) + } /* end H5HF_man_dblock_protect() */ @@ -534,7 +593,7 @@ done: herr_t H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, H5HF_indirect_t **ret_iblock, unsigned *ret_entry, hbool_t *ret_did_protect, - H5AC_protect_t rw) + H5AC2_protect_t rw) { haddr_t iblock_addr; /* Indirect block's address */ H5HF_indirect_t *iblock; /* Pointer to indirect block */ @@ -578,7 +637,7 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); H5HF_indirect_t *new_iblock; /* Pointer to new indirect block */ hbool_t new_did_protect; /* Whether we protected the indirect block or not */ unsigned nrows; /* Number of rows in new indirect block */ - unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting parent indirect block */ + unsigned cache_flags = H5AC2__NO_FLAGS_SET; /* Flags for unprotecting parent indirect block */ /* Compute # of rows in child indirect block */ nrows = (H5V_log2_gen(hdr->man_dtable.row_block_size[row]) - hdr->man_dtable.first_row_bits) + 1; @@ -599,7 +658,7 @@ HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry); HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") /* Indicate that the parent indirect block was modified */ - cache_flags |= H5AC__DIRTIED_FLAG; + cache_flags |= H5AC2__DIRTIED_FLAG; } /* end if */ /* Lock child indirect block */ @@ -656,6 +715,7 @@ done: * *------------------------------------------------------------------------- */ + herr_t H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr, hsize_t dblock_size) @@ -675,20 +735,22 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr HDassert(H5F_addr_defined(dblock_addr)); /* Check the direct block's status in the metadata cache */ - if(H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) + if(H5AC2_get_entry_status(f, dblock_addr, &dblock_status) < 0) { + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for direct block") + } /* If the direct block is in the cache, expunge it now */ - if(dblock_status & H5AC_ES__IN_CACHE) { + if(dblock_status & H5AC2_ES__IN_CACHE) { /* Sanity checks on direct block */ - HDassert(!(dblock_status & H5AC_ES__IS_PINNED)); - HDassert(!(dblock_status & H5AC_ES__IS_PROTECTED)); + HDassert(!(dblock_status & H5AC2_ES__IS_PINNED)); + HDassert(!(dblock_status & H5AC2_ES__IS_PROTECTED)); #ifdef QAK HDfprintf(stderr, "%s: Expunging direct block from cache\n", FUNC); #endif /* QAK */ /* Evict the direct block from the metadata cache */ - if(H5AC_expunge_entry(f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr) < 0) + if(H5AC2_expunge_entry(f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove direct block from cache") #ifdef QAK HDfprintf(stderr, "%s: Done expunging direct block from cache\n", FUNC); diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 4058ccc..c68133c 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -582,8 +582,10 @@ H5HF_hdr_decr(H5HF_hdr_t *hdr) /* Mark header as evictable again when no child blocks depend on it */ if(hdr->rc == 0) { HDassert(hdr->file_rc == 0); - if(H5AC2_unpin_entry(hdr) < 0) + if(H5AC2_unpin_entry(hdr) < 0) { + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") + } } /* end if */ done: @@ -1508,6 +1510,7 @@ done: * *------------------------------------------------------------------------- */ + herr_t H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) { diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 13e5675..052fd3b 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -431,7 +431,7 @@ HDfprintf(stderr, "%s: have_direct_block = %u\n", FUNC, (unsigned)have_direct_bl H5HF_direct_t *dblock; /* Pointer to direct block to query */ /* Lock first (root) direct block */ - if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, hdr->man_dtable.table_addr, hdr->man_dtable.cparam.start_block_size, NULL, 0, H5AC_WRITE))) + if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, hdr->man_dtable.table_addr, hdr->man_dtable.cparam.start_block_size, NULL, 0, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") /* Attach direct block to new root indirect block */ @@ -452,7 +452,7 @@ HDfprintf(stderr, "%s: have_direct_block = %u\n", FUNC, (unsigned)have_direct_bl } /* end if */ /* Unlock first (previously the root) direct block */ - if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + if(H5AC2_unprotect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, hdr->man_dtable.table_addr, (size_t)0, dblock, H5AC2__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") dblock = NULL; } /* end if */ @@ -886,7 +886,7 @@ HDfprintf(stderr, "%s: Reverting root indirect block\n", FUNC); dblock_size = hdr->man_dtable.cparam.start_block_size; /* Get pointer to last direct block */ - if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, root_iblock, 0, H5AC_WRITE))) + if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, root_iblock, 0, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") HDassert(dblock->parent == root_iblock); HDassert(dblock->par_entry == 0); @@ -917,7 +917,7 @@ HDfprintf(stderr, "%s: Reverting root indirect block\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") done: - if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + if(dblock && H5AC2_unprotect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, (size_t)0, dblock, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HFman.c b/src/H5HFman.c index ddf2504..1d7fa71 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -168,7 +168,7 @@ HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.s #endif /* QAK */ /* Lock direct block */ - if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC_WRITE))) + if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") /* Insert object into block */ @@ -224,7 +224,7 @@ HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, (dblock->block_off done: /* Release the direct block (marked as dirty) */ - if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DIRTIED_FLAG) < 0) + if(dblock && H5AC2_unprotect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, (size_t)0, dblock, H5AC2__DIRTIED_FLAG) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) @@ -250,7 +250,7 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, H5HF_operator_t op, void *op_data, unsigned op_flags) { H5HF_direct_t *dblock = NULL; /* Pointer to direct block to query */ - H5AC_protect_t dblock_access; /* Access method for direct block */ + H5AC2_protect_t dblock_access; /* Access method for direct block */ haddr_t dblock_addr; /* Direct block address */ size_t dblock_size; /* Direct block size */ unsigned dblock_cache_flags; /* Flags for unprotecting direct block */ @@ -270,12 +270,12 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Set the access mode for the direct block */ if(op_flags & H5HF_OP_MODIFY) { - dblock_access = H5AC_WRITE; - dblock_cache_flags = H5AC__DIRTIED_FLAG; + dblock_access = H5AC2_WRITE; + dblock_cache_flags = H5AC2__DIRTIED_FLAG; } /* end if */ else { - dblock_access = H5AC_READ; - dblock_cache_flags = H5AC__NO_FLAGS_SET; + dblock_access = H5AC2_READ; + dblock_cache_flags = H5AC2__NO_FLAGS_SET; } /* end else */ /* Skip over the flag byte */ @@ -319,7 +319,7 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd unsigned entry; /* Entry of block */ /* Look up indirect block containing direct block */ - if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &entry, &did_protect, H5AC_READ) < 0) + if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &entry, &did_protect, H5AC2_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") #ifdef QAK HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr); @@ -377,7 +377,7 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr done: /* Unlock direct block */ - if(dblock && H5AC_unprotect(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, dblock_cache_flags) < 0) + if(dblock && H5AC2_unprotect(hdr->f, dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, (size_t)0, dblock, dblock_cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") FUNC_LEAVE_NOAPI(ret_value) @@ -570,7 +570,7 @@ HDfprintf(stderr, "%s: direct root block\n", FUNC); HDfprintf(stderr, "%s: indirect root block\n", FUNC); #endif /* QAK */ /* Look up indirect block containing direct block */ - if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &dblock_entry, &did_protect, H5AC_WRITE) < 0) + if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &dblock_entry, &did_protect, H5AC2_WRITE) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") #ifdef QAK HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].addr); diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index c93d32c..b169ac7 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -464,7 +464,7 @@ struct H5HF_indirect_t { /* A fractal heap direct block */ typedef struct H5HF_direct_t { /* Information for H5AC cache functions, _must_ be first field in structure */ - H5AC_info_t cache_info; + H5AC2_info_t cache_info; /* Internal heap information */ H5HF_hdr_t *hdr; /* Shared heap header info */ @@ -547,6 +547,23 @@ typedef struct H5HF_iblock_cache_ud_t { const unsigned *nrows; /* Number of rows */ } H5HF_iblock_cache_ud_t; +/* User data for fractal heap direct block cache client callbacks */ +typedef struct H5HF_dblock_cache_ud_t { + H5HF_parent_t par_info; /* Parent info */ + H5F_t * f; /* File pointer */ + size_t dblock_size; /* size of the direct block, which bears + * no necessary relation to the block + * odi_size -- the size of the on disk + * image of the block. Note that the + * metadata cache is only interested + * in the odi_size, and thus it is this + * value that is passed to the cache in + * calls to it. + */ + unsigned filter_mask; /* Excluded filters for direct block */ +} H5HF_dblock_cache_ud_t; + + /*****************************/ /* Package Private Variables */ /*****************************/ @@ -559,6 +576,7 @@ H5_DLLVAR const H5AC2_class_t H5AC2_FHEAP_IBLOCK[1]; /* H5HF direct block inherits cache-like properties from H5AC */ H5_DLLVAR const H5AC_class_t H5AC_FHEAP_DBLOCK[1]; +H5_DLLVAR const H5AC2_class_t H5AC2_FHEAP_DBLOCK[1]; /* The v2 B-tree class for tracking indirectly accessed 'huge' objects */ H5_DLLVAR const H5B2_class_t H5HF_BT2_INDIR[1]; @@ -687,10 +705,10 @@ H5_DLL herr_t H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5_DLL H5HF_direct_t *H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, size_t dblock_size, H5HF_indirect_t *par_iblock, unsigned par_entry, - H5AC_protect_t rw); + H5AC2_protect_t rw); H5_DLL herr_t H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, H5HF_indirect_t **par_iblock, - unsigned *par_entry, hbool_t *par_did_protect, H5AC_protect_t rw); + unsigned *par_entry, hbool_t *par_did_protect, H5AC2_protect_t rw); H5_DLL herr_t H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr, hsize_t dblock_size); @@ -734,7 +752,7 @@ H5_DLL herr_t H5HF_tiny_remove(H5HF_hdr_t *fh, const uint8_t *id); /* Metadata cache callbacks */ H5_DLL herr_t H5HF_cache_hdr_dest(H5HF_hdr_t *hdr); -H5_DLL herr_t H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock); +H5_DLL herr_t H5HF_cache_dblock_free_icr(haddr_t addr, size_t len, void *thing); H5_DLL herr_t H5HF_cache_iblock_dest(H5HF_indirect_t *iblock); /* Debugging routines for dumping file structures */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index e9ffa57..fd7e945 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -561,7 +561,7 @@ H5HF_sect_single_locate_parent(H5HF_hdr_t *hdr, hid_t dxpl_id, hbool_t refresh, HDassert(sect); /* Look up indirect block containing direct blocks for range */ - if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, &sec_entry, &did_protect, H5AC_READ) < 0) + if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, &sec_entry, &did_protect, H5AC2_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") /* Increment reference count on indirect block that free section is in */ @@ -833,7 +833,7 @@ HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dt #ifdef QAK HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); #endif /* QAK */ - if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC_WRITE))) + if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); @@ -1186,7 +1186,7 @@ HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); #endif /* QAK */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, - dblock_size, (*sect)->u.single.parent, (*sect)->u.single.par_entry, H5AC_WRITE))) + dblock_size, (*sect)->u.single.parent, (*sect)->u.single.par_entry, H5AC2_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") HDassert(H5F_addr_eq(dblock->block_off + dblock_size, (*sect)->sect_info.addr + (*sect)->sect_info.size)); @@ -1295,7 +1295,7 @@ HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_ /* Retrieve direct block address from section */ /* (Casting away const OK - QAK) */ - status = H5HF_sect_single_dblock_info(iblock->hdr, H5AC_dxpl_id, (H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); + status = H5HF_sect_single_dblock_info(iblock->hdr, H5AC2_dxpl_id, (H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); HDassert(status >= 0); HDassert(H5F_addr_eq(iblock->ents[sect->u.single.par_entry].addr, dblock_addr)); HDassert(dblock_size > 0); @@ -1308,18 +1308,18 @@ HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_ HDassert((sect->sect_info.size + dblock_overhead) < dblock_size); /* Check the direct block's status in the metadata cache */ - status = H5AC_get_entry_status(iblock->hdr->f, dblock_addr, &dblock_status); + status = H5AC2_get_entry_status(iblock->hdr->f, dblock_addr, &dblock_status); HDassert(status >= 0); /* If the direct block for the section isn't already protected, * protect it here in order to check single section's sanity * against it. */ - if(!(dblock_status & H5AC_ES__IS_PROTECTED)) { + if(!(dblock_status & H5AC2_ES__IS_PROTECTED)) { H5HF_direct_t *dblock; /* Direct block for section */ /* Protect the direct block for the section */ - dblock = H5HF_man_dblock_protect(iblock->hdr, H5AC_dxpl_id, dblock_addr, dblock_size, iblock, sect->u.single.par_entry, H5AC_READ); + dblock = H5HF_man_dblock_protect(iblock->hdr, H5AC2_dxpl_id, dblock_addr, dblock_size, iblock, sect->u.single.par_entry, H5AC2_READ); HDassert(dblock); /* Sanity check settings for section */ @@ -1330,7 +1330,7 @@ HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_ (sect->sect_info.addr + sect->sect_info.size))); /* Release direct block */ - status = H5AC_unprotect(iblock->hdr->f, H5AC_dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET); + status = H5AC2_unprotect(iblock->hdr->f, H5AC2_dxpl_id, H5AC2_FHEAP_DBLOCK, dblock_addr, (size_t)0, dblock, H5AC2__NO_FLAGS_SET); HDassert(status >= 0); } /* end if */ } /* end if */ @@ -2976,7 +2976,7 @@ H5HF_sect_indirect_revive_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_ HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr); HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); #endif /* QAK */ - if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, NULL, &did_protect, H5AC_READ) < 0) + if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, NULL, &did_protect, H5AC2_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") /* Increment reference count on indirect block that free section is in */ @@ -1262,7 +1262,7 @@ H5Idec_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Idec_ref, id, FAIL); + FUNC_ENTER_API_META(H5Idec_ref, id, H5AC_dxpl_id, FAIL); H5TRACE1("Is", "i", id); /* Check arguments */ @@ -1387,7 +1387,7 @@ H5Iinc_ref(hid_t id) { int ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Iinc_ref, id, FAIL); + FUNC_ENTER_API_META(H5Iinc_ref, id, H5AC_dxpl_id, FAIL); H5TRACE1("Is", "i", id); /* Check arguments */ @@ -315,7 +315,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Lmove, src_loc_id, FAIL) + FUNC_ENTER_API_META(H5Lmove, src_loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, lapl_id); @@ -373,7 +373,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Lcopy, src_loc_id, FAIL) + FUNC_ENTER_API_META(H5Lcopy, src_loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, lcpl_id, lapl_id); @@ -434,7 +434,7 @@ H5Lcreate_soft(const char *link_target, H5G_loc_t link_loc; /* Group location for new link */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Lcreate_soft, link_loc_id, FAIL) + FUNC_ENTER_API_META(H5Lcreate_soft, link_loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("e", "*si*sii", link_target, link_loc_id, link_name, lcpl_id, lapl_id); /* Check arguments */ @@ -480,7 +480,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, H5G_loc_t new_loc, *new_loc_p; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Lcreate_hard, cur_loc_id, FAIL) + FUNC_ENTER_API_META(H5Lcreate_hard, cur_loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "i*si*sii", cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id); @@ -549,7 +549,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, H5G_loc_t link_loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Lcreate_ud, link_loc_id, FAIL) + FUNC_ENTER_API_META(H5Lcreate_ud, link_loc_id, H5AC_dxpl_id, FAIL) H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, udata_size, lcpl_id, lapl_id); @@ -591,7 +591,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) H5G_loc_t loc; /* Group's location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Ldelete, loc_id, FAIL) + FUNC_ENTER_API_META(H5Ldelete, loc_id, H5AC_dxpl_id, FAIL) H5TRACE3("e", "i*si", loc_id, name, lapl_id); /* Check arguments */ @@ -636,7 +636,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Ldelete_by_idx, loc_id, FAIL) + FUNC_ENTER_API_META(H5Ldelete_by_idx, loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "i*sIiIohi", loc_id, group_name, idx_type, order, n, lapl_id); /* Check arguments */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index b83d088..f7f0865 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -452,7 +452,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, uint8_t *p; /* Pointer into external link buffer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Lcreate_external, link_loc_id, FAIL) + FUNC_ENTER_API_META(H5Lcreate_external, link_loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "*s*si*sii", file_name, obj_name, link_loc_id, link_name, lcpl_id, lapl_id); @@ -439,7 +439,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, H5G_loc_t obj_loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Olink, obj_id, FAIL) + FUNC_ENTER_API_META(H5Olink, obj_id, H5AC_dxpl_id, FAIL) H5TRACE5("e", "ii*sii", obj_id, new_loc_id, new_name, lcpl_id, lapl_id); /* Check arguments */ @@ -491,7 +491,7 @@ H5Oincr_refcount(hid_t object_id) H5O_loc_t *oloc; herr_t ret_value = SUCCEED; - FUNC_ENTER_API_META(H5Oincr_refcount, object_id, FAIL) + FUNC_ENTER_API_META(H5Oincr_refcount, object_id, H5AC_dxpl_id, FAIL) H5TRACE1("e", "i", object_id); /* Get the object's oloc so we can adjust its link count */ @@ -532,7 +532,7 @@ H5Odecr_refcount(hid_t object_id) H5O_loc_t *oloc; herr_t ret_value = SUCCEED; - FUNC_ENTER_API_META(H5Odecr_refcount, object_id, FAIL) + FUNC_ENTER_API_META(H5Odecr_refcount, object_id, H5AC_dxpl_id, FAIL) H5TRACE1("e", "i", object_id); /* Get the object's oloc so we can adjust its link count */ @@ -720,7 +720,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Oset_comment, obj_id, FAIL) + FUNC_ENTER_API_META(H5Oset_comment, obj_id, H5AC_ind_dxpl_id, FAIL) H5TRACE2("e", "i*s", obj_id, comment); /* Check args */ @@ -760,7 +760,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Oset_comment_by_name, loc_id, FAIL) + FUNC_ENTER_API_META(H5Oset_comment_by_name, loc_id, H5AC_ind_dxpl_id, FAIL) H5TRACE4("e", "i*s*si", loc_id, name, comment, lapl_id); /* Check args */ @@ -1017,7 +1017,7 @@ H5Oclose(hid_t object_id) /* Will this ever change metadata? No need for a transaction unless * it does. */ - FUNC_ENTER_API_META(H5Oclose, object_id, FAIL) + FUNC_ENTER_API_META(H5Oclose, object_id, H5AC_dxpl_id, FAIL) H5TRACE1("e", "i", object_id); /* Get the type of the object and close it in the correct way */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 4df43d8..8370394 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -63,16 +63,16 @@ static void *H5O_cache_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); static herr_t H5O_cache_image_len(const void *thing, size_t *image_len_ptr); -static herr_t H5O_cache_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, +static herr_t H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5O_cache_free_icr(haddr_t addr, size_t len, void *thing); static void *H5O_cache_chk_deserialize(haddr_t addr, size_t len, const void *image, void *udata, hbool_t *dirty); -static herr_t H5O_cache_chk_serialize(const H5F_t *f, haddr_t addr, size_t len, - void *image, void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); +static herr_t H5O_cache_chk_serialize(const H5F_t *f, hid_t dxpl_id, + haddr_t addr, size_t len, void *image, void *thing, unsigned *flags, + haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5O_cache_chk_free_icr(haddr_t addr, size_t len, void *thing); /* Chunk proxy routines */ @@ -81,7 +81,7 @@ static herr_t H5O_chunk_proxy_dest(H5O_chunk_proxy_t *chunk_proxy); /* Chunk routines */ static herr_t H5O_chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image, H5O_common_cache_ud_t *udata, hbool_t *dirty); -static herr_t H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno, +static herr_t H5O_chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno, uint8_t *image); /* Misc. routines */ @@ -362,9 +362,9 @@ H5O_cache_image_len(const void *thing, size_t *image_len_ptr) *------------------------------------------------------------------------- */ static herr_t -H5O_cache_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5O_cache_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, + size_t UNUSED len, void *image, void *_thing, unsigned *flags, + haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5O_t *oh = (H5O_t *)_thing; /* Pointer to the object header */ uint8_t *p; /* Pointer into raw data buffer */ @@ -604,9 +604,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_cache_chk_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, - void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5O_cache_chk_serialize(const H5F_t *f, hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, + unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, + void UNUSED **new_image) { H5O_chunk_proxy_t *chk_proxy = (H5O_chunk_proxy_t *)_thing; /* Pointer to the object header chunk proxy */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 3dd8ee0..55b38db 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -187,7 +187,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Ocopy, dst_loc_id, FAIL) + FUNC_ENTER_API_META(H5Ocopy, dst_loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id); @@ -312,7 +312,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t H5S_t *space = NULL; /* Pointer to dataspace containing region */ herr_t ret_value; /* Return value */ - FUNC_ENTER_API_META(H5Rcreate, loc_id, FAIL) + FUNC_ENTER_API_META(H5Rcreate, loc_id, H5AC_dxpl_id, FAIL) H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id); /* Check args */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 3e28793..3d2c63c 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -55,14 +55,14 @@ /* Metadata cache (H5AC) callbacks */ static void *H5SM_table_deserialize(haddr_t addr, size_t len, const void *image, const void *udata, hbool_t *dirty); -static herr_t H5SM_table_serialize(const H5F_t * f, haddr_t addr, size_t len, void *image, - void *thing, unsigned *flags, haddr_t *new_addr, +static herr_t H5SM_table_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, + size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5SM_table_free_icr(haddr_t addr, size_t len, void *thing); static void *H5SM_list_deserialize(haddr_t addr, size_t len, const void *image, const void *udata, hbool_t *dirty); -static herr_t H5SM_list_serialize(const H5F_t * f, haddr_t addr, size_t len, void *image, - void *thing, unsigned *flags, haddr_t *new_addr, +static herr_t H5SM_list_serialize(const H5F_t * f, hid_t dxpl_id, haddr_t addr, + size_t len, void *image, void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5SM_list_free_icr(haddr_t addr, size_t len, void *thing); @@ -249,9 +249,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5SM_table_serialize(const H5F_t * f, haddr_t UNUSED addr, size_t UNUSED len, void *image, - void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5SM_table_serialize(const H5F_t * f, hid_t UNUSED dxlp_id, haddr_t UNUSED addr, + size_t UNUSED len, void *image, void *_thing, unsigned *flags, + haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5SM_master_table_t *table = (H5SM_master_table_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ @@ -474,9 +474,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5SM_list_serialize(const H5F_t * f, haddr_t UNUSED addr, size_t UNUSED len, void *image, - void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, - size_t UNUSED *new_len, void UNUSED **new_image) +H5SM_list_serialize(const H5F_t * f, hid_t UNUSED dxpl_id, haddr_t UNUSED addr, + size_t UNUSED len, void *image, void *_thing, unsigned *flags, + haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5SM_list_t *list = (H5SM_list_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ @@ -1701,7 +1701,7 @@ H5Tclose(hid_t type_id) H5T_t *dt = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Tclose, type_id, FAIL) + FUNC_ENTER_API_META(H5Tclose, type_id, H5AC_dxpl_id, FAIL) H5TRACE1("e", "i", type_id); /* Check args */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 885227a..96d756e 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -81,7 +81,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, H5T_t *type; /* Datatype for ID */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Tcommit2, loc_id, FAIL) + FUNC_ENTER_API_META(H5Tcommit2, loc_id, H5AC_dxpl_id, FAIL) H5TRACE6("e", "i*siiii", loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id); /* Check arguments */ @@ -230,7 +230,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) H5T_t *type = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Tcommit_anon, loc_id, FAIL) + FUNC_ENTER_API_META(H5Tcommit_anon, loc_id, H5AC_dxpl_id, FAIL) H5TRACE4("e", "iiii", loc_id, type_id, tcpl_id, tapl_id); /* Check arguments */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index fad2b05..b0398d4 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -129,7 +129,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) H5T_t *type; /* Datatype for ID */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_META(H5Tcommit1, loc_id, FAIL) + FUNC_ENTER_API_META(H5Tcommit1, loc_id, H5AC_dxpl_id, FAIL) H5TRACE3("e", "i*si", loc_id, name, type_id); /* Check arguments */ diff --git a/src/H5private.h b/src/H5private.h index c7402e2..53ef5c1 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1731,7 +1731,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Use this macro for API functions that [could] modify metadata */ -#define FUNC_ENTER_API_META(func_name, id, err) {{ \ +#define FUNC_ENTER_API_META(func_name, id, dxpl_id, err) {{ \ { \ /* Metadata journaling variables */ \ uint64_t trans_num = 0; \ @@ -1739,6 +1739,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); hbool_t do_transaction = FALSE; \ hbool_t id_oloc_open = FALSE; \ hbool_t transaction_begun = FALSE; \ + hid_t trans_dxpl_id = dxpl_id; \ /* end - Metadata journaling variables */ \ \ FUNC_ENTER_API_VARS(func_name) \ @@ -1905,7 +1906,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_LEAVE_API_META(ret_value) \ if ( H5AC2_end_transaction(do_transaction, &id_oloc, \ id_oloc_open, transaction_begun, \ - trans_num, FUNC) < 0 ) { \ + trans_dxpl_id, trans_num, FUNC) < 0 ) { \ HDONE_ERROR(H5E_CACHE, H5E_CANTJOURNAL, FAIL, \ "H5AC2_end_transaction() failed."); \ } \ diff --git a/test/cache2_common.c b/test/cache2_common.c index dcc4b13..c27f7f4 100644 --- a/test/cache2_common.c +++ b/test/cache2_common.c @@ -1151,6 +1151,7 @@ serialize(haddr_t addr, herr_t pico_serialize(const H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, haddr_t addr, size_t len, void * image_ptr, @@ -1167,6 +1168,7 @@ pico_serialize(const H5F_t UNUSED *f, herr_t nano_serialize(const H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, haddr_t addr, size_t len, void * image_ptr, @@ -1183,7 +1185,8 @@ nano_serialize(const H5F_t UNUSED *f, herr_t micro_serialize(const H5F_t UNUSED *f, - haddr_t addr, + hid_t UNUSED dxpl_id, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1199,6 +1202,7 @@ micro_serialize(const H5F_t UNUSED *f, herr_t tiny_serialize(const H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, haddr_t addr, size_t len, void * image_ptr, @@ -1215,7 +1219,8 @@ tiny_serialize(const H5F_t UNUSED *f, herr_t small_serialize(const H5F_t UNUSED *f, - haddr_t addr, + hid_t UNUSED dxpl_id, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1231,7 +1236,8 @@ small_serialize(const H5F_t UNUSED *f, herr_t medium_serialize(const H5F_t UNUSED *f, - haddr_t addr, + hid_t UNUSED dxpl_id, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1247,7 +1253,8 @@ medium_serialize(const H5F_t UNUSED *f, herr_t large_serialize(const H5F_t UNUSED *f, - haddr_t addr, + hid_t UNUSED dxpl_id, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1263,6 +1270,7 @@ large_serialize(const H5F_t UNUSED *f, herr_t huge_serialize(const H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, haddr_t addr, size_t len, void * image_ptr, @@ -1279,7 +1287,8 @@ huge_serialize(const H5F_t UNUSED *f, herr_t monster_serialize(const H5F_t UNUSED *f, - haddr_t addr, + hid_t UNUSED dxpl_id, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1295,7 +1304,8 @@ monster_serialize(const H5F_t UNUSED *f, herr_t variable_serialize(const H5F_t UNUSED *f, - haddr_t addr, + hid_t UNUSED dxpl_id, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1689,16 +1699,18 @@ dirty_entry2(H5F_t * file_ptr, int32_t idx, hbool_t dirty_pin) { - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; test_entry_t * base_addr; test_entry_t * entry_ptr; - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); - if ( pass2 ) { + cache_ptr = file_ptr->shared->cache2; + + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); + if ( dirty_pin ) { if ( ! entry_in_cache2(cache_ptr, type, idx) ) { @@ -1766,29 +1778,30 @@ execute_flush_op2(H5F_t * file_ptr, unsigned * flags_ptr) { /* const char * fcn_name = "execute_flush_op2()"; */ - H5C2_t * cache_ptr = file_ptr->shared->cache2; - - HDassert( cache_ptr != NULL ); - HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); - HDassert( entry_ptr != NULL ); - HDassert( entry_ptr = entry_ptr->self ); - HDassert( entry_ptr->header.addr == entry_ptr->addr ); - HDassert( ( entry_ptr->flush_op_self_resize_in_progress ) || - ( entry_ptr->header.size == entry_ptr->size ) ); - HDassert( op_ptr != NULL ); - HDassert( ( 0 <= entry_ptr->type ) && - ( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= entry_ptr->index ) && - ( entry_ptr->index <= max_indices2[entry_ptr->type] ) ); - HDassert( ( 0 <= op_ptr->type ) && - ( op_ptr->type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= op_ptr->idx ) && - ( op_ptr->idx <= max_indices2[op_ptr->type] ) ); - HDassert( ( op_ptr->flag == FALSE ) || ( op_ptr->flag == TRUE ) ); - HDassert( flags_ptr != NULL ); + H5C2_t * cache_ptr; if ( pass2 ) { + cache_ptr = file_ptr->shared->cache2; + HDassert( cache_ptr != NULL ); + HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); + HDassert( entry_ptr != NULL ); + HDassert( entry_ptr = entry_ptr->self ); + HDassert( entry_ptr->header.addr == entry_ptr->addr ); + HDassert( ( entry_ptr->flush_op_self_resize_in_progress ) || + ( entry_ptr->header.size == entry_ptr->size ) ); + HDassert( op_ptr != NULL ); + HDassert( ( 0 <= entry_ptr->type ) && + ( entry_ptr->type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= entry_ptr->index ) && + ( entry_ptr->index <= max_indices2[entry_ptr->type] ) ); + HDassert( ( 0 <= op_ptr->type ) && + ( op_ptr->type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= op_ptr->idx ) && + ( op_ptr->idx <= max_indices2[op_ptr->type] ) ); + HDassert( ( op_ptr->flag == FALSE ) || ( op_ptr->flag == TRUE ) ); + HDassert( flags_ptr != NULL ); + switch ( op_ptr->op_code ) { case FLUSH_OP__NO_OP: @@ -2084,18 +2097,20 @@ resize_entry2(H5F_t * file_ptr, size_t new_size, hbool_t resize_pin) { - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; test_entry_t * base_addr; test_entry_t * entry_ptr; - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( type == VARIABLE_ENTRY_TYPE ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); - HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes2[type] ) ); - if ( pass2 ) { + cache_ptr = file_ptr->shared->cache2; + + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( type == VARIABLE_ENTRY_TYPE ); + HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); + HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes2[type] ) ); + base_addr = entries2[type]; entry_ptr = &(base_addr[idx]); @@ -2164,19 +2179,20 @@ resize_pinned_entry2(H5F_t * file_ptr, int32_t idx, size_t new_size) { - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr; - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); - HDassert( type = VARIABLE_ENTRY_TYPE ) ; - HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes2[type] ) ); - if ( pass2 ) { + cache_ptr = file_ptr->shared->cache2; + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); + HDassert( type = VARIABLE_ENTRY_TYPE ) ; + HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes2[type] ) ); + if ( ! entry_in_cache2(cache_ptr, type, idx) ) { pass2 = FALSE; @@ -2989,7 +3005,7 @@ expunge_entry2(H5F_t * file_ptr, { /* const char * fcn_name = "expunge_entry2()"; */ #ifndef NDEBUG - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; #endif /* NDEBUG */ herr_t result; test_entry_t * base_addr; @@ -2997,6 +3013,10 @@ expunge_entry2(H5F_t * file_ptr, if ( pass2 ) { +#ifndef NDEBUG + cache_ptr = file_ptr->shared->cache2; +#endif /* NDEBUG */ + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3053,13 +3073,11 @@ flush_cache2(H5F_t * file_ptr, hbool_t dump_detailed_stats) { const char * fcn_name = "flush_cache2()"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; hbool_t show_progress = FALSE; herr_t result = 0; int mile_post = 0; - HDassert(file_ptr); - if ( show_progress ) { HDfprintf(stdout, "%s: mile_post = %d.\n", fcn_name, mile_post++); /* 0 */ @@ -3074,6 +3092,10 @@ flush_cache2(H5F_t * file_ptr, if ( pass2 ) { + HDassert(file_ptr); + + cache_ptr = file_ptr->shared->cache2; + if ( destroy_entries ) { result = H5C2_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, @@ -3162,7 +3184,7 @@ insert_entry2(H5F_t * file_ptr, hbool_t UNUSED dirty, unsigned int flags) { - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; herr_t result; hbool_t insert_pinned; test_entry_t * base_addr; @@ -3170,6 +3192,8 @@ insert_entry2(H5F_t * file_ptr, if ( pass2 ) { + cache_ptr = file_ptr->shared->cache2; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3268,7 +3292,7 @@ mark_pinned_entry_dirty2(H5F_t * file_ptr, { /* const char * fcn_name = "mark_pinned_entry_dirty2()"; */ #ifndef NDEBUG - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; #endif /* NDEBUG */ herr_t result; test_entry_t * base_addr; @@ -3276,6 +3300,10 @@ mark_pinned_entry_dirty2(H5F_t * file_ptr, if ( pass2 ) { +#ifndef NDEBUG + cache_ptr = file_ptr->shared->cache2; +#endif /* NDEBUG */ + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3366,7 +3394,7 @@ mark_pinned_or_protected_entry_dirty2(H5F_t * file_ptr, { /* const char * fcn_name = "mark_pinned_or_protected_entry_dirty2()"; */ #ifndef NDEBUG - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; #endif /* NDEBUG */ herr_t result; test_entry_t * base_addr; @@ -3374,6 +3402,10 @@ mark_pinned_or_protected_entry_dirty2(H5F_t * file_ptr, if ( pass2 ) { +#ifndef NDEBUG + cache_ptr = file_ptr->shared->cache2; +#endif /* NDEBUG */ + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3579,7 +3611,7 @@ pin_protected_entry2(H5F_t * file_ptr, { /* const char * fcn_name = "pin_protected_entry2()"; */ #ifndef NDEBUG - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; #endif /* NDEBUG */ herr_t result; test_entry_t * base_addr; @@ -3587,6 +3619,10 @@ pin_protected_entry2(H5F_t * file_ptr, if ( pass2 ) { +#ifndef NDEBUG + cache_ptr = file_ptr->shared->cache2; +#endif /* NDEBUG */ + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3659,7 +3695,7 @@ protect_entry2(H5F_t * file_ptr, int32_t idx) { const char * fcn_name = "protect_entry2()"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; hbool_t verbose = FALSE; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -3672,6 +3708,8 @@ protect_entry2(H5F_t * file_ptr, if ( pass2 ) { + cache_ptr = file_ptr->shared->cache2; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3783,13 +3821,15 @@ protect_entry_ro2(H5F_t * file_ptr, int32_t idx) { /* const char * fcn_name = "protect_entry_ro2()"; */ - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; test_entry_t * base_addr; test_entry_t * entry_ptr; H5C2_cache_entry_t * cache_entry_ptr; if ( pass2 ) { + cache_ptr = file_ptr->shared->cache2; + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3866,7 +3906,7 @@ unpin_entry2(H5F_t * file_ptr, { /* const char * fcn_name = "unpin_entry2()"; */ #ifndef NDEBUG - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; #endif /* NDEBUG */ herr_t result; test_entry_t * base_addr; @@ -3874,6 +3914,10 @@ unpin_entry2(H5F_t * file_ptr, if ( pass2 ) { +#ifndef NDEBUG + cache_ptr = file_ptr->shared->cache2; +#endif /* NDEBUG */ + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -3957,7 +4001,7 @@ unprotect_entry2(H5F_t * file_ptr, { const char * fcn_name = "unprotect_entry2()"; #ifndef NDEBUG - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; #endif /* NDEBUG */ herr_t result; hbool_t verbose = FALSE; @@ -3974,6 +4018,10 @@ unprotect_entry2(H5F_t * file_ptr, if ( pass2 ) { +#ifndef NDEBUG + cache_ptr = file_ptr->shared->cache2; +#endif /* NDEBUG */ + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -4157,7 +4205,7 @@ unprotect_entry_with_size_change2(H5F_t * file_ptr, { /* const char * fcn_name = "unprotect_entry_with_size_change2()"; */ #ifndef NDEBUG - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; #endif /* NDEBUG */ herr_t result; hbool_t dirty_flag_set; @@ -4169,6 +4217,10 @@ unprotect_entry_with_size_change2(H5F_t * file_ptr, if ( pass2 ) { +#ifndef NDEBUG + cache_ptr = file_ptr->shared->cache2; +#endif /* NDEBUG */ + HDassert( cache_ptr ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); @@ -4293,21 +4345,26 @@ row_major_scan_forward2(H5F_t * file_ptr, int dirty_unprotects) { const char * fcn_name = "row_major_scan_forward2"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; - int32_t type; + H5C2_t * cache_ptr; + int32_t type = 0; int32_t idx; int32_t local_max_index; if ( verbose ) HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag >= 10 ); + if ( pass2 ) { - type = 0; + cache_ptr = file_ptr->shared->cache2; - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); - H5C2_stats__reset(cache_ptr); + HDassert( lag >= 10 ); + + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } while ( ( pass2 ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) @@ -4653,8 +4710,8 @@ hl_row_major_scan_forward2(H5F_t * file_ptr, hbool_t dirty_inserts) { const char * fcn_name = "hl_row_major_scan_forward2"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; - int32_t type; + H5C2_t * cache_ptr; + int32_t type = 0; int32_t idx; int32_t i; int32_t lag = 100; @@ -4663,15 +4720,19 @@ hl_row_major_scan_forward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 200 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass2 ) { - type = 0; + cache_ptr = file_ptr->shared->cache2; - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 200 ); + HDassert( max_index <= MAX_ENTRIES ); - H5C2_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } while ( ( pass2 ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) @@ -4775,21 +4836,25 @@ row_major_scan_backward2(H5F_t * file_ptr, int dirty_unprotects) { const char * fcn_name = "row_major_scan_backward2"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; - int32_t type; + H5C2_t * cache_ptr; + int32_t type = NUMBER_OF_ENTRY_TYPES - 1; int32_t idx; int32_t local_max_index; if ( verbose ) HDfprintf(stdout, "%s(): Entering.\n", fcn_name); - HDassert( lag >= 10 ); + if ( pass2 ) { - type = NUMBER_OF_ENTRY_TYPES - 1; + cache_ptr = file_ptr->shared->cache2; + + HDassert( cache_ptr != NULL ); + HDassert( lag >= 10 ); - if ( ( pass2 ) && ( reset_stats ) ) { + if ( reset_stats ) { - H5C2_stats__reset(cache_ptr); + H5C2_stats__reset(cache_ptr); + } } while ( ( pass2 ) && ( type >= 0 ) ) @@ -5102,8 +5167,8 @@ hl_row_major_scan_backward2(H5F_t * file_ptr, hbool_t dirty_inserts) { const char * fcn_name = "hl_row_major_scan_backward2"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; - int32_t type; + H5C2_t * cache_ptr; + int32_t type = NUMBER_OF_ENTRY_TYPES - 1; int32_t idx; int32_t i; int32_t lag = 100; @@ -5112,15 +5177,19 @@ hl_row_major_scan_backward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 200 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass2 ) { - type = NUMBER_OF_ENTRY_TYPES - 1; + cache_ptr = file_ptr->shared->cache2; - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 200 ); + HDassert( max_index <= MAX_ENTRIES ); - H5C2_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } while ( ( pass2 ) && ( type >= 0 ) ) @@ -5215,27 +5284,30 @@ col_major_scan_forward2(H5F_t * file_ptr, int dirty_unprotects) { const char * fcn_name = "col_major_scan_forward2()"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; int i; - int32_t type; + int32_t type = 0; int32_t idx; int32_t local_max_index[NUMBER_OF_ENTRY_TYPES]; if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) - { - local_max_index[i] = MIN(max_index, max_indices2[i]); - } + if ( pass2 ) { - HDassert( lag > 5 ); + cache_ptr = file_ptr->shared->cache2; - type = 0; + for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) + { + local_max_index[i] = MIN(max_index, max_indices2[i]); + } - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( lag > 5 ); - H5C2_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } idx = -lag; @@ -5335,7 +5407,7 @@ hl_col_major_scan_forward2(H5F_t * file_ptr, { const char * fcn_name = "hl_col_major_scan_forward2()"; H5C2_t * cache_ptr = file_ptr->shared->cache2; - int32_t type; + int32_t type = 0; int32_t idx; int32_t lag = 200; int32_t i; @@ -5344,15 +5416,19 @@ hl_col_major_scan_forward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 500 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass2 ) { - type = 0; + cache_ptr = file_ptr->shared->cache2; - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 500 ); + HDassert( max_index <= MAX_ENTRIES ); - H5C2_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } idx = 0; @@ -5467,16 +5543,23 @@ col_major_scan_backward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) - { - local_max_index[i] = MIN(max_index, max_indices2[i]); - } + if ( pass2 ) { - HDassert( lag > 5 ); + cache_ptr = file_ptr->shared->cache2; - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); - H5C2_stats__reset(cache_ptr); + for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) + { + local_max_index[i] = MIN(max_index, max_indices2[i]); + } + + HDassert( lag > 5 ); + + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } /* idx = MAX_ENTRIES + lag; */ @@ -5587,7 +5670,7 @@ hl_col_major_scan_backward2(H5F_t * file_ptr, { const char * fcn_name = "hl_col_major_scan_backward2()"; H5C2_t * cache_ptr = file_ptr->shared->cache2; - int32_t type; + int32_t type = 0; int32_t idx; int32_t lag = 50; int32_t i; @@ -5596,20 +5679,24 @@ hl_col_major_scan_backward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - HDassert( lag > 5 ); - HDassert( max_index >= 500 ); - HDassert( max_index <= MAX_ENTRIES ); + if ( pass2 ) { - type = 0; + cache_ptr = file_ptr->shared->cache2; + + HDassert( cache_ptr != NULL ); + HDassert( lag > 5 ); + HDassert( max_index >= 500 ); + HDassert( max_index <= MAX_ENTRIES ); - local_max_index = MIN(max_index, MAX_ENTRIES); + local_max_index = MIN(max_index, MAX_ENTRIES); - if ( ( pass2 ) && ( reset_stats ) ) { + if ( ( pass2 ) && ( reset_stats ) ) { - H5C2_stats__reset(cache_ptr); - } + H5C2_stats__reset(cache_ptr); + } - idx = local_max_index; + idx = local_max_index; + } while ( ( pass2 ) && ( idx >= 0 ) ) { diff --git a/test/cache2_common.h b/test/cache2_common.h index ea6f6b7..71b7e8f 100644 --- a/test/cache2_common.h +++ b/test/cache2_common.h @@ -566,43 +566,53 @@ herr_t huge_image_len(void *thing, size_t *image_len_ptr); herr_t monster_image_len(void *thing, size_t *image_len_ptr); herr_t variable_image_len(void *thing, size_t *image_len_ptr); -herr_t pico_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t pico_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t nano_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t nano_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t micro_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t micro_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t tiny_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t tiny_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t small_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t small_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t medium_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t medium_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t large_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t large_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t huge_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t huge_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t monster_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t monster_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t variable_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, +herr_t variable_serialize(const H5F_t *f, hid_t dxpl_id, haddr_t addr, + size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); diff --git a/test/cache2_journal.c b/test/cache2_journal.c index 0f5d70d..1aaf58e 100644 --- a/test/cache2_journal.c +++ b/test/cache2_journal.c @@ -548,7 +548,8 @@ end_trans(H5F_t * file_ptr, if ( pass2 ) { - result = H5C2_end_transaction(file_ptr, cache_ptr, trans_num, trans_name); + result = H5C2_end_transaction(file_ptr, H5AC2_dxpl_id, cache_ptr, + trans_num, trans_name); if ( result < 0 ) { @@ -720,7 +721,7 @@ jrnl_col_major_scan_backward2(H5F_t * file_ptr, uint64_t trans_num) { const char * fcn_name = "jrnl_col_major_scan_backward2()"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; int i; int mile_stone = 1; int32_t type; @@ -730,19 +731,26 @@ jrnl_col_major_scan_backward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) - { - local_max_index[i] = MIN(max_index, max_indices2[i]); - } + if ( pass2 ) { - HDassert( lag > 5 ); + cache_ptr = file_ptr->shared->cache2; - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); - H5C2_stats__reset(cache_ptr); - } + for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) + { + local_max_index[i] = MIN(max_index, max_indices2[i]); + } + + HDassert( lag > 5 ); - idx = local_max_index[NUMBER_OF_ENTRY_TYPES - 1] + lag; + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } + + idx = local_max_index[NUMBER_OF_ENTRY_TYPES - 1] + lag; + } if ( verbose ) /* 1 */ HDfprintf(stdout, "%s: point %d.\n", fcn_name, mile_stone++); @@ -878,7 +886,7 @@ jrnl_col_major_scan_forward2(H5F_t * file_ptr, uint64_t trans_num) { const char * fcn_name = "jrnl_col_major_scan_forward2()"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; int i; int32_t type; int32_t idx; @@ -887,21 +895,28 @@ jrnl_col_major_scan_forward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s: entering.\n", fcn_name); - for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) - { - local_max_index[i] = MIN(max_index, max_indices2[i]); - } + if ( pass2 ) { - HDassert( lag > 5 ); + cache_ptr = file_ptr->shared->cache2; - type = 0; + HDassert( cache_ptr != NULL ); - if ( ( pass2 ) && ( reset_stats ) ) { + for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ ) + { + local_max_index[i] = MIN(max_index, max_indices2[i]); + } - H5C2_stats__reset(cache_ptr); - } + HDassert( lag > 5 ); - idx = -lag; + type = 0; + + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } + + idx = -lag; + } while ( ( pass2 ) && ( (idx - lag) <= MAX_ENTRIES ) ) { @@ -1032,7 +1047,7 @@ jrnl_row_major_scan_backward2(H5F_t * file_ptr, uint64_t trans_num) { const char * fcn_name = "jrnl_row_major_scan_backward2"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; int32_t type; int32_t idx; int32_t local_max_index; @@ -1042,15 +1057,21 @@ jrnl_row_major_scan_backward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s(): Entering.\n", fcn_name); - HDassert( lag >= 10 ); + if ( pass2 ) { - type = NUMBER_OF_ENTRY_TYPES - 1; + cache_ptr = file_ptr->shared->cache2; - if ( ( pass2 ) && ( reset_stats ) ) { + HDassert( cache_ptr != NULL ); + HDassert( lag >= 10 ); - H5C2_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } + type = NUMBER_OF_ENTRY_TYPES - 1; + while ( ( pass2 ) && ( type >= 0 ) ) { local_max_index = MIN(max_index, max_indices2[type]); @@ -1459,7 +1480,7 @@ jrnl_row_major_scan_forward2(H5F_t * file_ptr, uint64_t trans_num) { const char * fcn_name = "jrnl_row_major_scan_forward2"; - H5C2_t * cache_ptr = file_ptr->shared->cache2; + H5C2_t * cache_ptr; int32_t type; int32_t idx; int32_t local_max_index; @@ -1469,13 +1490,19 @@ jrnl_row_major_scan_forward2(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "%s(): entering.\n", fcn_name); - HDassert( lag >= 10 ); + if ( pass2 ) { + + cache_ptr = file_ptr->shared->cache2; - type = 0; + HDassert( cache_ptr != NULL ); + HDassert( lag >= 10 ); - if ( ( pass2 ) && ( reset_stats ) ) { + type = 0; - H5C2_stats__reset(cache_ptr); + if ( reset_stats ) { + + H5C2_stats__reset(cache_ptr); + } } while ( ( pass2 ) && ( type < NUMBER_OF_ENTRY_TYPES ) ) @@ -6668,7 +6695,8 @@ verify_mdj_file_marking_on_create(void) * initialization. */ H5C2_begin_transaction(cache_ptr, &trans_num, "dummy"); - H5C2_end_transaction(file_ptr, cache_ptr, trans_num, "dummy"); + H5C2_end_transaction(file_ptr, H5AC2_dxpl_id, cache_ptr, + trans_num, "dummy"); if ( show_progress ) { @@ -8602,7 +8630,8 @@ verify_mdj_file_unmarking_on_recovery(void) * initialization. */ H5C2_begin_transaction(cache_ptr, &trans_num, "dummy"); - H5C2_end_transaction(file_ptr, cache_ptr, trans_num, "dummy"); + H5C2_end_transaction(file_ptr, H5AC2_dxpl_id, cache_ptr, + trans_num, "dummy"); if ( show_progress ) { diff --git a/testpar/t_cache2.c b/testpar/t_cache2.c index 85b574e..e8ad9cb 100644 --- a/testpar/t_cache2.c +++ b/testpar/t_cache2.c @@ -332,6 +332,7 @@ static herr_t datum_image_len(void *thing, size_t *image_len_ptr); static herr_t datum_serialize(const H5F_t *f, + hid_t dxpl_id, haddr_t addr, size_t len, void * image_ptr, @@ -1996,8 +1997,9 @@ datum_image_len(void *thing, herr_t datum_serialize(const H5F_t UNUSED *f, - UNUSED haddr_t addr, - UNUSED size_t len, + hid_t UNUSED dxpl_id, + haddr_t UNUSED addr, + size_t UNUSED len, void * image_ptr, void * thing, unsigned * flags_ptr, |