diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-31 17:32:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-31 17:32:54 (GMT) |
commit | a29e811343bce0275dc44671b767a2eebbf86593 (patch) | |
tree | 11eec69c03676e21a4cbecb7dda280ac76fd1e73 /src | |
parent | 505b31ee08bfd3efc62df84e00602a9fd6c46a4f (diff) | |
download | hdf5-a29e811343bce0275dc44671b767a2eebbf86593.zip hdf5-a29e811343bce0275dc44671b767a2eebbf86593.tar.gz hdf5-a29e811343bce0275dc44671b767a2eebbf86593.tar.bz2 |
[svn-r16634] Description:
Bring r16618:16633 back from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/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 | 18 | ||||
-rw-r--r-- | src/H5ACprivate.h | 13 | ||||
-rw-r--r-- | src/H5B.c | 4 | ||||
-rw-r--r-- | src/H5B2cache.c | 3 | ||||
-rw-r--r-- | src/H5Bcache.c | 1 | ||||
-rw-r--r-- | src/H5C.c | 61 | ||||
-rw-r--r-- | src/H5Cprivate.h | 20 | ||||
-rw-r--r-- | src/H5Dearray.c | 10 | ||||
-rw-r--r-- | src/H5EA.c | 51 | ||||
-rw-r--r-- | src/H5EAcache.c | 259 | ||||
-rw-r--r-- | src/H5EAdbg.c | 14 | ||||
-rw-r--r-- | src/H5EAdblkpage.c | 19 | ||||
-rw-r--r-- | src/H5EAdblock.c | 40 | ||||
-rw-r--r-- | src/H5EAhdr.c | 2 | ||||
-rw-r--r-- | src/H5EAiblock.c | 24 | ||||
-rw-r--r-- | src/H5EAint.c | 63 | ||||
-rw-r--r-- | src/H5EApkg.h | 60 | ||||
-rw-r--r-- | src/H5EAprivate.h | 25 | ||||
-rw-r--r-- | src/H5EAsblock.c | 39 | ||||
-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/H5FScache.c | 2 | ||||
-rw-r--r-- | src/H5Gbtree2.c | 8 | ||||
-rw-r--r-- | src/H5Gcache.c | 1 | ||||
-rw-r--r-- | src/H5HFcache.c | 3 | ||||
-rw-r--r-- | src/H5HG.c | 5 | ||||
-rw-r--r-- | src/H5HGcache.c | 1 | ||||
-rw-r--r-- | src/H5HLcache.c | 1 | ||||
-rw-r--r-- | src/H5Ocache.c | 1 | ||||
-rw-r--r-- | src/H5SMcache.c | 2 | ||||
-rw-r--r-- | src/H5err.txt | 1 |
34 files changed, 600 insertions, 162 deletions
@@ -1154,6 +1154,8 @@ H5AC_get_entry_status(H5F_t * f, hbool_t is_dirty; hbool_t is_protected; hbool_t is_pinned; + hbool_t is_flush_dep_child; + hbool_t is_flush_dep_parent; size_t entry_size; unsigned status = 0; @@ -1168,7 +1170,8 @@ H5AC_get_entry_status(H5F_t * f, } result = H5C_get_entry_status(cache_ptr, addr, &entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned); + &is_dirty, &is_protected, &is_pinned, &is_flush_dep_parent, + &is_flush_dep_child); if ( result < 0 ) { @@ -1188,6 +1191,12 @@ H5AC_get_entry_status(H5F_t * f, if ( is_pinned ) status |= H5AC_ES__IS_PINNED; + + if ( is_flush_dep_parent ) + status |= H5AC_ES__IS_FLUSH_DEP_PARENT; + + if ( is_flush_dep_child ) + status |= H5AC_ES__IS_FLUSH_DEP_CHILD; } *status_ptr = status; @@ -1264,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) { 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 */ @@ -1278,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) @@ -4421,7 +4431,7 @@ H5AC_log_renamed_entry(H5AC_t * cache_ptr, /* get entry status, size, etc here */ if ( H5C_get_entry_status(cache_ptr, old_addr, &entry_size, &entry_in_cache, - &entry_dirty, NULL, NULL) < 0 ) { + &entry_dirty, NULL, NULL, NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.") diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index b8de0c9..b5e0bda 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; @@ -266,6 +275,8 @@ extern hid_t H5AC_ind_dxpl_id; #define H5AC_ES__IS_DIRTY 0x0002 #define H5AC_ES__IS_PROTECTED 0x0004 #define H5AC_ES__IS_PINNED 0x0008 +#define H5AC_ES__IS_FLUSH_DEP_PARENT 0x0010 +#define H5AC_ES__IS_FLUSH_DEP_CHILD 0x0020 /* external function declarations: */ @@ -275,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); 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) < 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) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to flush old B-tree root node") #ifdef H5B_DEBUG 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/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) @@ -4535,10 +4552,12 @@ H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * in_cache_ptr, hbool_t * is_dirty_ptr, hbool_t * is_protected_ptr, - hbool_t * is_pinned_ptr) + hbool_t * is_pinned_ptr, + hbool_t * is_flush_dep_parent_ptr, + hbool_t * is_flush_dep_child_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ H5C_cache_entry_t * entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5C_get_entry_status, FAIL) @@ -4587,6 +4606,16 @@ H5C_get_entry_status(H5C_t * cache_ptr, *is_pinned_ptr = entry_ptr->is_pinned; } + + if ( is_flush_dep_parent_ptr != NULL ) { + + *is_flush_dep_parent_ptr = (entry_ptr->flush_dep_height > 0); + } + + if ( is_flush_dep_child_ptr != NULL ) { + + *is_flush_dep_child_ptr = (entry_ptr->flush_dep_parent != NULL); + } } done: @@ -5057,6 +5086,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) < 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: @@ -6396,6 +6432,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) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, NULL, "can't notify client about entry inserted into cache") } HDassert( entry_ptr->addr == addr ); @@ -8715,8 +8758,8 @@ H5C_create_flush_dependency(H5C_t UNUSED * cache_ptr, void * parent_thing, /* More sanity checks */ if(child_entry == parent_entry) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself") - if(!parent_entry->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't protected") + if(!(parent_entry->is_protected || parent_entry->is_pinned)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected") if(NULL != child_entry->flush_dep_parent) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry already has flush dependency parent") { @@ -11058,6 +11101,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) < 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 5d89313..e252134 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,8 @@ 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); typedef herr_t (*H5C_size_func_t)(const H5F_t *f, const void *thing, size_t *size_ptr); @@ -147,6 +162,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; @@ -1047,7 +1063,9 @@ H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * in_cache_ptr, hbool_t * is_dirty_ptr, hbool_t * is_protected_ptr, - hbool_t * is_pinned_ptr); + hbool_t * is_pinned_ptr, + hbool_t * is_flush_dep_parent_ptr, + hbool_t * is_flush_dep_child_ptr); H5_DLL herr_t H5C_get_evictions_enabled(H5C_t * cache_ptr, hbool_t * evictions_enabled_ptr); diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 59df243..1f45bba 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -951,7 +951,7 @@ H5D_earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") /* Check if there are any array elements */ - if(ea_stat.max_idx_set > 0) { + if(ea_stat.stored.max_idx_set > 0) { H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */ hsize_t u; /* Local index variable */ @@ -962,7 +962,7 @@ H5D_earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, /* Loop over array elements */ /* (Note: this may be too simple for datasets with >1 dimension) */ - for(u = 0; u < ea_stat.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->u.chunk.dim[0]) { + for(u = 0; u < ea_stat.stored.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->u.chunk.dim[0]) { H5D_earray_filt_elmt_t elmt; /* Extensible array element */ /* Get the info about the chunk for the index */ @@ -990,7 +990,7 @@ H5D_earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, /* Loop over array elements */ /* (Note: this may be too simple for datasets with >1 dimension) */ - for(u = 0; u < ea_stat.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->u.chunk.dim[0]) { + for(u = 0; u < ea_stat.stored.max_idx_set; u++, chunk_rec.offset[0] += idx_info->layout->u.chunk.dim[0]) { haddr_t addr; /* Chunk address */ /* Get the address of the chunk for the index */ @@ -1331,8 +1331,8 @@ H5D_earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") /* Set the size of the extensible array */ - *index_size = ea_stat.hdr_size + ea_stat.index_blk_size - + ea_stat.super_blk_size + ea_stat.data_blk_size; + *index_size = ea_stat.computed.hdr_size + ea_stat.computed.index_blk_size + + ea_stat.stored.super_blk_size + ea_stat.stored.data_blk_size; done: if(idx_info->layout->u.chunk.u.earray.ea) { @@ -265,7 +265,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(nelmts); /* Retrieve the max. index set */ - *nelmts = ea->hdr->stats.max_idx_set; + *nelmts = ea->hdr->stats.stored.max_idx_set; END_FUNC(PRIV) /* end H5EA_get_nelmts() */ @@ -333,7 +333,8 @@ H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt)) unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */ unsigned dblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting data block */ unsigned dblk_page_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting data block page */ - hbool_t hdr_dirty = FALSE; /* Whether header information changed */ + hbool_t stats_changed = FALSE; /* Whether array statistics changed */ + hbool_t hdr_dirty = FALSE; /* Whether the array header changed */ #ifdef QAK HDfprintf(stderr, "%s: Called\n", FUNC); @@ -355,9 +356,10 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); HDfprintf(stderr, "%s: Index block address not defined!\n", FUNC, idx); #endif /* QAK */ /* Create the index block */ - hdr->idx_blk_addr = H5EA__iblock_create(hdr, dxpl_id, &hdr_dirty); + hdr->idx_blk_addr = H5EA__iblock_create(hdr, dxpl_id, &stats_changed); if(!H5F_addr_defined(hdr->idx_blk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create index block") + hdr_dirty = TRUE; } /* end if */ #ifdef QAK HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); @@ -371,7 +373,7 @@ HDfprintf(stderr, "%s: Index block address is: %a\n", FUNC, hdr->idx_blk_addr); if(idx < hdr->cparam.idx_blk_elmts) { /* Set element in index block */ HDmemcpy(((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); - iblock_cache_flags |= H5AC__DIRTIED_FLAG; + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { unsigned sblk_idx; /* Which superblock does this index fall in? */ @@ -409,17 +411,17 @@ HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_i /* Create data block */ dblk_off = hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); - dblk_addr = H5EA__dblock_create(hdr, dxpl_id, &hdr_dirty, dblk_off, hdr->sblk_info[sblk_idx].dblk_nelmts); + dblk_addr = H5EA__dblock_create(hdr, dxpl_id, iblock, &stats_changed, dblk_off, hdr->sblk_info[sblk_idx].dblk_nelmts); if(!H5F_addr_defined(dblk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") /* Set data block address in index block */ iblock->dblk_addrs[dblk_idx] = dblk_addr; - iblock_cache_flags |= H5AC__DIRTIED_FLAG; + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Protect data block */ - if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, H5AC_WRITE))) + if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, iblock, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)iblock->dblk_addrs[dblk_idx]) /* Adjust index to offset in data block */ @@ -441,7 +443,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u, iblock->ndblk_addrs = %Zu\n", FUNC, dblk_i haddr_t sblk_addr; /* Address of data block created */ /* Create super block */ - sblk_addr = H5EA__sblock_create(hdr, dxpl_id, &hdr_dirty, sblk_idx); + sblk_addr = H5EA__sblock_create(hdr, dxpl_id, iblock, &stats_changed, sblk_idx); #ifdef QAK HDfprintf(stderr, "%s: New super block address is: %a\n", FUNC, sblk_addr); #endif /* QAK */ @@ -450,11 +452,11 @@ HDfprintf(stderr, "%s: New super block address is: %a\n", FUNC, sblk_addr); /* Set super block address in index block */ iblock->sblk_addrs[sblk_off] = sblk_addr; - iblock_cache_flags |= H5AC__DIRTIED_FLAG; + dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ /* Protect super block */ - if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, iblock->sblk_addrs[sblk_off], sblk_idx, H5AC_WRITE))) + if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, iblock, iblock->sblk_addrs[sblk_off], sblk_idx, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)iblock->sblk_addrs[sblk_off]) /* Compute the data block index in super block */ @@ -471,7 +473,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u, sblock->ndblks = %Zu\n", FUNC, dblk_idx, s /* Create data block */ dblk_off = hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); - dblk_addr = H5EA__dblock_create(hdr, dxpl_id, &hdr_dirty, dblk_off, sblock->dblk_nelmts); + dblk_addr = H5EA__dblock_create(hdr, dxpl_id, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts); if(!H5F_addr_defined(dblk_addr)) H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") @@ -522,7 +524,7 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ /* Check if page has been initialized yet */ if(!H5V_bit_get(sblock->page_init, page_init_idx)) { /* Create the data block page */ - if(H5EA__dblk_page_create(hdr, dxpl_id, dblk_page_addr) < 0) + if(H5EA__dblk_page_create(hdr, dxpl_id, sblock, dblk_page_addr) < 0) H5E_THROW(H5E_CANTCREATE, "unable to create data block page") /* Mark data block page as initialized in super block */ @@ -531,7 +533,7 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ } /* end if */ /* Protect data block page */ - if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, H5AC_WRITE))) + if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, dxpl_id, sblock, dblk_page_addr, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Set pointer to elements */ @@ -539,7 +541,7 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ } /* end if */ else { /* Protect data block */ - if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, H5AC_WRITE))) + if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, sblock, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)sblock->dblk_addrs[dblk_idx]) /* Set pointer to elements */ @@ -561,12 +563,17 @@ HDfprintf(stderr, "%s: sblock->dblk_page_size = %Zu\n", FUNC, sblock->dblk_page_ #ifdef QAK HDfprintf(stderr, "%s: idx = %Hu, hdr->stats.max_idx_set = %Hu\n", FUNC, idx, hdr->stats.max_idx_set); #endif /* QAK */ - if(idx >= hdr->stats.max_idx_set) { - hdr->stats.max_idx_set = idx + 1; - hdr_dirty = TRUE; + if(idx >= hdr->stats.stored.max_idx_set) { + HDassert(iblock); + hdr->stats.stored.max_idx_set = idx + 1; + stats_changed = TRUE; } /* end if */ CATCH + /* Check for updating array statistics */ + if(stats_changed) + hdr_dirty = TRUE; + /* Check for header modified */ if(hdr_dirty) if(H5EA__hdr_modified(hdr) < 0) @@ -624,7 +631,7 @@ HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); hdr->f = ea->f; /* Check for element beyond max. element in array */ - if(idx >= hdr->stats.max_idx_set) { + if(idx >= hdr->stats.stored.max_idx_set) { #ifdef QAK HDfprintf(stderr, "%s: Element beyond max. index set, hdr->stats.max_idx_set = %Hu, idx = %Hu\n", FUNC, hdr->stats.max_idx_set, idx); #endif /* QAK */ @@ -680,7 +687,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx); } /* end if */ else { /* Protect data block */ - if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, H5AC_READ))) + if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, iblock, iblock->dblk_addrs[dblk_idx], hdr->sblk_info[sblk_idx].dblk_nelmts, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)iblock->dblk_addrs[dblk_idx]) /* Adjust index to offset in data block */ @@ -704,7 +711,7 @@ HDfprintf(stderr, "%s: dblk_idx = %u\n", FUNC, dblk_idx); } /* end if */ else { /* Protect super block */ - if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, iblock->sblk_addrs[sblk_off], sblk_idx, H5AC_READ))) + if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, iblock, iblock->sblk_addrs[sblk_off], sblk_idx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)iblock->sblk_addrs[sblk_off]) /* Compute the data block index in super block */ @@ -778,7 +785,7 @@ HDfprintf(stderr, "%s: elmt_idx = %Hu, dblk_page_addr = %a\n", FUNC, elmt_idx, d #endif /* QAK */ /* Protect data block page */ - if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, H5AC_READ))) + if(NULL == (dblk_page = H5EA__dblk_page_protect(hdr, dxpl_id, sblock, dblk_page_addr, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Set pointer to elements */ @@ -787,7 +794,7 @@ HDfprintf(stderr, "%s: elmt_idx = %Hu, dblk_page_addr = %a\n", FUNC, elmt_idx, d } /* end if */ else { /* Protect data block */ - if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, H5AC_READ))) + if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, sblock, sblock->dblk_addrs[dblk_idx], sblock->dblk_nelmts, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)sblock->dblk_addrs[dblk_idx]) /* Set pointer to elements */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 286c6a5..8947960 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -88,22 +88,26 @@ static herr_t H5EA__cache_hdr_dest(H5F_t *f, H5EA_hdr_t *hdr); static H5EA_iblock_t *H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5EA__cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5EA_iblock_t *iblock, unsigned * flags_ptr); static herr_t H5EA__cache_iblock_clear(H5F_t *f, H5EA_iblock_t *iblock, hbool_t destroy); +static herr_t H5EA__cache_iblock_notify(H5AC_notify_action_t action, H5EA_iblock_t *iblock); static herr_t H5EA__cache_iblock_size(const H5F_t *f, const H5EA_iblock_t *iblock, size_t *size_ptr); static herr_t H5EA__cache_iblock_dest(H5F_t *f, H5EA_iblock_t *iblock); static H5EA_sblock_t *H5EA__cache_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5EA__cache_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5EA_sblock_t *sblock, unsigned * flags_ptr); static herr_t H5EA__cache_sblock_clear(H5F_t *f, H5EA_sblock_t *sblock, hbool_t destroy); static herr_t H5EA__cache_sblock_size(const H5F_t *f, const H5EA_sblock_t *sblock, size_t *size_ptr); +static herr_t H5EA__cache_sblock_notify(H5AC_notify_action_t action, H5EA_sblock_t *sblock); static herr_t H5EA__cache_sblock_dest(H5F_t *f, H5EA_sblock_t *sblock); static H5EA_dblock_t *H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5EA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5EA_dblock_t *dblock, unsigned * flags_ptr); static herr_t H5EA__cache_dblock_clear(H5F_t *f, H5EA_dblock_t *dblock, hbool_t destroy); static herr_t H5EA__cache_dblock_size(const H5F_t *f, const H5EA_dblock_t *dblock, size_t *size_ptr); +static herr_t H5EA__cache_dblock_notify(H5AC_notify_action_t action, H5EA_dblock_t *dblock); static herr_t H5EA__cache_dblock_dest(H5F_t *f, H5EA_dblock_t *dblock); static H5EA_dblk_page_t *H5EA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata, void *udata2); static herr_t H5EA__cache_dblk_page_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5EA_dblk_page_t *dblk_page, unsigned * flags_ptr); static herr_t H5EA__cache_dblk_page_clear(H5F_t *f, H5EA_dblk_page_t *dblk_page, hbool_t destroy); static herr_t H5EA__cache_dblk_page_size(const H5F_t *f, const H5EA_dblk_page_t *dblk_page, size_t *size_ptr); +static herr_t H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, H5EA_dblk_page_t *dblk_page); static herr_t H5EA__cache_dblk_page_dest(H5F_t *f, H5EA_dblk_page_t *dblk_page); @@ -118,6 +122,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 +133,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)H5EA__cache_iblock_notify, (H5AC_size_func_t)H5EA__cache_iblock_size, }}; @@ -138,6 +144,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)H5EA__cache_sblock_notify, (H5AC_size_func_t)H5EA__cache_sblock_size, }}; @@ -148,6 +155,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)H5EA__cache_dblock_notify, (H5AC_size_func_t)H5EA__cache_dblock_size, }}; @@ -158,6 +166,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)H5EA__cache_dblk_page_notify, (H5AC_size_func_t)H5EA__cache_dblk_page_size, }}; @@ -254,13 +263,13 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, hdr->cparam.max_dblk_page_nelmts_bits = *p++; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ /* Array statistics */ - hdr->stats.hdr_size = size; /* Size of header in file */ - H5F_DECODE_LENGTH(f, p, hdr->stats.nsuper_blks); /* Number of super blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.super_blk_size); /* Size of super blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.ndata_blks); /* Number of data blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.data_blk_size); /* Size of data blocks created */ - H5F_DECODE_LENGTH(f, p, hdr->stats.max_idx_set); /* Max. index set (+1) */ - H5F_DECODE_LENGTH(f, p, hdr->stats.nelmts); /* Number of elements 'realized' */ + hdr->stats.computed.hdr_size = size; /* Size of header in file */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ + H5F_DECODE_LENGTH(f, p, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ /* Internal information */ H5F_addr_decode(f, &p, &hdr->idx_blk_addr); /* Address of index block */ @@ -270,7 +279,7 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, H5EA_iblock_t iblock; /* Fake index block for computing size */ /* Set index block count for file */ - hdr->stats.nindex_blks = 1; + hdr->stats.computed.nindex_blks = 1; /* Set up fake index block for computing size on disk */ iblock.hdr = hdr; @@ -279,11 +288,11 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks; /* Compute size of index block in file */ - hdr->stats.index_blk_size = H5EA_IBLOCK_SIZE(&iblock); + hdr->stats.computed.index_blk_size = H5EA_IBLOCK_SIZE(&iblock); } /* end if */ else { - hdr->stats.nindex_blks = 0; /* Number of index blocks in file */ - hdr->stats.index_blk_size = 0; /* Size of index blocks in file */ + hdr->stats.computed.nindex_blks = 0; /* Number of index blocks in file */ + hdr->stats.computed.index_blk_size = 0; /* Size of index blocks in file */ } /* end else */ /* Sanity check */ @@ -389,12 +398,12 @@ H5EA__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, *p++ = hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ /* Array statistics */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.nsuper_blks); /* Number of super blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.super_blk_size); /* Size of super blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.ndata_blks); /* Number of data blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.data_blk_size); /* Size of data blocks created */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.max_idx_set); /* Max. index set (+1) */ - H5F_ENCODE_LENGTH(f, p, hdr->stats.nelmts); /* Number of elements 'realized' */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ + H5F_ENCODE_LENGTH(f, p, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ /* Internal information */ H5F_addr_encode(f, &p, hdr->idx_blk_addr); /* Address of index block */ @@ -829,6 +838,53 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_clear() */ /*------------------------------------------------------------------------- + * Function: H5EA__cache_iblock_notify + * + * Purpose: Handle cache action notifications + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 31 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5EA__cache_iblock_notify(H5AC_notify_action_t action, H5EA_iblock_t *iblock)) + + /* Sanity check */ + HDassert(iblock); + + /* Determine which action to take */ + switch(action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + /* Create flush dependency on extensible array header */ + if(H5EA__create_flush_depend(iblock->hdr, (H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr) + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on extensible array header */ + if(H5EA__destroy_flush_depend(iblock->hdr, (H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and header, address = %llu", (unsigned long long)iblock->addr) + break; + + default: +#ifdef NDEBUG + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + +CATCH + +END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ + + +/*------------------------------------------------------------------------- * Function: H5EA__cache_iblock_size * * Purpose: Compute the size in bytes of a extensible array index block @@ -924,11 +980,11 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_dest() */ BEGIN_FUNC(STATIC, ERR, H5EA_sblock_t *, NULL, NULL, H5EA__cache_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *_sblk_idx, void *_hdr)) + const void *_udata1, void *_hdr)) /* Local variables */ H5EA_hdr_t *hdr = (H5EA_hdr_t *)_hdr; /* Shared extensible array information */ - const unsigned *sblk_idx = (const unsigned *)_sblk_idx; /* Index of this super block */ + const H5EA_sblock_load_ud_t *ud_load = (const H5EA_sblock_load_ud_t *)_udata1; /* User data for loading super block */ H5EA_sblock_t *sblock = NULL; /* Super block info */ size_t size; /* Super block size */ H5WB_t *wb = NULL; /* Wrapped buffer for super block data */ @@ -943,11 +999,11 @@ H5EA__cache_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, /* Sanity check */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(sblk_idx && *sblk_idx > 0); + HDassert(ud_load && ud_load->parent && ud_load->sblk_idx > 0); HDassert(hdr); /* Allocate the extensible array super block */ - if(NULL == (sblock = H5EA__sblock_alloc(hdr, *sblk_idx))) + if(NULL == (sblock = H5EA__sblock_alloc(hdr, ud_load->parent, ud_load->sblk_idx))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") /* Set the extensible array super block's address */ @@ -1213,6 +1269,53 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_size() */ /*------------------------------------------------------------------------- + * Function: H5EA__cache_sblock_notify + * + * Purpose: Handle cache action notifications + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 31 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5EA__cache_sblock_notify(H5AC_notify_action_t action, H5EA_sblock_t *sblock)) + + /* Sanity check */ + HDassert(sblock); + + /* Determine which action to take */ + switch(action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + /* Create flush dependency on index block */ + if(H5EA__create_flush_depend(sblock->hdr, (H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on index block */ + if(H5EA__destroy_flush_depend(sblock->hdr, (H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and index block, address = %llu", (unsigned long long)sblock->addr) + break; + + default: +#ifdef NDEBUG + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + +CATCH + +END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ + + +/*------------------------------------------------------------------------- * Function: H5EA__cache_sblock_dest * * Purpose: Destroys an extensible array super block in memory. @@ -1276,11 +1379,11 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_dest() */ BEGIN_FUNC(STATIC, ERR, H5EA_dblock_t *, NULL, NULL, H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void *_nelmts, void *_hdr)) + const void *_udata1, void *_hdr)) /* Local variables */ H5EA_hdr_t *hdr = (H5EA_hdr_t *)_hdr; /* Shared extensible array information */ - const size_t *nelmts = (const size_t *)_nelmts; /* Number of elements in data block */ + const H5EA_dblock_load_ud_t *ud_load = (const H5EA_dblock_load_ud_t *)_udata1; /* User data for loading data block */ H5EA_dblock_t *dblock = NULL; /* Data block info */ size_t size; /* Data block size */ H5WB_t *wb = NULL; /* Wrapped buffer for data block data */ @@ -1294,11 +1397,11 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, /* Sanity check */ HDassert(f); HDassert(H5F_addr_defined(addr)); - HDassert(nelmts && *nelmts > 0); + HDassert(ud_load && ud_load->parent && ud_load->nelmts > 0); HDassert(hdr); /* Allocate the extensible array data block */ - if(NULL == (dblock = H5EA__dblock_alloc(hdr, *nelmts))) + if(NULL == (dblock = H5EA__dblock_alloc(hdr, ud_load->parent, ud_load->nelmts))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") /* Set the extensible array data block's information */ @@ -1352,9 +1455,9 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, if(!dblock->npages) { /* Decode elements in data block */ /* Convert from raw elements on disk into native elements in memory */ - if((hdr->cparam.cls->decode)(p, dblock->elmts, *nelmts, hdr->cb_ctx) < 0) + if((hdr->cparam.cls->decode)(p, dblock->elmts, ud_load->nelmts, hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") - p += (*nelmts * hdr->cparam.raw_elmt_size); + p += (ud_load->nelmts * hdr->cparam.raw_elmt_size); } /* end if */ /* Sanity check */ @@ -1531,6 +1634,53 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_clear() */ /*------------------------------------------------------------------------- + * Function: H5EA__cache_dblock_notify + * + * Purpose: Handle cache action notifications + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 31 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5EA__cache_dblock_notify(H5AC_notify_action_t action, H5EA_dblock_t *dblock)) + + /* Sanity check */ + HDassert(dblock); + + /* Determine which action to take */ + switch(action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + /* Create flush dependency on parent */ + if(H5EA__create_flush_depend(dblock->hdr, (H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr) + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on parent */ + if(H5EA__destroy_flush_depend(dblock->hdr, (H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr) + break; + + default: +#ifdef NDEBUG + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + +CATCH + +END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ + + +/*------------------------------------------------------------------------- * Function: H5EA__cache_dblock_size * * Purpose: Compute the size in bytes of a extensible array data block @@ -1631,10 +1781,11 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_dest() */ BEGIN_FUNC(STATIC, ERR, H5EA_dblk_page_t *, NULL, NULL, H5EA__cache_dblk_page_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, - const void UNUSED *udata1, void *_hdr)) + const void *_ud_load, void *_hdr)) /* Local variables */ H5EA_hdr_t *hdr = (H5EA_hdr_t *)_hdr; /* Shared extensible array information */ + const H5EA_dblk_page_load_ud_t *ud_load = (const H5EA_dblk_page_load_ud_t *)_ud_load; /* User data for loading data block page */ H5EA_dblk_page_t *dblk_page = NULL; /* Data block page info */ size_t size; /* Data block page size */ H5WB_t *wb = NULL; /* Wrapped buffer for data block page data */ @@ -1653,7 +1804,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); #endif /* QAK */ /* Allocate the extensible array data block page */ - if(NULL == (dblk_page = H5EA__dblk_page_alloc(hdr))) + if(NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, ud_load->parent))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") /* Set the extensible array data block's information */ @@ -1703,10 +1854,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); /* Verify checksum */ if(stored_chksum != computed_chksum) -{ -HDfprintf(stderr, "%s: stored_chksum = %8x, computed_chksum = %8x\n", FUNC, stored_chksum, computed_chksum); H5E_THROW(H5E_BADVALUE, "incorrect metadata checksum for extensible array data block page") -} /* Set return value */ ret_value = dblk_page; @@ -1840,6 +1988,53 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_clear() */ /*------------------------------------------------------------------------- + * Function: H5EA__cache_dblk_page_notify + * + * Purpose: Handle cache action notifications + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 31 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +herr_t, SUCCEED, FAIL, +H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, H5EA_dblk_page_t *dblk_page)) + + /* Sanity check */ + HDassert(dblk_page); + + /* Determine which action to take */ + switch(action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + /* Create flush dependency on parent */ + if(H5EA__create_flush_depend(dblk_page->hdr, (H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on parent */ + if(H5EA__destroy_flush_depend(dblk_page->hdr, (H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) + break; + + default: +#ifdef NDEBUG + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + +CATCH + +END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ + + +/*------------------------------------------------------------------------- * Function: H5EA__cache_dblk_page_size * * Purpose: Compute the size in bytes of a extensible array data block page diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 2c903b2..8e4c634 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -147,16 +147,16 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Highest element index stored (+1):", - hdr->stats.max_idx_set); + hdr->stats.stored.max_idx_set); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of super blocks created:", - hdr->stats.nsuper_blks); + hdr->stats.stored.nsuper_blks); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of data blocks created:", - hdr->stats.ndata_blks); + hdr->stats.stored.ndata_blks); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of elements 'realized':", - hdr->stats.nelmts); + hdr->stats.stored.nelmts); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr); @@ -320,7 +320,8 @@ H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Protect super block */ - if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, addr, sblk_idx, H5AC_READ))) + /* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */ + if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, hdr, addr, sblk_idx, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)addr) /* Print opening message */ @@ -404,7 +405,8 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") /* Protect data block */ - if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, addr, dblk_nelmts, H5AC_READ))) + /* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */ + if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, hdr, addr, dblk_nelmts, H5AC_READ))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)addr) /* Print opening message */ diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index a8edae1..429e9f8 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -100,7 +100,7 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t); */ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, -H5EA__dblk_page_alloc(H5EA_hdr_t *hdr)) +H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent)) /* Local variables */ H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ @@ -118,7 +118,7 @@ H5EA__dblk_page_alloc(H5EA_hdr_t *hdr)) dblk_page->hdr = hdr; /* Set non-zero internal fields */ - /* <none> */ + dblk_page->parent = parent; /* Allocate buffer for elements in data block page */ if(NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts))) @@ -150,7 +150,8 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, -H5EA__dblk_page_create(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t addr)) +H5EA__dblk_page_create(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent, + haddr_t addr)) /* Local variables */ H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ @@ -163,7 +164,7 @@ HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); HDassert(hdr); /* Allocate the data block page */ - if(NULL == (dblk_page = H5EA__dblk_page_alloc(hdr))) + if(NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") /* Set info about data block page on disk */ @@ -208,10 +209,11 @@ END_FUNC(PKG) /* end H5EA__dblk_page_create() */ */ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, -H5EA__dblk_page_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_page_addr, - H5AC_protect_t rw)) +H5EA__dblk_page_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_sblock_t *parent, + haddr_t dblk_page_addr, H5AC_protect_t rw)) /* Local variables */ + H5EA_dblk_page_load_ud_t load_ud; /* Information needed for loading data block page */ #ifdef QAK HDfprintf(stderr, "%s: Called\n", FUNC); @@ -221,8 +223,11 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(hdr); HDassert(H5F_addr_defined(dblk_page_addr)); + /* Set up user data */ + load_ud.parent = parent; + /* Protect the data block page */ - if(NULL == (ret_value = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, NULL, hdr, rw))) + if(NULL == (ret_value = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, &load_ud, hdr, rw))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", (unsigned long long)dblk_page_addr) CATCH diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index af2828a..344b9fa 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -101,13 +101,14 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t); */ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, -H5EA__dblock_alloc(H5EA_hdr_t *hdr, size_t nelmts)) +H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts)) /* Local variables */ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ /* Check arguments */ HDassert(hdr); + HDassert(parent); HDassert(nelmts > 0); /* Allocate memory for the data block */ @@ -120,6 +121,7 @@ H5EA__dblock_alloc(H5EA_hdr_t *hdr, size_t nelmts)) dblock->hdr = hdr; /* Set non-zero internal fields */ + dblock->parent = parent; dblock->nelmts = nelmts; /* Check if the data block is not going to be paged */ @@ -160,8 +162,8 @@ END_FUNC(PKG) /* end H5EA__dblock_alloc() */ */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, -H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, - hsize_t dblk_off, size_t nelmts)) +H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, + hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts)) /* Local variables */ H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ @@ -173,11 +175,11 @@ HDfprintf(stderr, "%s: Called, hdr->dblk_page_nelmts = %Zu, nelmts = %Zu\n", FUN /* Sanity check */ HDassert(hdr); - HDassert(hdr_dirty); + HDassert(stats_changed); HDassert(nelmts > 0); /* Allocate the data block */ - if(NULL == (dblock = H5EA__dblock_alloc(hdr, nelmts))) + if(NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") /* Set size of data block on disk */ @@ -208,14 +210,14 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache") /* Update extensible array data block statistics */ - hdr->stats.ndata_blks++; - hdr->stats.data_blk_size += dblock->size; + hdr->stats.stored.ndata_blks++; + hdr->stats.stored.data_blk_size += dblock->size; /* Increment count of elements "realized" */ - hdr->stats.nelmts += nelmts; + hdr->stats.stored.nelmts += nelmts; - /* Mark the header dirty (for updating statistics) */ - *hdr_dirty = TRUE; + /* Mark the statistics as changed */ + *stats_changed = TRUE; /* Set address of data block to return */ ret_value = dblock_addr; @@ -301,10 +303,11 @@ END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */ */ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, -H5EA__dblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr, - size_t dblk_nelmts, H5AC_protect_t rw)) +H5EA__dblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, + haddr_t dblk_addr, size_t dblk_nelmts, H5AC_protect_t rw)) /* Local variables */ + H5EA_dblock_load_ud_t load_ud; /* Information needed for loading data block */ #ifdef QAK HDfprintf(stderr, "%s: Called\n", FUNC); @@ -315,8 +318,12 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(H5F_addr_defined(dblk_addr)); HDassert(dblk_nelmts); + /* Set up user data */ + load_ud.parent = parent; + load_ud.nelmts = dblk_nelmts; + /* Protect the data block */ - if(NULL == (ret_value = (H5EA_dblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblk_addr, &dblk_nelmts, hdr, rw))) + if(NULL == (ret_value = (H5EA_dblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_DBLOCK, dblk_addr, &load_ud, hdr, rw))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)dblk_addr) CATCH @@ -374,8 +381,8 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, -H5EA__dblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t dblk_addr, - size_t dblk_nelmts)) +H5EA__dblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, + haddr_t dblk_addr, size_t dblk_nelmts)) /* Local variables */ H5EA_dblock_t *dblock = NULL; /* Pointer to data block */ @@ -386,11 +393,12 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Sanity check */ HDassert(hdr); + HDassert(parent); HDassert(H5F_addr_defined(dblk_addr)); HDassert(dblk_nelmts > 0); /* Protect data block */ - if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, dblk_addr, dblk_nelmts, H5AC_WRITE))) + if(NULL == (dblock = H5EA__dblock_protect(hdr, dxpl_id, parent, dblk_addr, dblk_nelmts, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)dblk_addr) /* Check if this is a paged data block */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 998e169..0a7ddef 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -236,7 +236,7 @@ HDfprintf(stderr, "%s: hdr->sblk_info[%Zu] = {%Zu, %Zu, %Hu, %Hu}\n", FUNC, u, h } /* end for */ /* Set size of header on disk (locally and in statistics) */ - hdr->stats.hdr_size = hdr->size = H5EA_HEADER_SIZE(hdr); + hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE(hdr); CATCH diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 2d93015..9920277 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -178,7 +178,7 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */ */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, -H5EA__iblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty)) +H5EA__iblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *stats_changed)) /* Local variables */ H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ @@ -190,7 +190,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Sanity check */ HDassert(hdr); - HDassert(hdr_dirty); + HDassert(stats_changed); /* Allocate the index block */ if(NULL == (iblock = H5EA__iblock_alloc(hdr))) @@ -235,16 +235,16 @@ HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache") /* Update extensible array index block statistics */ - HDassert(0 == hdr->stats.nindex_blks); - HDassert(0 == hdr->stats.index_blk_size); - hdr->stats.nindex_blks = 1; - hdr->stats.index_blk_size = iblock->size; + HDassert(0 == hdr->stats.computed.nindex_blks); + HDassert(0 == hdr->stats.computed.index_blk_size); + hdr->stats.computed.nindex_blks = 1; + hdr->stats.computed.index_blk_size = iblock->size; /* Increment count of elements "realized" */ - hdr->stats.nelmts += hdr->cparam.idx_blk_elmts; + hdr->stats.stored.nelmts += hdr->cparam.idx_blk_elmts; - /* Mark the header dirty (for updating statistics) */ - *hdr_dirty = TRUE; + /* Mark the statistics as changed */ + *stats_changed = TRUE; /* Set address of index block to return */ ret_value = iblock_addr; @@ -281,8 +281,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 */ @@ -378,7 +376,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Check for data block existing */ if(H5F_addr_defined(iblock->dblk_addrs[u])) { /* Delete data block */ - if(H5EA__dblock_delete(hdr, dxpl_id, iblock->dblk_addrs[u], hdr->sblk_info[sblk_idx].dblk_nelmts) < 0) + if(H5EA__dblock_delete(hdr, dxpl_id, iblock, iblock->dblk_addrs[u], hdr->sblk_info[sblk_idx].dblk_nelmts) < 0) H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") iblock->dblk_addrs[u] = HADDR_UNDEF; } /* end if */ @@ -403,7 +401,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Check for data block existing */ if(H5F_addr_defined(iblock->sblk_addrs[u])) { /* Delete super block */ - if(H5EA__sblock_delete(hdr, dxpl_id, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < 0) + if(H5EA__sblock_delete(hdr, dxpl_id, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < 0) H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block") iblock->sblk_addrs[u] = HADDR_UNDEF; } /* end if */ diff --git a/src/H5EAint.c b/src/H5EAint.c index a53d4f9..5ce88fc 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -79,3 +79,66 @@ /*******************/ + +/*------------------------------------------------------------------------- + * Function: H5EA__create_flush_depend + * + * Purpose: Create a flush dependency between two data structure components + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 26 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5EA__create_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, + H5AC_info_t *child_entry)) + + /* Sanity check */ + HDassert(hdr); + HDassert(parent_entry); + HDassert(child_entry); + + /* Create a flush dependency between parent and child entry */ + if(H5AC_create_flush_dependency(hdr->f, parent_entry, child_entry) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") + +CATCH + +END_FUNC(PKG) /* end H5EA__create_flush_depend() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__destroy_flush_depend + * + * Purpose: Destroy a flush dependency between two data structure components + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 26 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) + + /* Sanity check */ + HDassert(hdr); + HDassert(parent_entry); + HDassert(child_entry); + + /* Destroy a flush dependency between parent and child entry */ + if(H5AC_destroy_flush_dependency(hdr->f, parent_entry, child_entry) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") + +CATCH + +END_FUNC(PKG) /* end H5EA__destroy_flush_depend() */ + diff --git a/src/H5EApkg.h b/src/H5EApkg.h index e374d3a..3f32b19 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -371,7 +371,7 @@ func_init_failed: \ + 1 /* Min. # of data block pointers for a super block */ \ + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ \ - /* Extensible Array Header statistics fields */ \ + /* Extensible Array statistics fields */ \ + (h)->sizeof_size /* Number of super blocks created */ \ + (h)->sizeof_size /* Size of super blocks created */ \ + (h)->sizeof_size /* Number of data blocks created */ \ @@ -472,7 +472,7 @@ typedef struct H5EA_hdr_t { /* Index block information (stored in header) */ haddr_t idx_blk_addr; /* Address of index block in header */ - /* Statistics for array (stored in header) */ + /* Statistics for array (stored in index block, actually) */ /* (header and index number/size fields not stored) */ H5EA_stat_t stats; /* Statistics for extensible array */ @@ -539,6 +539,7 @@ typedef struct H5EA_sblock_t { /* Internal array information (not stored) */ size_t rc; /* Reference count of objects using this block */ H5EA_hdr_t *hdr; /* Shared array header info */ + H5EA_iblock_t *parent; /* Parent object for super block (index block) */ haddr_t addr; /* Address of this index block on disk */ size_t size; /* Size of index block on disk */ @@ -562,6 +563,7 @@ typedef struct H5EA_dblock_t { /* Internal array information (not stored) */ H5EA_hdr_t *hdr; /* Shared array header info */ + void *parent; /* Parent object for data block (index or super block) */ haddr_t addr; /* Address of this data block on disk */ size_t size; /* Size of data block on disk */ @@ -580,6 +582,7 @@ typedef struct H5EA_dbk_page_t { /* Internal array information (not stored) */ H5EA_hdr_t *hdr; /* Shared array header info */ + H5EA_sblock_t *parent; /* Parent object for data block page (super block) */ haddr_t addr; /* Address of this data block page on disk */ size_t size; /* Size of data block page on disk */ @@ -593,6 +596,25 @@ struct H5EA_t { H5F_t *f; /* Pointer to file for extensible array */ }; +/* Metadata cache callback user data types */ + +/* Info needed for loading data block page */ +typedef struct H5EA_dblk_page_load_ud_t { + H5EA_sblock_t *parent; /* Pointer to parent object for data block page (super block) */ +} H5EA_dblk_page_load_ud_t; + +/* Info needed for loading data block */ +typedef struct H5EA_dblock_load_ud_t { + void *parent; /* Pointer to parent object for data block (index or super block) */ + size_t nelmts; /* Number of elements in data block */ +} H5EA_dblock_load_ud_t; + +/* Info needed for loading super block */ +typedef struct H5EA_sblock_load_ud_t { + H5EA_iblock_t *parent; /* Pointer to parent object for super block (index block) */ + unsigned sblk_idx; /* Index of super block */ +} H5EA_sblock_load_ud_t; + /*****************************/ /* Package Private Variables */ @@ -623,6 +645,12 @@ H5_DLLVAR const H5EA_class_t H5EA_CLS_TEST[1]; /* Package Private Prototypes */ /******************************/ +/* Generic routines */ +H5_DLL herr_t H5EA__create_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, + H5AC_info_t *child_entry); +H5_DLL herr_t H5EA__destroy_flush_depend(H5EA_hdr_t *hdr, H5AC_info_t *parent_entry, + H5AC_info_t *child_entry); + /* Header routines */ H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls); H5_DLL herr_t H5EA__hdr_init(H5EA_hdr_t *hdr); @@ -640,7 +668,7 @@ H5_DLL herr_t H5EA__hdr_dest(H5EA_hdr_t *hdr); /* Index block routines */ H5_DLL H5EA_iblock_t *H5EA__iblock_alloc(H5EA_hdr_t *hdr); H5_DLL haddr_t H5EA__iblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, - hbool_t *hdr_dirty); + hbool_t *stats_changed); H5_DLL H5EA_iblock_t *H5EA__iblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5AC_protect_t rw); H5_DLL herr_t H5EA__iblock_unprotect(H5EA_iblock_t *iblock, hid_t dxpl_id, @@ -649,36 +677,38 @@ H5_DLL herr_t H5EA__iblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5EA__iblock_dest(H5F_t *f, H5EA_iblock_t *iblock); /* Super block routines */ -H5_DLL H5EA_sblock_t *H5EA__sblock_alloc(H5EA_hdr_t *hdr, unsigned sblk_idx); -H5_DLL haddr_t H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, +H5_DLL H5EA_sblock_t *H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx); +H5_DLL haddr_t H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, + H5EA_iblock_t *parent, hbool_t *stats_changed, unsigned sblk_idx); H5_DLL H5EA_sblock_t *H5EA__sblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, - haddr_t sblk_addr, unsigned sblk_idx, H5AC_protect_t rw); + H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx, H5AC_protect_t rw); H5_DLL herr_t H5EA__sblock_unprotect(H5EA_sblock_t *sblock, hid_t dxpl_id, unsigned cache_flags); H5_DLL herr_t H5EA__sblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, - haddr_t sblk_addr, unsigned sblk_idx); + H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx); H5_DLL herr_t H5EA__sblock_dest(H5F_t *f, H5EA_sblock_t *sblock); /* Data block routines */ -H5_DLL H5EA_dblock_t *H5EA__dblock_alloc(H5EA_hdr_t *hdr, size_t nelmts); -H5_DLL haddr_t H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, - hsize_t dblk_off, size_t nelmts); +H5_DLL H5EA_dblock_t *H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, + size_t nelmts); +H5_DLL haddr_t H5EA__dblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, + hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts); H5_DLL unsigned H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx); H5_DLL H5EA_dblock_t *H5EA__dblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, - haddr_t dblk_addr, size_t dblk_nelmts, H5AC_protect_t rw); + void *parent, haddr_t dblk_addr, size_t dblk_nelmts, H5AC_protect_t rw); H5_DLL herr_t H5EA__dblock_unprotect(H5EA_dblock_t *dblock, hid_t dxpl_id, unsigned cache_flags); -H5_DLL herr_t H5EA__dblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, +H5_DLL herr_t H5EA__dblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, void *parent, haddr_t dblk_addr, size_t dblk_nelmts); H5_DLL herr_t H5EA__dblock_dest(H5F_t *f, H5EA_dblock_t *dblock); /* Data block page routines */ -H5_DLL H5EA_dblk_page_t *H5EA__dblk_page_alloc(H5EA_hdr_t *hdr); +H5_DLL H5EA_dblk_page_t *H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent); H5_DLL herr_t H5EA__dblk_page_create(H5EA_hdr_t *hdr, hid_t dxpl_id, - haddr_t addr); + H5EA_sblock_t *parent, haddr_t addr); H5_DLL H5EA_dblk_page_t *H5EA__dblk_page_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, - haddr_t dblk_page_addr, H5AC_protect_t rw); + H5EA_sblock_t *parent, haddr_t dblk_page_addr, H5AC_protect_t rw); H5_DLL herr_t H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, hid_t dxpl_id, unsigned cache_flags); H5_DLL herr_t H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page); diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index ca30f73..9b36ad2 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -85,19 +85,26 @@ typedef struct H5EA_create_t { } H5EA_create_t; /* Extensible array metadata statistics info */ +/* (If these are ever exposed to applications, don't let the application see + * which fields are computed vs. which fields are stored. -QAK) + */ typedef struct H5EA_stat_t { /* Non-stored (i.e. computed) fields */ - hsize_t hdr_size; /* Size of header */ - hsize_t nindex_blks; /* # of index blocks (should be 0 or 1) */ - hsize_t index_blk_size; /* Size of index blocks allocated */ + struct { + hsize_t hdr_size; /* Size of header */ + hsize_t nindex_blks; /* # of index blocks (should be 0 or 1) */ + hsize_t index_blk_size; /* Size of index blocks allocated */ + } computed; /* Stored fields */ - hsize_t nsuper_blks; /* # of super blocks */ - hsize_t super_blk_size; /* Size of super blocks allocated */ - hsize_t ndata_blks; /* # of data blocks */ - hsize_t data_blk_size; /* Size of data blocks allocated */ - hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value with be '1', if no elements have been stored, this value will be '0') */ - hsize_t nelmts; /* # of elements "realized" */ + struct { + hsize_t nsuper_blks; /* # of super blocks */ + hsize_t super_blk_size; /* Size of super blocks allocated */ + hsize_t ndata_blks; /* # of data blocks */ + hsize_t data_blk_size; /* Size of data blocks allocated */ + hsize_t max_idx_set; /* Highest element index stored (+1 - i.e. if element 0 has been set, this value with be '1', if no elements have been stored, this value will be '0') */ + hsize_t nelmts; /* # of elements "realized" */ + } stored; } H5EA_stat_t; /* Extensible array info (forward decl - defined in H5EApkg.h) */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index 3cb97a9..c6a4306 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -107,7 +107,7 @@ H5FL_BLK_DEFINE(page_init); */ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, -H5EA__sblock_alloc(H5EA_hdr_t *hdr, unsigned sblk_idx)) +H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx)) /* Local variables */ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ @@ -125,6 +125,7 @@ H5EA__sblock_alloc(H5EA_hdr_t *hdr, unsigned sblk_idx)) sblock->hdr = hdr; /* Set non-zero internal fields */ + sblock->parent = parent; sblock->addr = HADDR_UNDEF; /* Compute/cache information */ @@ -190,8 +191,8 @@ END_FUNC(PKG) /* end H5EA__sblock_alloc() */ */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, -H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, hbool_t *hdr_dirty, - unsigned sblk_idx)) +H5EA__sblock_create(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_iblock_t *parent, + hbool_t *stats_changed, unsigned sblk_idx)) /* Local variables */ H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ @@ -204,10 +205,10 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Sanity check */ HDassert(hdr); - HDassert(hdr_dirty); + HDassert(stats_changed); /* Allocate the super block */ - if(NULL == (sblock = H5EA__sblock_alloc(hdr, sblk_idx))) + if(NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx))) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") /* Set size of super block on disk */ @@ -235,11 +236,11 @@ HDfprintf(stderr, "%s: sblock->block_off = %Hu\n", FUNC, sblock->block_off); H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache") /* Update extensible array super block statistics */ - hdr->stats.nsuper_blks++; - hdr->stats.super_blk_size += sblock->size; + hdr->stats.stored.nsuper_blks++; + hdr->stats.stored.super_blk_size += sblock->size; - /* Mark the header dirty (for updating statistics) */ - *hdr_dirty = TRUE; + /* Mark the statistics as changed */ + *stats_changed = TRUE; /* Set address of super block to return */ ret_value = sblock_addr; @@ -274,10 +275,12 @@ END_FUNC(PKG) /* end H5EA__sblock_create() */ */ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, -H5EA__sblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t sblk_addr, - unsigned sblk_idx, H5AC_protect_t rw)) +H5EA__sblock_protect(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_iblock_t *parent, + haddr_t sblk_addr, unsigned sblk_idx, H5AC_protect_t rw)) /* Local variables */ + H5EA_sblock_load_ud_t load_ud; /* Information needed for loading super block */ + #ifdef QAK HDfprintf(stderr, "%s: Called\n", FUNC); @@ -287,8 +290,12 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(hdr); HDassert(H5F_addr_defined(sblk_addr)); + /* Set up user data */ + load_ud.parent = parent; + load_ud.sblk_idx = sblk_idx; + /* Protect the super block */ - if(NULL == (ret_value = (H5EA_sblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblk_addr, &sblk_idx, hdr, rw))) + if(NULL == (ret_value = (H5EA_sblock_t *)H5AC_protect(hdr->f, dxpl_id, H5AC_EARRAY_SBLOCK, sblk_addr, &load_ud, hdr, rw))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)sblk_addr) CATCH @@ -346,8 +353,8 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, -H5EA__sblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, haddr_t sblk_addr, - unsigned sblk_idx)) +H5EA__sblock_delete(H5EA_hdr_t *hdr, hid_t dxpl_id, H5EA_iblock_t *parent, + haddr_t sblk_addr, unsigned sblk_idx)) /* Local variables */ H5EA_sblock_t *sblock = NULL; /* Pointer to super block */ @@ -362,7 +369,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(H5F_addr_defined(sblk_addr)); /* Protect super block */ - if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, sblk_addr, sblk_idx, H5AC_WRITE))) + if(NULL == (sblock = H5EA__sblock_protect(hdr, dxpl_id, parent, sblk_addr, sblk_idx, H5AC_WRITE))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", (unsigned long long)sblk_addr) /* Iterate over data blocks */ @@ -370,7 +377,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); /* Check for data block existing */ if(H5F_addr_defined(sblock->dblk_addrs[u])) { /* Delete data block */ - if(H5EA__dblock_delete(hdr, dxpl_id, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0) + if(H5EA__dblock_delete(hdr, dxpl_id, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0) H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") sblock->dblk_addrs[u] = HADDR_UNDEF; } /* end if */ 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); 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/H5Gbtree2.c b/src/H5Gbtree2.c index c16fc16..9afd882 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -389,8 +389,8 @@ H5G_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dx FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_name_debug) - HDfprintf(stream, "%*s%-*s {%lx, ", indent, "", fwidth, "Record:", - nrecord->hash); + HDfprintf(stream, "%*s%-*s {%x, ", indent, "", fwidth, "Record:", + (unsigned)nrecord->hash); for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); @@ -579,8 +579,8 @@ H5G_dense_btree2_corder_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_dense_btree2_corder_debug) - HDfprintf(stream, "%*s%-*s {%Hu, ", indent, "", fwidth, "Record:", - nrecord->corder); + HDfprintf(stream, "%*s%-*s {%llu, ", indent, "", fwidth, "Record:", + (unsigned long long)nrecord->corder); for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); 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/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, }}; @@ -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) < 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, }}; 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, }}; 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/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 |