diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-31 13:20:42 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-31 13:20:42 (GMT) |
commit | 0ac0358a80e98142e1039fb1bc021f7a20744332 (patch) | |
tree | cb3586ae9e90a3c3b0e5f242f25fafa324c3e9f1 /src | |
parent | 972a1bba5dab768d46282c9205c3670a3a6c80e7 (diff) | |
download | hdf5-0ac0358a80e98142e1039fb1bc021f7a20744332.zip hdf5-0ac0358a80e98142e1039fb1bc021f7a20744332.tar.gz hdf5-0ac0358a80e98142e1039fb1bc021f7a20744332.tar.bz2 |
[svn-r16630] Description:
Add 'notify' callback to metadata cache clients, so that they can be
aware when the cache has taken/will take certain actions. Notifications are
urrently limited to when an entry has successfully entered the cache (via an
insertion or a load from the file) and when an entry is about to be evicted
from the cache.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 8 | ||||
-rw-r--r-- | src/H5ACprivate.h | 11 | ||||
-rw-r--r-- | src/H5B.c | 4 | ||||
-rw-r--r-- | src/H5B2.c | 2 | ||||
-rw-r--r-- | src/H5B2cache.c | 3 | ||||
-rw-r--r-- | src/H5B2int.c | 4 | ||||
-rw-r--r-- | src/H5Bcache.c | 1 | ||||
-rw-r--r-- | src/H5C.c | 44 | ||||
-rw-r--r-- | src/H5Cprivate.h | 20 | ||||
-rw-r--r-- | src/H5EAcache.c | 5 | ||||
-rw-r--r-- | src/H5EAdblkpage.c | 2 | ||||
-rw-r--r-- | src/H5EAdblock.c | 2 | ||||
-rw-r--r-- | src/H5EAhdr.c | 2 | ||||
-rw-r--r-- | src/H5EAiblock.c | 5 | ||||
-rw-r--r-- | src/H5EAsblock.c | 2 | ||||
-rw-r--r-- | src/H5Edefin.h | 1 | ||||
-rw-r--r-- | src/H5Einit.h | 5 | ||||
-rw-r--r-- | src/H5Epubgen.h | 2 | ||||
-rw-r--r-- | src/H5Eterm.h | 1 | ||||
-rw-r--r-- | src/H5F.c | 2 | ||||
-rw-r--r-- | src/H5FS.c | 4 | ||||
-rw-r--r-- | src/H5FScache.c | 2 | ||||
-rw-r--r-- | src/H5Gcache.c | 1 | ||||
-rw-r--r-- | src/H5Gnode.c | 2 | ||||
-rw-r--r-- | src/H5HFcache.c | 3 | ||||
-rw-r--r-- | src/H5HFdblock.c | 2 | ||||
-rw-r--r-- | src/H5HFhdr.c | 2 | ||||
-rw-r--r-- | src/H5HFiblock.c | 2 | ||||
-rw-r--r-- | src/H5HG.c | 5 | ||||
-rw-r--r-- | src/H5HGcache.c | 1 | ||||
-rw-r--r-- | src/H5HL.c | 2 | ||||
-rw-r--r-- | src/H5HLcache.c | 1 | ||||
-rw-r--r-- | src/H5O.c | 2 | ||||
-rw-r--r-- | src/H5Ocache.c | 1 | ||||
-rw-r--r-- | src/H5Ocopy.c | 2 | ||||
-rwxr-xr-x | src/H5SM.c | 4 | ||||
-rw-r--r-- | src/H5SMcache.c | 2 | ||||
-rw-r--r-- | src/H5err.txt | 1 |
38 files changed, 132 insertions, 33 deletions
@@ -1273,12 +1273,12 @@ done: */ herr_t -H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags) +H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, + void *thing, unsigned int flags, void *udata) { herr_t result; H5AC_info_t *info; H5AC_t *cache; - herr_t ret_value=SUCCEED; /* Return value */ #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ @@ -1287,6 +1287,7 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * size_t trace_entry_size = 0; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5AC_set, FAIL) @@ -1355,7 +1356,8 @@ H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void * type, addr, thing, - flags); + flags, + udata); if ( result < 0 ) { diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index b84142a..55d47f4 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -118,6 +118,9 @@ typedef enum { * * CLEAR: Just marks object as non-dirty. * + * NOTIFY: Notify client that an action on an entry has taken/will take + * place + * * SIZE: Report the size (on disk) of the specified cache object. * Note that the space allocated on disk may not be contiguous. */ @@ -126,10 +129,16 @@ typedef enum { #define H5AC_CALLBACK__SIZE_CHANGED_FLAG H5C_CALLBACK__SIZE_CHANGED_FLAG #define H5AC_CALLBACK__RENAMED_FLAG H5C_CALLBACK__RENAMED_FLAG +/* Aliases for 'notify action' type & values */ +typedef H5C_notify_action_t H5AC_notify_action_t; +#define H5AC_NOTIFY_ACTION_AFTER_INSERT H5C_NOTIFY_ACTION_AFTER_INSERT +#define H5AC_NOTIFY_ACTION_BEFORE_EVICT H5C_NOTIFY_ACTION_BEFORE_EVICT + typedef H5C_load_func_t H5AC_load_func_t; typedef H5C_flush_func_t H5AC_flush_func_t; typedef H5C_dest_func_t H5AC_dest_func_t; typedef H5C_clear_func_t H5AC_clear_func_t; +typedef H5C_notify_func_t H5AC_notify_func_t; typedef H5C_size_func_t H5AC_size_func_t; typedef H5C_class_t H5AC_class_t; @@ -277,7 +286,7 @@ H5_DLL herr_t H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr); H5_DLL herr_t H5AC_get_entry_status(H5F_t * f, haddr_t addr, unsigned * status_ptr); H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, - haddr_t addr, void *thing, unsigned int flags); + haddr_t addr, void *thing, unsigned int flags, void *udata); H5_DLL herr_t H5AC_pin_protected_entry(H5F_t * f, void * thing); H5_DLL herr_t H5AC_create_flush_dependency(H5F_t *f, void *parent_thing, void *child_thing); @@ -257,7 +257,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, /* * Cache the new B-tree node. */ - if (H5AC_set(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache") #ifdef H5B_DEBUG H5B_assert(f, dxpl_id, *addr_p, shared->type, udata); @@ -713,7 +713,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HDmemcpy(H5B_NKEY(new_bt,shared,2), rt_key, shared->type->sizeof_nkey); /* Insert the modified copy of the old root into the file again */ - if (H5AC_set(f, dxpl_id, H5AC_BT, addr, new_bt, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_BT, addr, new_bt, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush old B-tree root node") #ifdef H5B_DEBUG @@ -137,7 +137,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree header") /* Cache the new B-tree node */ - if(H5AC_set(f, dxpl_id, H5AC_BT2_HDR, *addr_p, bt2, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_BT2_HDR, *addr_p, bt2, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree header to cache") done: diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 903b4f3..c44820a 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -94,6 +94,7 @@ const H5AC_class_t H5AC_BT2_HDR[1] = {{ (H5AC_flush_func_t)H5B2_cache_hdr_flush, (H5AC_dest_func_t)H5B2_cache_hdr_dest, (H5AC_clear_func_t)H5B2_cache_hdr_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5B2_cache_hdr_size, }}; @@ -104,6 +105,7 @@ const H5AC_class_t H5AC_BT2_INT[1] = {{ (H5AC_flush_func_t)H5B2_cache_internal_flush, (H5AC_dest_func_t)H5B2_cache_internal_dest, (H5AC_clear_func_t)H5B2_cache_internal_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5B2_cache_internal_size, }}; @@ -114,6 +116,7 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{ (H5AC_flush_func_t)H5B2_cache_leaf_flush, (H5AC_dest_func_t)H5B2_cache_leaf_dest, (H5AC_clear_func_t)H5B2_cache_leaf_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5B2_cache_leaf_size, }}; diff --git a/src/H5B2int.c b/src/H5B2int.c index b5d4048..d678443 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -1964,7 +1964,7 @@ HDmemset(leaf->leaf_native, 0, shared->type->nrec_size * shared->node_info[0].ma HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") /* Cache the new B-tree node */ - if(H5AC_set(f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") done: @@ -2045,7 +2045,7 @@ HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (shared->node_info[de HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node") /* Cache the new B-tree node */ - if(H5AC_set(f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache") done: diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 9765552..99930e6 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -71,6 +71,7 @@ const H5AC_class_t H5AC_BT[1] = {{ (H5AC_flush_func_t)H5B_flush, (H5AC_dest_func_t)H5B_dest, (H5AC_clear_func_t)H5B_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5B_compute_size, }}; @@ -2798,6 +2798,7 @@ static herr_t H5C_epoch_marker_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, unsigned *flags_ptr); static herr_t H5C_epoch_marker_dest(H5F_t *f, void *thing); static herr_t H5C_epoch_marker_clear(H5F_t *f, void *thing, hbool_t dest); +static herr_t H5C_epoch_marker_notify(H5C_notify_action_t action, void *thing, void *udata); static herr_t H5C_epoch_marker_size(const H5F_t *f, const void *thing, size_t *size_ptr); const H5C_class_t epoch_marker_class = @@ -2807,6 +2808,7 @@ const H5C_class_t epoch_marker_class = /* flush = */ &H5C_epoch_marker_flush, /* dest = */ &H5C_epoch_marker_dest, /* clear = */ &H5C_epoch_marker_clear, + /* notify = */&H5C_epoch_marker_notify, /* size = */ &H5C_epoch_marker_size }; @@ -2888,6 +2890,21 @@ done: } static herr_t +H5C_epoch_marker_notify(H5C_notify_action_t UNUSED action, + void UNUSED * thing, + void UNUSED * udata) +{ + herr_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_notify) + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + +static herr_t H5C_epoch_marker_size(const H5F_t UNUSED * f, const void UNUSED * thing, size_t UNUSED * size_ptr) @@ -4818,7 +4835,8 @@ H5C_insert_entry(H5F_t * f, const H5C_class_t * type, haddr_t addr, void * thing, - unsigned int flags) + unsigned int flags, + void * udata) { herr_t result; hbool_t first_flush = TRUE; @@ -5069,6 +5087,13 @@ H5C_insert_entry(H5F_t * f, } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + /* If the entry's type has a 'notify' callback send a 'after insertion' + * notice now that the entry is fully integrated into the cache. + */ + if(entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_INSERT, entry_ptr, udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry inserted into cache") + H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) done: @@ -6408,6 +6433,13 @@ H5C_protect(H5F_t * f, * code. If we do this often enough, we may want to optimize this. */ H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, NULL) + + /* If the entry's type has a 'notify' callback send a 'after insertion' + * notice now that the entry is fully integrated into the cache. + */ + if(entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_INSERT, entry_ptr, udata2) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, NULL, "can't notify client about entry inserted into cache") } HDassert( entry_ptr->addr == addr ); @@ -11070,6 +11102,16 @@ H5C_flush_single_entry(H5F_t * f, H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr) } + /* If the entry's type has a 'notify' callback and the entry is about + * to be removed from the cache, send a 'before eviction' notice while + * the entry is still fully integrated in the cache. + */ + if(destroy) { + if(entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") + } /* end if */ + /* Always remove the entry from the hash table on a destroy. On a * flush with destroy, it is cheaper to discard the skip list all at * once rather than remove the entries one by one, so we only delete diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index b539068..14958d0 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -113,6 +113,9 @@ typedef struct H5C_t H5C_t; * * CLEAR: Just marks object as non-dirty. * + * NOTIFY: Notify client that an action on an entry has taken/will take + * place + * * SIZE: Report the size (on disk) of the specified cache object. * Note that the space allocated on disk may not be contiguous. */ @@ -121,6 +124,16 @@ typedef struct H5C_t H5C_t; #define H5C_CALLBACK__SIZE_CHANGED_FLAG 0x1 #define H5C_CALLBACK__RENAMED_FLAG 0x2 +/* Actions that can be reported to 'notify' client callback */ +typedef enum H5C_notify_action_t { + H5C_NOTIFY_ACTION_AFTER_INSERT, /* Entry has been added to the cache */ + /* (could be loaded from file with + * 'protect' call, or inserted + * with 'set' call) + */ + H5C_NOTIFY_ACTION_BEFORE_EVICT /* Entry is about to be evicted from cache */ +} H5C_notify_action_t; + typedef void *(*H5C_load_func_t)(H5F_t *f, hid_t dxpl_id, haddr_t addr, @@ -137,6 +150,9 @@ typedef herr_t (*H5C_dest_func_t)(H5F_t *f, typedef herr_t (*H5C_clear_func_t)(H5F_t *f, void *thing, hbool_t dest); +typedef herr_t (*H5C_notify_func_t)(H5C_notify_action_t action, + void *thing, + void *udata); typedef herr_t (*H5C_size_func_t)(const H5F_t *f, const void *thing, size_t *size_ptr); @@ -147,6 +163,7 @@ typedef struct H5C_class_t { H5C_flush_func_t flush; H5C_dest_func_t dest; H5C_clear_func_t clear; + H5C_notify_func_t notify; H5C_size_func_t size; } H5C_class_t; @@ -1064,7 +1081,8 @@ H5_DLL herr_t H5C_insert_entry(H5F_t * f, const H5C_class_t * type, haddr_t addr, void * thing, - unsigned int flags); + unsigned int flags, + void * udata); H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t * f, hid_t primary_dxpl_id, diff --git a/src/H5EAcache.c b/src/H5EAcache.c index a2326dc..565127f 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -118,6 +118,7 @@ const H5AC_class_t H5AC_EARRAY_HDR[1] = {{ (H5AC_flush_func_t)H5EA__cache_hdr_flush, (H5AC_dest_func_t)H5EA__cache_hdr_dest, (H5AC_clear_func_t)H5EA__cache_hdr_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5EA__cache_hdr_size, }}; @@ -128,6 +129,7 @@ const H5AC_class_t H5AC_EARRAY_IBLOCK[1] = {{ (H5AC_flush_func_t)H5EA__cache_iblock_flush, (H5AC_dest_func_t)H5EA__cache_iblock_dest, (H5AC_clear_func_t)H5EA__cache_iblock_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5EA__cache_iblock_size, }}; @@ -138,6 +140,7 @@ const H5AC_class_t H5AC_EARRAY_SBLOCK[1] = {{ (H5AC_flush_func_t)H5EA__cache_sblock_flush, (H5AC_dest_func_t)H5EA__cache_sblock_dest, (H5AC_clear_func_t)H5EA__cache_sblock_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5EA__cache_sblock_size, }}; @@ -148,6 +151,7 @@ const H5AC_class_t H5AC_EARRAY_DBLOCK[1] = {{ (H5AC_flush_func_t)H5EA__cache_dblock_flush, (H5AC_dest_func_t)H5EA__cache_dblock_dest, (H5AC_clear_func_t)H5EA__cache_dblock_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5EA__cache_dblock_size, }}; @@ -158,6 +162,7 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{ (H5AC_flush_func_t)H5EA__cache_dblk_page_flush, (H5AC_dest_func_t)H5EA__cache_dblk_page_dest, (H5AC_clear_func_t)H5EA__cache_dblk_page_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5EA__cache_dblk_page_size, }}; diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index a8edae1..f566c28 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -178,7 +178,7 @@ HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value") /* Cache the new extensible array data block page */ - if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET, NULL) < 0) H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache") CATCH diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index 07ba3d1..89a81c8 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -204,7 +204,7 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value") /* Cache the new extensible array data block */ - if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET, NULL) < 0) H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache") /* Update extensible array data block statistics */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 0a7ddef..ad0c461 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -434,7 +434,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header") /* Cache the new extensible array header */ - if(H5AC_set(f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET, NULL) < 0) H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache") /* Set address of array header to return */ diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index b931661..7e79cbe 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -231,7 +231,8 @@ HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); } /* end if */ /* Cache the new extensible array index block */ - if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0) + /* (pass in header, so the 'notify' callback can create flush dependency on it) */ + if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET, hdr) < 0) H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache") /* Update extensible array index block statistics */ @@ -281,8 +282,6 @@ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5AC_protect_t rw)) - /* Local variables */ - #ifdef QAK HDfprintf(stderr, "%s: Called\n", FUNC); #endif /* QAK */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index 157d1aa..a57476c 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -231,7 +231,7 @@ HDfprintf(stderr, "%s: sblock->block_off = %Hu\n", FUNC, sblock->block_off); H5V_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks); /* Cache the new extensible array super block */ - if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET, NULL) < 0) H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache") /* Update extensible array super block statistics */ diff --git a/src/H5Edefin.h b/src/H5Edefin.h index b31b31b..adaaa3a 100644 --- a/src/H5Edefin.h +++ b/src/H5Edefin.h @@ -166,6 +166,7 @@ hid_t H5E_CANTEXPUNGE_g = FAIL; /* Unable to expunge a metadata cache en hid_t H5E_CANTRESIZE_g = FAIL; /* Unable to resize a metadata cache entry */ hid_t H5E_CANTDEPEND_g = FAIL; /* Unable to create a flush dependency */ hid_t H5E_CANTUNDEPEND_g = FAIL; /* Unable to destroy a flush dependency */ +hid_t H5E_CANTNOTIFY_g = FAIL; /* Unable to notify object about action */ /* Link related errors */ hid_t H5E_TRAVERSE_g = FAIL; /* Link traversal failure */ diff --git a/src/H5Einit.h b/src/H5Einit.h index 204644f..a9f95b7 100644 --- a/src/H5Einit.h +++ b/src/H5Einit.h @@ -632,6 +632,11 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to destroy a flush dependency") HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_CANTUNDEPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_CANTNOTIFY_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to notify object about action"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTNOTIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") /* Link related errors */ assert(H5E_TRAVERSE_g==(-1)); diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h index 736349a..3debf20 100644 --- a/src/H5Epubgen.h +++ b/src/H5Epubgen.h @@ -268,6 +268,7 @@ H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ #define H5E_CANTRESIZE (H5OPEN H5E_CANTRESIZE_g) #define H5E_CANTDEPEND (H5OPEN H5E_CANTDEPEND_g) #define H5E_CANTUNDEPEND (H5OPEN H5E_CANTUNDEPEND_g) +#define H5E_CANTNOTIFY (H5OPEN H5E_CANTNOTIFY_g) H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */ H5_DLLVAR hid_t H5E_CANTSERIALIZE_g; /* Unable to serialize data from cache */ H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */ @@ -286,6 +287,7 @@ H5_DLLVAR hid_t H5E_CANTEXPUNGE_g; /* Unable to expunge a metadata cache entry H5_DLLVAR hid_t H5E_CANTRESIZE_g; /* Unable to resize a metadata cache entry */ H5_DLLVAR hid_t H5E_CANTDEPEND_g; /* Unable to create a flush dependency */ H5_DLLVAR hid_t H5E_CANTUNDEPEND_g; /* Unable to destroy a flush dependency */ +H5_DLLVAR hid_t H5E_CANTNOTIFY_g; /* Unable to notify object about action */ /* Link related errors */ #define H5E_TRAVERSE (H5OPEN H5E_TRAVERSE_g) diff --git a/src/H5Eterm.h b/src/H5Eterm.h index 8936dc0..86b22f1 100644 --- a/src/H5Eterm.h +++ b/src/H5Eterm.h @@ -168,6 +168,7 @@ H5E_CANTEXPUNGE_g= H5E_CANTRESIZE_g= H5E_CANTDEPEND_g= H5E_CANTUNDEPEND_g= +H5E_CANTNOTIFY_g= /* Link related errors */ H5E_TRAVERSE_g= @@ -1116,7 +1116,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) f->shared->mtab.nalloc = 0; /* Free root group symbol table entry, if any */ - f->shared->root_ent = H5MM_xfree(f->shared->root_ent); + f->shared->root_ent = (H5G_entry_t *)H5MM_xfree(f->shared->root_ent); /* Destroy shared file struct */ f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared); @@ -138,7 +138,7 @@ HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, ncl HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header") /* Cache the new free space header (pinned) */ - if(H5AC_set(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) + if(H5AC_set(f, dxpl_id, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space header to cache") /* Return free space header address to caller, if desired */ @@ -391,7 +391,7 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); HDassert(H5F_addr_defined(fspace->sect_addr)); /* Cache the free space section info */ - if(H5AC_set(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") } /* end if */ else { diff --git a/src/H5FScache.c b/src/H5FScache.c index a7af72b..b896197 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -100,6 +100,7 @@ const H5AC_class_t H5AC_FSPACE_HDR[1] = {{ (H5AC_flush_func_t)H5FS_cache_hdr_flush, (H5AC_dest_func_t)H5FS_cache_hdr_dest, (H5AC_clear_func_t)H5FS_cache_hdr_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5FS_cache_hdr_size, }}; @@ -110,6 +111,7 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{ (H5AC_flush_func_t)H5FS_cache_sinfo_flush, (H5AC_dest_func_t)H5FS_cache_sinfo_dest, (H5AC_clear_func_t)H5FS_cache_sinfo_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5FS_cache_sinfo_size, }}; diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 0e2a699..c17c97f 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -94,6 +94,7 @@ const H5AC_class_t H5AC_SNODE[1] = {{ (H5AC_flush_func_t)H5G_node_flush, (H5AC_dest_func_t)H5G_node_dest, (H5AC_clear_func_t)H5G_node_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5G_node_size, }}; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index fe381fd..ab0569f 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -322,7 +322,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))); if(NULL==sym->entry) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node"); /* * The left and right symbols in an empty tree are both the diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 8ab35cb..0fcca97 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -103,6 +103,7 @@ const H5AC_class_t H5AC_FHEAP_HDR[1] = {{ (H5AC_flush_func_t)H5HF_cache_hdr_flush, (H5AC_dest_func_t)H5HF_cache_hdr_dest, (H5AC_clear_func_t)H5HF_cache_hdr_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5HF_cache_hdr_size, }}; @@ -113,6 +114,7 @@ const H5AC_class_t H5AC_FHEAP_IBLOCK[1] = {{ (H5AC_flush_func_t)H5HF_cache_iblock_flush, (H5AC_dest_func_t)H5HF_cache_iblock_dest, (H5AC_clear_func_t)H5HF_cache_iblock_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5HF_cache_iblock_size, }}; @@ -123,6 +125,7 @@ const H5AC_class_t H5AC_FHEAP_DBLOCK[1] = {{ (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_notify_func_t)NULL, (H5AC_size_func_t)H5HF_cache_dblock_size, }}; diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index c14249c..1a28a54 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -178,7 +178,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(H5AC_set(hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache") /* Increase the allocated heap size */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 4fd527d..92e5f99 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -501,7 +501,7 @@ HDfprintf(stderr, "%s: hdr->id_len = %Zu\n", FUNC, hdr->id_len); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") /* Cache the new fractal heap header */ - if(H5AC_set(f, dxpl_id, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "can't add fractal heap header to cache") /* Set address of heap header to return */ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 8f9eb24..8756142 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -1105,7 +1105,7 @@ HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows); iblock->max_child = 0; /* Cache the new indirect block */ - if(H5AC_set(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, *addr_p, iblock, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, *addr_p, iblock, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap indirect block to cache") done: @@ -249,9 +249,8 @@ HDmemset(heap->chunk, 0, size); } /* Add the heap to the cache */ - if (H5AC_set (f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET)<0) - HGOTO_ERROR (H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, \ - "unable to cache global heap collection"); + if(H5AC_set(f, dxpl_id, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET, NULL) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") ret_value = addr; diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 1a9e92c..747c41e 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -92,6 +92,7 @@ const H5AC_class_t H5AC_GHEAP[1] = {{ (H5AC_flush_func_t)H5HG_flush, (H5AC_dest_func_t)H5HG_dest, (H5AC_clear_func_t)H5HG_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5HG_size, }}; @@ -160,7 +160,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) heap->freelist = NULL; /* add to cache */ - if(H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache heap") done: diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 449e166..fa458ca 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -93,6 +93,7 @@ const H5AC_class_t H5AC_LHEAP[1] = {{ (H5AC_flush_func_t)H5HL_flush, (H5AC_dest_func_t)H5HL_dest, (H5AC_clear_func_t)H5HL_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5HL_size, }}; @@ -1183,7 +1183,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, oh->mesg[0].chunkno = 0; /* Cache object header */ - if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header") /* Set up object location */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 551eca8..6c86681 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -98,6 +98,7 @@ const H5AC_class_t H5AC_OHDR[1] = {{ (H5AC_flush_func_t)H5O_flush, (H5AC_dest_func_t)H5O_dest, (H5AC_clear_func_t)H5O_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5O_size, }}; diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 7b76f3d..d44b9b0 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -719,7 +719,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, } /* end if */ /* Insert destination object header in cache */ - if(H5AC_set(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header") done: @@ -211,7 +211,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") /* Cache the new table */ - if(H5AC_set(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add SOHM table to cache") /* Record the address of the master table in the file */ @@ -635,7 +635,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") /* Put the list into the cache */ - if(H5AC_set(f, dxpl_id, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_set(f, dxpl_id, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") /* Set return value */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 91478c5..d53993e 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -76,6 +76,7 @@ const H5AC_class_t H5AC_SOHM_TABLE[1] = {{ (H5AC_flush_func_t)H5SM_table_flush, (H5AC_dest_func_t)H5SM_table_dest, (H5AC_clear_func_t)H5SM_table_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5SM_table_size, }}; @@ -85,6 +86,7 @@ const H5AC_class_t H5AC_SOHM_LIST[1] = {{ (H5AC_flush_func_t)H5SM_list_flush, (H5AC_dest_func_t)H5SM_list_dest, (H5AC_clear_func_t)H5SM_list_clear, + (H5AC_notify_func_t)NULL, (H5AC_size_func_t)H5SM_list_size, }}; diff --git a/src/H5err.txt b/src/H5err.txt index 64e9729..2c5ca04 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -171,6 +171,7 @@ MINOR, CACHE, H5E_CANTEXPUNGE, Unable to expunge a metadata cache entry MINOR, CACHE, H5E_CANTRESIZE, Unable to resize a metadata cache entry MINOR, CACHE, H5E_CANTDEPEND, Unable to create a flush dependency MINOR, CACHE, H5E_CANTUNDEPEND, Unable to destroy a flush dependency +MINOR, CACHE, H5E_CANTNOTIFY, Unable to notify object about action # B-tree related errors MINOR, BTREE, H5E_NOTFOUND, Object not found |