mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-31 17:10:47 +08:00
[svn-r18571] Description:
Bring r18542 from metadata journaling "merging" branch to trunk: Bring new object header pin/unpin & protect/unprotect routines and split-out object header chunk proxy changes from metadata_journaling branch to "merging" branch, along with some other minor tweaks to clean up compiler warnings, etc. Also: clean up chunk protect/unprotect calls when allocating or freeing space in a chunk, optimize metadata accumulator code to avoid some re-reading of information from the file, refactor H5O_pin/H5O_unpin from way they are done on the merging branch back to way they were previously done on trunk, other minor code cleanups, etc. Tested on FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/64-amd64 2.6 (amani) 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 debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
This commit is contained in:
parent
227a351e47
commit
ebd22f7643
1
MANIFEST
1
MANIFEST
@ -659,6 +659,7 @@
|
||||
./src/H5Obogus.c
|
||||
./src/H5Obtreek.c
|
||||
./src/H5Ocache.c
|
||||
./src/H5Ochunk.c
|
||||
./src/H5Ocont.c
|
||||
./src/H5Ocopy.c
|
||||
./src/H5Odbg.c
|
||||
|
@ -154,7 +154,7 @@ static herr_t H5AC_log_deleted_entry(H5AC_t * cache_ptr,
|
||||
haddr_t addr,
|
||||
unsigned int flags);
|
||||
|
||||
static herr_t H5AC_log_dirtied_entry(const H5C_cache_entry_t *entry_ptr,
|
||||
static herr_t H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr,
|
||||
haddr_t addr,
|
||||
hbool_t size_changed,
|
||||
size_t new_size);
|
||||
@ -482,6 +482,7 @@ static const char * H5AC_entry_type_names[H5AC_NTYPES] =
|
||||
"local heap data blocks",
|
||||
"global heaps",
|
||||
"object headers",
|
||||
"object header chunks",
|
||||
"v2 B-tree headers",
|
||||
"v2 B-tree internal nodes",
|
||||
"v2 B-tree leaf nodes",
|
||||
@ -2821,7 +2822,6 @@ herr_t
|
||||
H5AC_validate_config(H5AC_cache_config_t * config_ptr)
|
||||
{
|
||||
herr_t result;
|
||||
int name_len;
|
||||
H5C_auto_size_ctl_t internal_config;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
@ -2860,6 +2860,7 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr)
|
||||
|
||||
/* don't bother to test trace_file_name unless open_trace_file is TRUE */
|
||||
if ( config_ptr->open_trace_file ) {
|
||||
size_t name_len;
|
||||
|
||||
/* Can't really test the trace_file_name field without trying to
|
||||
* open the file, so we will content ourselves with a couple of
|
||||
|
@ -49,6 +49,7 @@ typedef enum {
|
||||
H5AC_LHEAP_DBLK_ID, /*local heap data block */
|
||||
H5AC_GHEAP_ID, /*global heap */
|
||||
H5AC_OHDR_ID, /*object header */
|
||||
H5AC_OHDR_CHK_ID, /*object header chunk */
|
||||
H5AC_BT2_HDR_ID, /*v2 B-tree header */
|
||||
H5AC_BT2_INT_ID, /*v2 B-tree internal node */
|
||||
H5AC_BT2_LEAF_ID, /*v2 B-tree leaf node */
|
||||
|
@ -620,8 +620,7 @@ done:
|
||||
H5SL_close(cache_ptr->slist_ptr);
|
||||
|
||||
cache_ptr->magic = 0;
|
||||
(void)H5FL_FREE(H5C_t, cache_ptr);
|
||||
cache_ptr = NULL;
|
||||
cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
|
||||
|
||||
} /* end if */
|
||||
|
||||
|
238
src/H5Cpkg.h
238
src/H5Cpkg.h
@ -96,11 +96,11 @@
|
||||
*
|
||||
* JRM - 9/26/05
|
||||
*
|
||||
* magic: Unsigned 32 bit integer always set to H5C__H5C_T_MAGIC.
|
||||
* This field is used to validate pointers to instances of
|
||||
* magic: Unsigned 32 bit integer always set to H5C__H5C_T_MAGIC.
|
||||
* This field is used to validate pointers to instances of
|
||||
* H5C_t.
|
||||
*
|
||||
* flush_in_progress: Boolean flag indicating whether a flush is in
|
||||
* flush_in_progress: Boolean flag indicating whether a flush is in
|
||||
* progress.
|
||||
*
|
||||
* trace_file_ptr: File pointer pointing to the trace file, which is used
|
||||
@ -109,7 +109,7 @@
|
||||
* no trace file should be recorded.
|
||||
*
|
||||
* Since much of the code supporting the parallel metadata
|
||||
* cache is in H5AC, we don't write the trace file from
|
||||
* cache is in H5AC, we don't write the trace file from
|
||||
* H5C. Instead, H5AC reads the trace_file_ptr as needed.
|
||||
*
|
||||
* When we get to using H5C in other places, we may add
|
||||
@ -182,7 +182,7 @@
|
||||
* writes. The following field is used to implement this.
|
||||
*
|
||||
* evictions_enabled: Boolean flag that is initialized to TRUE. When
|
||||
* this flag is set to FALSE, the metadata cache will not
|
||||
* this flag is set to FALSE, the metadata cache will not
|
||||
* attempt to evict entries to make space for newly protected
|
||||
* entries, and instead the will grow without limit.
|
||||
*
|
||||
@ -288,7 +288,7 @@
|
||||
* following two fields have been added. They are only compiled in when
|
||||
* H5C_DO_SANITY_CHECKS is TRUE.
|
||||
*
|
||||
* slist_len_increase: Number of entries that have been added to the
|
||||
* slist_len_increase: Number of entries that have been added to the
|
||||
* slist since the last time this field was set to zero.
|
||||
*
|
||||
* slist_size_increase: Total size of all entries that have been added
|
||||
@ -625,23 +625,23 @@
|
||||
* equal to the array index has not been in cache when
|
||||
* requested in the current epoch.
|
||||
*
|
||||
* write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
|
||||
* cells are used to record the number of times an entry with
|
||||
* type id equal to the array index has been write protected
|
||||
* write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
|
||||
* cells are used to record the number of times an entry with
|
||||
* type id equal to the array index has been write protected
|
||||
* in the current epoch.
|
||||
*
|
||||
* Observe that (hits + misses) = (write_protects + read_protects).
|
||||
*
|
||||
* read_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
|
||||
* cells are used to record the number of times an entry with
|
||||
* type id equal to the array index has been read protected in
|
||||
* read_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The
|
||||
* cells are used to record the number of times an entry with
|
||||
* type id equal to the array index has been read protected in
|
||||
* the current epoch.
|
||||
*
|
||||
* Observe that (hits + misses) = (write_protects + read_protects).
|
||||
*
|
||||
* max_read_protects: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to maximum number of simultaneous read
|
||||
* protects on any entry with type id equal to the array index
|
||||
* max_read_protects: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to maximum number of simultaneous read
|
||||
* protects on any entry with type id equal to the array index
|
||||
* in the current epoch.
|
||||
*
|
||||
* insertions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
|
||||
@ -649,9 +649,9 @@
|
||||
* id equal to the array index has been inserted into the
|
||||
* cache in the current epoch.
|
||||
*
|
||||
* pinned_insertions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to record the number of times an entry
|
||||
* with type id equal to the array index has been inserted
|
||||
* pinned_insertions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to record the number of times an entry
|
||||
* with type id equal to the array index has been inserted
|
||||
* pinned into the cache in the current epoch.
|
||||
*
|
||||
* clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells
|
||||
@ -674,13 +674,13 @@
|
||||
* id equal to the array index has been renamed in the current
|
||||
* epoch.
|
||||
*
|
||||
* entry_flush_renames: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to record the number of times an entry
|
||||
* entry_flush_renames: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to record the number of times an entry
|
||||
* with type id equal to the array index has been renamed
|
||||
* during its flush callback in the current epoch.
|
||||
*
|
||||
* cache_flush_renames: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to record the number of times an entry
|
||||
* cache_flush_renames: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1.
|
||||
* The cells are used to record the number of times an entry
|
||||
* with type id equal to the array index has been renamed
|
||||
* during a cache flush in the current epoch.
|
||||
*
|
||||
@ -719,14 +719,14 @@
|
||||
* with type id equal to the array index has decreased in
|
||||
* size in the current epoch.
|
||||
*
|
||||
* entry_flush_size_changes: Array of int64 of length
|
||||
* H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
|
||||
* the number of times an entry with type id equal to the
|
||||
* entry_flush_size_changes: Array of int64 of length
|
||||
* H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
|
||||
* the number of times an entry with type id equal to the
|
||||
* array index has changed size while in its flush callback.
|
||||
*
|
||||
* cache_flush_size_changes: Array of int64 of length
|
||||
* H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
|
||||
* the number of times an entry with type id equal to the
|
||||
* cache_flush_size_changes: Array of int64 of length
|
||||
* H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record
|
||||
* the number of times an entry with type id equal to the
|
||||
* array index has changed size during a cache flush
|
||||
*
|
||||
* total_ht_insertions: Number of times entries have been inserted into the
|
||||
@ -860,7 +860,7 @@
|
||||
#define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */
|
||||
|
||||
#define H5C__H5C_T_MAGIC 0x005CAC0E
|
||||
#define H5C__MAX_NUM_TYPE_IDS 26
|
||||
#define H5C__MAX_NUM_TYPE_IDS 27
|
||||
#define H5C__PREFIX_LEN 32
|
||||
|
||||
struct H5C_t
|
||||
@ -1449,7 +1449,7 @@ if ( ( (entry_ptr) == NULL ) || \
|
||||
* More pinned entry stats related updates.
|
||||
*
|
||||
* JRM -- 3/31/07
|
||||
* Updated H5C__UPDATE_STATS_FOR_PROTECT() to keep stats on
|
||||
* Updated H5C__UPDATE_STATS_FOR_PROTECT() to keep stats on
|
||||
* read and write protects.
|
||||
*
|
||||
* MAM -- 1/15/09
|
||||
@ -2877,7 +2877,7 @@ if ( (cache_ptr)->index_size != \
|
||||
(cache_ptr)->pel_tail_ptr, \
|
||||
(cache_ptr)->pel_len, \
|
||||
(cache_ptr)->pel_size, (fail_val)) \
|
||||
\
|
||||
\
|
||||
} else { \
|
||||
\
|
||||
/* modified LRU specific code */ \
|
||||
@ -3122,62 +3122,70 @@ if ( (cache_ptr)->index_size != \
|
||||
HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
|
||||
HDassert( (entry_ptr)->size > 0 ); \
|
||||
\
|
||||
if ( ! ((entry_ptr)->is_pinned) ) { \
|
||||
\
|
||||
if ( ! ( (entry_ptr)->is_pinned ) ) { \
|
||||
\
|
||||
/* modified LRU specific code */ \
|
||||
\
|
||||
/* remove the entry from the LRU list, and re-insert it at the head. \
|
||||
*/ \
|
||||
\
|
||||
H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
\
|
||||
H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
\
|
||||
/* remove the entry from either the clean or dirty LUR list as \
|
||||
* indicated by the was_dirty parameter \
|
||||
*/ \
|
||||
if ( was_dirty ) { \
|
||||
/* remove the entry from either the clean or dirty LUR list as \
|
||||
* indicated by the was_dirty parameter \
|
||||
*/ \
|
||||
if ( was_dirty ) { \
|
||||
\
|
||||
H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
|
||||
(cache_ptr)->dLRU_tail_ptr, \
|
||||
(cache_ptr)->dLRU_list_len, \
|
||||
(cache_ptr)->dLRU_list_size, (fail_val)) \
|
||||
H5C__AUX_DLL_REMOVE((entry_ptr), \
|
||||
(cache_ptr)->dLRU_head_ptr, \
|
||||
(cache_ptr)->dLRU_tail_ptr, \
|
||||
(cache_ptr)->dLRU_list_len, \
|
||||
(cache_ptr)->dLRU_list_size, \
|
||||
(fail_val)) \
|
||||
\
|
||||
} else { \
|
||||
} else { \
|
||||
\
|
||||
H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
|
||||
(cache_ptr)->cLRU_tail_ptr, \
|
||||
(cache_ptr)->cLRU_list_len, \
|
||||
(cache_ptr)->cLRU_list_size, (fail_val)) \
|
||||
H5C__AUX_DLL_REMOVE((entry_ptr), \
|
||||
(cache_ptr)->cLRU_head_ptr, \
|
||||
(cache_ptr)->cLRU_tail_ptr, \
|
||||
(cache_ptr)->cLRU_list_len, \
|
||||
(cache_ptr)->cLRU_list_size, \
|
||||
(fail_val)) \
|
||||
} \
|
||||
\
|
||||
/* insert the entry at the head of either the clean or dirty \
|
||||
* LRU list as appropriate. \
|
||||
*/ \
|
||||
\
|
||||
if ( (entry_ptr)->is_dirty ) { \
|
||||
\
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), \
|
||||
(cache_ptr)->dLRU_head_ptr, \
|
||||
(cache_ptr)->dLRU_tail_ptr, \
|
||||
(cache_ptr)->dLRU_list_len, \
|
||||
(cache_ptr)->dLRU_list_size, \
|
||||
(fail_val)) \
|
||||
\
|
||||
} else { \
|
||||
\
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), \
|
||||
(cache_ptr)->cLRU_head_ptr, \
|
||||
(cache_ptr)->cLRU_tail_ptr, \
|
||||
(cache_ptr)->cLRU_list_len, \
|
||||
(cache_ptr)->cLRU_list_size, \
|
||||
(fail_val)) \
|
||||
} \
|
||||
\
|
||||
/* End modified LRU specific code. */ \
|
||||
} \
|
||||
\
|
||||
/* insert the entry at the head of either the clean or dirty LRU \
|
||||
* list as appropriate. \
|
||||
*/ \
|
||||
\
|
||||
if ( (entry_ptr)->is_dirty ) { \
|
||||
\
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
|
||||
(cache_ptr)->dLRU_tail_ptr, \
|
||||
(cache_ptr)->dLRU_list_len, \
|
||||
(cache_ptr)->dLRU_list_size, (fail_val)) \
|
||||
\
|
||||
} else { \
|
||||
\
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
|
||||
(cache_ptr)->cLRU_tail_ptr, \
|
||||
(cache_ptr)->cLRU_list_len, \
|
||||
(cache_ptr)->cLRU_list_size, (fail_val)) \
|
||||
} \
|
||||
\
|
||||
/* End modified LRU specific code. */ \
|
||||
} \
|
||||
} /* H5C__UPDATE_RP_FOR_RENAME */
|
||||
|
||||
#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
|
||||
@ -3192,25 +3200,25 @@ if ( (cache_ptr)->index_size != \
|
||||
HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \
|
||||
HDassert( (entry_ptr)->size > 0 ); \
|
||||
\
|
||||
if ( ! ((entry_ptr)->is_pinned) ) { \
|
||||
\
|
||||
if ( ! ( (entry_ptr)->is_pinned ) ) { \
|
||||
\
|
||||
/* modified LRU specific code */ \
|
||||
\
|
||||
/* remove the entry from the LRU list, and re-insert it at the head. \
|
||||
*/ \
|
||||
\
|
||||
H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
\
|
||||
H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
\
|
||||
/* End modified LRU specific code. */ \
|
||||
} \
|
||||
/* End modified LRU specific code. */ \
|
||||
} \
|
||||
} /* H5C__UPDATE_RP_FOR_RENAME */
|
||||
|
||||
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
|
||||
@ -3267,7 +3275,7 @@ if ( (cache_ptr)->index_size != \
|
||||
(cache_ptr)->pel_size, \
|
||||
(entry_ptr)->size, \
|
||||
(new_size)); \
|
||||
\
|
||||
\
|
||||
} else { \
|
||||
\
|
||||
/* modified LRU specific code */ \
|
||||
@ -3393,35 +3401,39 @@ if ( (cache_ptr)->index_size != \
|
||||
(cache_ptr)->pel_size, (fail_val)) \
|
||||
HDassert( (cache_ptr)->pel_len >= 0 ); \
|
||||
\
|
||||
/* modified LRU specific code */ \
|
||||
/* modified LRU specific code */ \
|
||||
\
|
||||
/* insert the entry at the head of the LRU list. */ \
|
||||
/* insert the entry at the head of the LRU list. */ \
|
||||
\
|
||||
H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
\
|
||||
/* Similarly, insert the entry at the head of either the clean or \
|
||||
* dirty LRU list as appropriate. \
|
||||
*/ \
|
||||
/* Similarly, insert the entry at the head of either the clean \
|
||||
* or dirty LRU list as appropriate. \
|
||||
*/ \
|
||||
\
|
||||
if ( (entry_ptr)->is_dirty ) { \
|
||||
if ( (entry_ptr)->is_dirty ) { \
|
||||
\
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \
|
||||
(cache_ptr)->dLRU_tail_ptr, \
|
||||
(cache_ptr)->dLRU_list_len, \
|
||||
(cache_ptr)->dLRU_list_size, (fail_val)) \
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), \
|
||||
(cache_ptr)->dLRU_head_ptr, \
|
||||
(cache_ptr)->dLRU_tail_ptr, \
|
||||
(cache_ptr)->dLRU_list_len, \
|
||||
(cache_ptr)->dLRU_list_size, \
|
||||
(fail_val)) \
|
||||
\
|
||||
} else { \
|
||||
} else { \
|
||||
\
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \
|
||||
(cache_ptr)->cLRU_tail_ptr, \
|
||||
(cache_ptr)->cLRU_list_len, \
|
||||
(cache_ptr)->cLRU_list_size, (fail_val)) \
|
||||
} \
|
||||
H5C__AUX_DLL_PREPEND((entry_ptr), \
|
||||
(cache_ptr)->cLRU_head_ptr, \
|
||||
(cache_ptr)->cLRU_tail_ptr, \
|
||||
(cache_ptr)->cLRU_list_len, \
|
||||
(cache_ptr)->cLRU_list_size, \
|
||||
(fail_val)) \
|
||||
} \
|
||||
\
|
||||
/* End modified LRU specific code. */ \
|
||||
/* End modified LRU specific code. */ \
|
||||
\
|
||||
} /* H5C__UPDATE_RP_FOR_UNPIN */
|
||||
|
||||
@ -3446,16 +3458,16 @@ if ( (cache_ptr)->index_size != \
|
||||
(cache_ptr)->pel_size, (fail_val)) \
|
||||
HDassert( (cache_ptr)->pel_len >= 0 ); \
|
||||
\
|
||||
/* modified LRU specific code */ \
|
||||
/* modified LRU specific code */ \
|
||||
\
|
||||
/* insert the entry at the head of the LRU list. */ \
|
||||
/* insert the entry at the head of the LRU list. */ \
|
||||
\
|
||||
H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \
|
||||
(cache_ptr)->LRU_tail_ptr, \
|
||||
(cache_ptr)->LRU_list_len, \
|
||||
(cache_ptr)->LRU_list_size, (fail_val)) \
|
||||
\
|
||||
/* End modified LRU specific code. */ \
|
||||
/* End modified LRU specific code. */ \
|
||||
\
|
||||
} /* H5C__UPDATE_RP_FOR_UNPIN */
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5ACprivate.h" /* Metadata cache */
|
||||
#include "H5Dpkg.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
@ -794,7 +793,7 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
|
||||
HDassert(file == dset->oloc.file);
|
||||
|
||||
/* Get a pointer to the object header itself */
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(oloc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
|
||||
|
||||
@ -2261,7 +2260,7 @@ H5D_flush_real(H5D_t *dataset, hid_t dxpl_id)
|
||||
if(dataset->shared->layout_dirty || dataset->shared->space_dirty) {
|
||||
unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */
|
||||
|
||||
/* Get a pointer to the dataset's object header */
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header")
|
||||
|
||||
|
@ -159,7 +159,7 @@ H5O_dset_free_copy_file_udata(void *_udata)
|
||||
H5O_msg_free(H5O_PLINE_ID, udata->common.src_pline);
|
||||
|
||||
/* Release space for 'copy file' user data */
|
||||
(void)H5FL_FREE(H5D_copy_file_ud_t, udata);
|
||||
udata = H5FL_FREE(H5D_copy_file_ud_t, udata);
|
||||
|
||||
FUNC_LEAVE_NOAPI_VOID
|
||||
} /* end H5O_dset_free_copy_file_udata() */
|
||||
|
@ -2352,7 +2352,7 @@ H5FL_fac_term(H5FL_fac_head_t *factory)
|
||||
} /* end else */
|
||||
|
||||
/* Free factory info */
|
||||
(void)H5FL_FREE(H5FL_fac_head_t, factory);
|
||||
factory = H5FL_FREE(H5FL_fac_head_t, factory);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
125
src/H5Faccum.c
125
src/H5Faccum.c
@ -126,68 +126,68 @@ H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
|
||||
/* Check if this information is in the metadata accumulator */
|
||||
if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW
|
||||
&& size < H5F_ACCUM_MAX_SIZE) {
|
||||
/* Current read overlaps with metadata accumulator */
|
||||
if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)) {
|
||||
unsigned char *read_buf = (unsigned char *)buf; /* Pointer to the buffer being read in */
|
||||
size_t amount_read; /* Amount to read at a time */
|
||||
hsize_t read_off; /* Offset to read from */
|
||||
/* Sanity check */
|
||||
HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size));
|
||||
|
||||
/* Current read adjoins or overlaps with metadata accumulator */
|
||||
if(H5F_addr_overlap(addr, size, f->shared->accum.loc, f->shared->accum.size)
|
||||
|| ((addr + size) == f->shared->accum.loc)
|
||||
|| (f->shared->accum.loc + f->shared->accum.size) == addr) {
|
||||
size_t amount_before; /* Amount to read before current accumulator */
|
||||
haddr_t new_addr; /* New address of the accumulator buffer */
|
||||
size_t new_size; /* New size of the accumulator buffer */
|
||||
|
||||
/* Compute new values for accumulator */
|
||||
new_addr = MIN(addr, f->shared->accum.loc);
|
||||
new_size = (size_t)(MAX((addr + size), (f->shared->accum.loc + f->shared->accum.size))
|
||||
- new_addr);
|
||||
|
||||
/* Check if we need more buffer space */
|
||||
if(new_size > f->shared->accum.size) {
|
||||
/* Adjust the buffer size, by doubling it */
|
||||
f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size * 2, new_size);
|
||||
|
||||
/* Reallocate the metadata accumulator buffer */
|
||||
if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size)))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate metadata accumulator buffer")
|
||||
#ifdef H5_CLEAR_MEMORY
|
||||
HDmemset(f->shared->accum.buf + f->shared->accum.size, 0, (f->shared->accum.alloc_size - f->shared->accum.size));
|
||||
#endif /* H5_CLEAR_MEMORY */
|
||||
} /* end if */
|
||||
|
||||
/* Read the part before the metadata accumulator */
|
||||
if(addr < f->shared->accum.loc) {
|
||||
/* Set the amount to read */
|
||||
H5_ASSIGN_OVERFLOW(amount_read, (f->shared->accum.loc - addr), hsize_t, size_t);
|
||||
H5_ASSIGN_OVERFLOW(amount_before, (f->shared->accum.loc - addr), hsize_t, size_t);
|
||||
|
||||
/* Make room for the metadata to read in */
|
||||
HDmemmove(f->shared->accum.buf + amount_before, f->shared->accum.buf, f->shared->accum.size);
|
||||
|
||||
/* Dispatch to driver */
|
||||
if(H5FD_read(f->shared->lf, dxpl_id, type, addr, amount_read, read_buf) < 0)
|
||||
if(H5FD_read(f->shared->lf, dxpl_id, type, addr, amount_before, f->shared->accum.buf) < 0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
|
||||
|
||||
/* Adjust the buffer, address & size */
|
||||
read_buf += amount_read;
|
||||
addr += amount_read;
|
||||
size -= amount_read;
|
||||
} /* end if */
|
||||
|
||||
/* Copy the part overlapping the metadata accumulator */
|
||||
if(size > 0 && (addr >= f->shared->accum.loc && addr < (f->shared->accum.loc + f->shared->accum.size))) {
|
||||
/* Set the offset to "read" from */
|
||||
read_off = addr - f->shared->accum.loc;
|
||||
|
||||
/* Set the amount to "read" */
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
hsize_t tempamount_read; /* Amount to read at a time */
|
||||
|
||||
tempamount_read = f->shared->accum.size - read_off;
|
||||
H5_CHECK_OVERFLOW(tempamount_read, hsize_t, size_t);
|
||||
amount_read = MIN(size, (size_t)tempamount_read);
|
||||
}
|
||||
#else /* NDEBUG */
|
||||
amount_read = MIN(size, (size_t)(f->shared->accum.size - read_off));
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/* Copy the data out of the buffer */
|
||||
HDmemcpy(read_buf, f->shared->accum.buf + read_off, amount_read);
|
||||
|
||||
/* Adjust the buffer, address & size */
|
||||
read_buf += amount_read;
|
||||
addr += amount_read;
|
||||
size -= amount_read;
|
||||
} /* end if */
|
||||
else
|
||||
amount_before = 0;
|
||||
|
||||
/* Read the part after the metadata accumulator */
|
||||
if(size > 0 && addr >= (f->shared->accum.loc + f->shared->accum.size)) {
|
||||
/* Dispatch to driver */
|
||||
if(H5FD_read(f->shared->lf, dxpl_id, type, addr, size, read_buf) < 0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
|
||||
if((addr + size) > (f->shared->accum.loc + f->shared->accum.size)) {
|
||||
size_t amount_after; /* Amount to read at a time */
|
||||
|
||||
/* Adjust the buffer, address & size */
|
||||
read_buf += size;
|
||||
addr += size;
|
||||
size -= size;
|
||||
/* Set the amount to read */
|
||||
H5_ASSIGN_OVERFLOW(amount_after, ((addr + size) - (f->shared->accum.loc + f->shared->accum.size)), hsize_t, size_t);
|
||||
|
||||
/* Dispatch to driver */
|
||||
if(H5FD_read(f->shared->lf, dxpl_id, type, (f->shared->accum.loc + f->shared->accum.size), amount_after, (f->shared->accum.buf + f->shared->accum.size + amount_before)) < 0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed")
|
||||
} /* end if */
|
||||
|
||||
/* Make certain we've read it all */
|
||||
HDassert(size == 0);
|
||||
/* Copy the data out of the buffer */
|
||||
HDmemcpy(buf, f->shared->accum.buf + (addr - new_addr), size);
|
||||
|
||||
/* Adjust the accumulator address & size */
|
||||
f->shared->accum.loc = new_addr;
|
||||
f->shared->accum.size = new_size;
|
||||
} /* end if */
|
||||
/* Current read doesn't overlap with metadata accumulator, read it from file */
|
||||
else {
|
||||
@ -340,6 +340,9 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
|
||||
/* Check for accumulating metadata */
|
||||
if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && type != H5FD_MEM_DRAW
|
||||
&& size < H5F_ACCUM_MAX_SIZE) {
|
||||
/* Sanity check */
|
||||
HDassert(!f->shared->accum.buf || (f->shared->accum.alloc_size >= f->shared->accum.size));
|
||||
|
||||
/* Check if there is already metadata in the accumulator */
|
||||
if(f->shared->accum.size > 0) {
|
||||
/* Check if the new metadata adjoins the beginning of the current accumulator */
|
||||
@ -433,8 +436,30 @@ H5F_accum_write(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr,
|
||||
/* Mark it as written to */
|
||||
f->shared->accum.dirty = TRUE;
|
||||
} /* end if */
|
||||
/* New metadata overlaps both ends of the current accumulator */
|
||||
else {
|
||||
HDassert(0 && "New metadata overlapped both beginning and end of existing metadata accumulator!");
|
||||
/* Check if we need more buffer space */
|
||||
if(size > f->shared->accum.size) {
|
||||
/* Adjust the buffer size, by doubling it */
|
||||
f->shared->accum.alloc_size = MAX(f->shared->accum.alloc_size * 2, size);
|
||||
|
||||
/* Reallocate the metadata accumulator buffer */
|
||||
if(NULL == (f->shared->accum.buf = H5FL_BLK_REALLOC(meta_accum, f->shared->accum.buf, f->shared->accum.alloc_size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate metadata accumulator buffer")
|
||||
#ifdef H5_CLEAR_MEMORY
|
||||
HDmemset(f->shared->accum.buf + size, 0, (f->shared->accum.alloc_size - size));
|
||||
#endif /* H5_CLEAR_MEMORY */
|
||||
} /* end if */
|
||||
|
||||
/* Copy the new metadata to the buffer */
|
||||
HDmemcpy(f->shared->accum.buf, buf, size);
|
||||
|
||||
/* Set the new size & location of the metadata accumulator */
|
||||
f->shared->accum.loc = addr;
|
||||
f->shared->accum.size = size;
|
||||
|
||||
/* Mark it as written to */
|
||||
f->shared->accum.dirty = TRUE;
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
/* New piece of metadata doesn't adjoin or overlap the existing accumulator */
|
||||
|
@ -120,8 +120,8 @@ H5F_fake_free(H5F_t *f)
|
||||
if(f) {
|
||||
/* Destroy shared file struct */
|
||||
if(f->shared)
|
||||
f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared);
|
||||
(void)H5FL_FREE(H5F_t, f);
|
||||
f->shared = H5FL_FREE(H5F_file_t, f->shared);
|
||||
f = H5FL_FREE(H5F_t, f);
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
|
@ -219,7 +219,7 @@ H5F_sfile_remove(H5F_file_t *shared)
|
||||
|
||||
/* Release the shared file node struct */
|
||||
/* (the shared file info itself is freed elsewhere) */
|
||||
(void)H5FL_FREE(H5F_sfile_node_t, curr);
|
||||
curr = H5FL_FREE(H5F_sfile_node_t, curr);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
@ -1772,8 +1772,7 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
|
||||
H5G_t *grp = NULL; /* Group opened */
|
||||
H5G_loc_t loc; /* Location of group passed in */
|
||||
H5G_loc_t start_loc; /* Location of starting group */
|
||||
H5O_type_t otype; /* Basic object type (group, dataset, etc.) */
|
||||
unsigned rc; /* Reference count of object */
|
||||
unsigned rc; /* Reference count of object */
|
||||
herr_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5G_visit, FAIL)
|
||||
@ -1814,8 +1813,8 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type,
|
||||
if((udata.visited = H5SL_create(H5SL_TYPE_OBJ)) == NULL)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects")
|
||||
|
||||
/* Get the group's reference count and type */
|
||||
if(H5O_get_rc_and_type(&grp->oloc, dxpl_id, &rc, &otype) < 0)
|
||||
/* Get the group's reference count */
|
||||
if(H5O_get_rc_and_type(&grp->oloc, dxpl_id, &rc, NULL) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object info")
|
||||
|
||||
/* If its ref count is > 1, we add it to the list of visited objects */
|
||||
|
@ -901,7 +901,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
|
||||
if(H5G_dense_build_table(oloc->file, dxpl_id, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, <able) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links")
|
||||
|
||||
/* Get a pointer to the object header itself */
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(oloc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTPIN, FAIL, "unable to pin group object header")
|
||||
|
||||
|
517
src/H5O.c
517
src/H5O.c
@ -141,6 +141,9 @@ H5FL_SEQ_DEFINE(H5O_chunk_t);
|
||||
/* Declare a free list to manage the chunk image information */
|
||||
H5FL_BLK_DEFINE(chunk_image);
|
||||
|
||||
/* Declare external the free list for H5O_cont_t sequences */
|
||||
H5FL_SEQ_EXTERN(H5O_cont_t);
|
||||
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
@ -1173,7 +1176,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
|
||||
/* Determine correct value for chunk #0 size bits */
|
||||
/* Avoid compiler warning on 32-bit machines */
|
||||
#if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T
|
||||
if(size_hint > 4294967295)
|
||||
if(size_hint > 4294967295UL)
|
||||
oh->flags |= H5O_HDR_CHUNK0_8;
|
||||
else
|
||||
#endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */
|
||||
@ -1189,7 +1192,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
|
||||
|
||||
/* Compute total size of initial object header */
|
||||
/* (i.e. object header prefix and first chunk) */
|
||||
oh_size = H5O_SIZEOF_HDR(oh) + size_hint;
|
||||
oh_size = (size_t)H5O_SIZEOF_HDR(oh) + size_hint;
|
||||
|
||||
/* Allocate disk space for header and first chunk */
|
||||
if(HADDR_UNDEF == (oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)oh_size)))
|
||||
@ -1201,7 +1204,6 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||
|
||||
/* Initialize the first chunk */
|
||||
oh->chunk[0].dirty = TRUE;
|
||||
oh->chunk[0].addr = oh_addr;
|
||||
oh->chunk[0].size = oh_size;
|
||||
oh->chunk[0].gap = 0;
|
||||
@ -1457,13 +1459,18 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted)
|
||||
{
|
||||
haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */
|
||||
int ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_link_oh, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
HDassert(deleted);
|
||||
|
||||
/* Check for adjusting link count */
|
||||
if(adjust) {
|
||||
if(adjust < 0) {
|
||||
@ -1475,7 +1482,8 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
oh->nlink += adjust;
|
||||
|
||||
/* Mark object header as dirty in cache */
|
||||
*oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
|
||||
|
||||
/* Check if the object should be deleted */
|
||||
if(oh->nlink == 0) {
|
||||
@ -1486,12 +1494,8 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion")
|
||||
} /* end if */
|
||||
else {
|
||||
/* Delete object right now */
|
||||
if(H5O_delete_oh(f, dxpl_id, oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
|
||||
|
||||
/* Mark the object header for deletion */
|
||||
*oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
|
||||
*deleted = TRUE;
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
@ -1510,7 +1514,8 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
oh->nlink += adjust;
|
||||
|
||||
/* Mark object header as dirty in cache */
|
||||
*oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
|
||||
} /* end if */
|
||||
|
||||
/* Check for operations on refcount message */
|
||||
@ -1520,7 +1525,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
/* Check for removing refcount message */
|
||||
if(oh->nlink <= 1) {
|
||||
if(H5O_msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete refcount message")
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete refcount message")
|
||||
oh->has_refcount_msg = FALSE;
|
||||
} /* end if */
|
||||
/* Update refcount message with new link count */
|
||||
@ -1528,7 +1533,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
H5O_refcount_t refcount = oh->nlink;
|
||||
|
||||
if(H5O_msg_write_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update refcount message")
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update refcount message")
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
else {
|
||||
@ -1537,7 +1542,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
H5O_refcount_t refcount = oh->nlink;
|
||||
|
||||
if(H5O_msg_append_real(f, dxpl_id, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new refcount message")
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to create new refcount message")
|
||||
oh->has_refcount_msg = TRUE;
|
||||
} /* end if */
|
||||
} /* end else */
|
||||
@ -1548,7 +1553,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags)
|
||||
ret_value = (int)oh->nlink;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_link_oh() */
|
||||
|
||||
|
||||
@ -1572,9 +1577,8 @@ int
|
||||
H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
|
||||
{
|
||||
H5O_t *oh = NULL;
|
||||
H5AC_protect_t oh_acc; /* Access mode for protecting object header */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Whether the object was deleted */
|
||||
int ret_value; /* Return value */
|
||||
hbool_t deleted = FALSE; /* Whether the object was deleted */
|
||||
int ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_link, FAIL)
|
||||
|
||||
@ -1583,22 +1587,236 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
|
||||
HDassert(loc->file);
|
||||
HDassert(H5F_addr_defined(loc->addr));
|
||||
|
||||
/* Get header */
|
||||
oh_acc = adjust ? H5AC_WRITE : H5AC_READ;
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Call the "real" link routine */
|
||||
if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &oh_flags)) < 0)
|
||||
if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &deleted)) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust object link count")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
if(ret_value >= 0 && deleted && H5O_delete(loc->file, dxpl_id, loc->addr) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_link() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_protect
|
||||
*
|
||||
* Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
|
||||
* H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
|
||||
* during an object's creation.
|
||||
*
|
||||
* Return: Success: Pointer to the object header structure for the
|
||||
* object.
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Dec 31 2002
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5O_t *
|
||||
H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Object header protected */
|
||||
H5O_cache_ud_t udata; /* User data for protecting object header */
|
||||
H5O_cont_msgs_t cont_msg_info; /* Continuation message info */
|
||||
unsigned file_intent; /* R/W intent on file */
|
||||
H5O_t *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_protect, NULL)
|
||||
|
||||
/* check args */
|
||||
HDassert(loc);
|
||||
HDassert(loc->file);
|
||||
HDassert(H5F_addr_defined(loc->addr));
|
||||
|
||||
/* Check for write access on the file */
|
||||
file_intent = H5F_INTENT(loc->file);
|
||||
if((prot == H5AC_WRITE) && (0 == (file_intent & H5F_ACC_RDWR)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
|
||||
|
||||
/* Construct the user data for protect callback */
|
||||
udata.made_attempt = FALSE;
|
||||
udata.v1_pfx_nmesgs = 0;
|
||||
udata.common.f = loc->file;
|
||||
udata.common.dxpl_id = dxpl_id;
|
||||
udata.common.file_intent = file_intent;
|
||||
udata.common.merged_null_msgs = 0;
|
||||
udata.common.mesgs_modified = FALSE;
|
||||
HDmemset(&cont_msg_info, 0, sizeof(cont_msg_info));
|
||||
udata.common.cont_msg_info = &cont_msg_info;
|
||||
|
||||
/* Lock the object header into the cache */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, &udata, prot)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
|
||||
|
||||
/* Check if there are any continuation messages to process */
|
||||
if(cont_msg_info.nmsgs > 0) {
|
||||
size_t curr_msg; /* Current continuation message to process */
|
||||
H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */
|
||||
|
||||
/* Sanity check - we should only have continuation messages to process
|
||||
* when the object header is actually loaded from the file.
|
||||
*/
|
||||
HDassert(udata.made_attempt == TRUE);
|
||||
|
||||
/* Construct the user data for protecting chunks */
|
||||
chk_udata.decoding = TRUE;
|
||||
chk_udata.oh = oh;
|
||||
chk_udata.chunkno = UINT_MAX; /* Set to invalid value, for better error detection */
|
||||
chk_udata.common.f = loc->file;
|
||||
chk_udata.common.dxpl_id = dxpl_id;
|
||||
chk_udata.common.file_intent = file_intent;
|
||||
chk_udata.common.merged_null_msgs = udata.common.merged_null_msgs;
|
||||
chk_udata.common.mesgs_modified = udata.common.mesgs_modified;
|
||||
chk_udata.common.cont_msg_info = &cont_msg_info;
|
||||
|
||||
/* Read in continuation messages, until there are no more */
|
||||
curr_msg = 0;
|
||||
while(curr_msg < cont_msg_info.nmsgs) {
|
||||
H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to bring it into memory */
|
||||
#ifndef NDEBUG
|
||||
unsigned chkcnt = oh->nchunks; /* Count of chunks (for sanity checking) */
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/* Bring the chunk into the cache */
|
||||
/* (which adds to the object header */
|
||||
chk_udata.chunk_size = cont_msg_info.msgs[curr_msg].size;
|
||||
if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, NULL, &chk_udata, prot)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(chk_proxy->oh == oh);
|
||||
HDassert(chk_proxy->chunkno == chkcnt);
|
||||
HDassert(oh->nchunks == (chkcnt + 1));
|
||||
|
||||
/* Release the chunk from the cache */
|
||||
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header chunk")
|
||||
|
||||
/* Advance to next continuation message */
|
||||
curr_msg++;
|
||||
} /* end while */
|
||||
|
||||
/* Release any continuation messages built up */
|
||||
if(cont_msg_info.msgs)
|
||||
cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs);
|
||||
|
||||
/* Pass back out some of the chunk's user data */
|
||||
udata.common.merged_null_msgs = chk_udata.common.merged_null_msgs;
|
||||
udata.common.mesgs_modified = chk_udata.common.mesgs_modified;
|
||||
} /* end if */
|
||||
|
||||
/* Check for incorrect # of object header messages, if we've just loaded
|
||||
* this object header from the file
|
||||
*/
|
||||
if(udata.made_attempt) {
|
||||
/* Check for incorrect # of messages in v1 object header */
|
||||
if(oh->version == H5O_VERSION_1 &&
|
||||
(oh->nmesgs + udata.common.merged_null_msgs) != udata.v1_pfx_nmesgs) {
|
||||
/* Don't enforce the error on an incorrect # of object header messages bug
|
||||
* unless strict format checking is enabled. This allows for older
|
||||
* files, created with a version of the library that had a bug in tracking
|
||||
* the correct # of header messages to be read in without the library
|
||||
* erroring out here. -QAK
|
||||
*/
|
||||
#ifdef H5_STRICT_FORMAT_CHECKS
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header - incorrect # of messages")
|
||||
#else /* H5_STRICT_FORMAT_CHECKS */
|
||||
/* Mark object header prefix dirty later if we don't have write access */
|
||||
/* (object header will have been marked dirty during protect, if we
|
||||
* have write access -QAK)
|
||||
*/
|
||||
if(prot != H5AC_WRITE)
|
||||
oh->prefix_modified = TRUE;
|
||||
#ifndef NDEBUG
|
||||
else {
|
||||
unsigned oh_status = 0; /* Object header entry cache status */
|
||||
|
||||
/* Check the object header's status in the metadata cache */
|
||||
if(H5AC_get_entry_status(loc->file, loc->addr, &oh_status) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to check metadata cache status for object header")
|
||||
|
||||
/* Make certain that object header is not dirty */
|
||||
HDassert(!(oh_status & H5AC_ES__IS_DIRTY));
|
||||
} /* end else */
|
||||
#endif /* NDEBUG */
|
||||
#endif /* H5_STRICT_FORMAT_CHECKS */
|
||||
} /* end if */
|
||||
|
||||
/* Check for any messages that were modified while being read in */
|
||||
if(udata.common.mesgs_modified && prot != H5AC_WRITE)
|
||||
oh->mesgs_modified = TRUE;
|
||||
} /* end if */
|
||||
|
||||
/* Take care of loose ends for modifications made while bringing in the
|
||||
* object header & chunks.
|
||||
*/
|
||||
if(prot == H5AC_WRITE) {
|
||||
/* Check for the object header prefix being modified somehow */
|
||||
/* (usually through updating the # of object header messages) */
|
||||
if(oh->prefix_modified) {
|
||||
/* Mark the header as dirty now */
|
||||
if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, NULL, "unable to mark object header as dirty")
|
||||
|
||||
/* Reset flag */
|
||||
oh->prefix_modified = FALSE;
|
||||
} /* end if */
|
||||
|
||||
/* Check for deferred dirty messages */
|
||||
if(oh->mesgs_modified) {
|
||||
unsigned u; /* Local index variable */
|
||||
|
||||
/* Loop through all messages, marking their chunks as dirty */
|
||||
/* (slightly inefficient, since we don't know exactly which messages
|
||||
* were modified when the object header & chunks were brought in
|
||||
* from the file, but this only can happen once per load -QAK)
|
||||
*/
|
||||
for(u = 0; u < oh->nmesgs; u++) {
|
||||
/* Mark each chunk with a dirty message as dirty also */
|
||||
if(oh->mesg[u].dirty) {
|
||||
H5O_chunk_proxy_t *chk_proxy; /* Chunk that message is in */
|
||||
|
||||
/* Protect chunk */
|
||||
if(NULL == (chk_proxy = H5O_chunk_protect(loc->file, dxpl_id, oh, oh->mesg[u].chunkno)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
|
||||
|
||||
/* Unprotect chunk, marking it dirty */
|
||||
if(H5O_chunk_unprotect(loc->file, dxpl_id, oh, chk_proxy, H5AC__DIRTIED_FLAG) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to unprotect object header chunk")
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
|
||||
/* Reset flag */
|
||||
oh->mesgs_modified = FALSE;
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
|
||||
#ifdef H5O_DEBUG
|
||||
H5O_assert(oh);
|
||||
#endif /* H5O_DEBUG */
|
||||
|
||||
/* Set return value */
|
||||
ret_value = oh;
|
||||
|
||||
done:
|
||||
if(ret_value == NULL && oh) {
|
||||
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_protect() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_pin
|
||||
@ -1612,13 +1830,13 @@ done:
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Dec 31 2002
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 13 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5O_t *
|
||||
H5O_pin(H5O_loc_t *loc, hid_t dxpl_id)
|
||||
H5O_pin(const H5O_loc_t *loc, hid_t dxpl_id)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Object header */
|
||||
H5O_t *ret_value; /* Return value */
|
||||
@ -1627,33 +1845,22 @@ H5O_pin(H5O_loc_t *loc, hid_t dxpl_id)
|
||||
|
||||
/* check args */
|
||||
HDassert(loc);
|
||||
HDassert(loc->file);
|
||||
HDassert(H5F_addr_defined(loc->addr));
|
||||
|
||||
/* Check for write access on the file */
|
||||
if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
|
||||
/* Get header */
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header")
|
||||
|
||||
/* Lock the object header into the cache */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
|
||||
|
||||
/* Check if the object header needs to be pinned */
|
||||
if(0 == oh->npins) {
|
||||
/* Mark object header as un-evictable */
|
||||
if(H5AC_pin_protected_entry(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header")
|
||||
} /* end if */
|
||||
|
||||
/* Increment the pin count */
|
||||
oh->npins++;
|
||||
/* Increment the reference count on the object header */
|
||||
/* (which will pin it, if appropriate) */
|
||||
if(H5O_inc_rc(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "unable to increment reference count on object header")
|
||||
|
||||
/* Set the return value */
|
||||
ret_value = oh;
|
||||
|
||||
done:
|
||||
/* Release the object header from the cache */
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, ret_value, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -1670,8 +1877,8 @@ done:
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Dec 31 2002
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 13 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1685,20 +1892,51 @@ H5O_unpin(H5O_t *oh)
|
||||
/* check args */
|
||||
HDassert(oh);
|
||||
|
||||
/* Check if this is the last unpin operation */
|
||||
if(1 == oh->npins) {
|
||||
/* Mark object header as evictable again */
|
||||
if(H5AC_unpin_entry(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
} /* end if */
|
||||
|
||||
/* Decrement the pin count */
|
||||
oh->npins--;
|
||||
/* Decrement the reference count on the object header */
|
||||
/* (which will unpin it, if appropriate) */
|
||||
if(H5O_dec_rc(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_unpin() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_unprotect
|
||||
*
|
||||
* Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect->
|
||||
* H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
|
||||
* during an object's creation.
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Dec 31 2002
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_unprotect(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, unsigned oh_flags)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_unprotect, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(loc);
|
||||
HDassert(oh);
|
||||
|
||||
/* Unprotect the object header */
|
||||
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, oh->chunk[0].addr, oh, oh_flags) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_unprotect() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_touch_oh
|
||||
@ -1717,6 +1955,8 @@ done:
|
||||
herr_t
|
||||
H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
|
||||
{
|
||||
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
|
||||
unsigned chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting chunk */
|
||||
time_t now; /* Current time */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
@ -1755,6 +1995,10 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
|
||||
oh->mesg[idx].flags = (uint8_t)mesg_flags;
|
||||
} /* end if */
|
||||
|
||||
/* Protect chunk */
|
||||
if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, oh->mesg[idx].chunkno)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
|
||||
|
||||
/* Allocate 'native' space, if necessary */
|
||||
if(NULL == oh->mesg[idx].native) {
|
||||
if(NULL == (oh->mesg[idx].native = H5FL_MALLOC(time_t)))
|
||||
@ -1766,19 +2010,24 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force)
|
||||
|
||||
/* Mark the message as dirty */
|
||||
oh->mesg[idx].dirty = TRUE;
|
||||
chk_flags |= H5AC__DIRTIED_FLAG;
|
||||
} /* end if */
|
||||
else {
|
||||
/* XXX: For now, update access time & change fields in the object header */
|
||||
/* (will need to add some code to update modification time appropriately) */
|
||||
oh->atime = oh->ctime = now;
|
||||
} /* end else */
|
||||
|
||||
/* Mark object header as dirty in cache */
|
||||
if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
|
||||
/* Mark object header as dirty in cache */
|
||||
if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
/* Release chunk */
|
||||
if(chk_proxy && H5O_chunk_unprotect(f, dxpl_id, oh, chk_proxy, chk_flags) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_touch_oh() */
|
||||
|
||||
@ -1809,13 +2058,9 @@ H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
|
||||
|
||||
/* check args */
|
||||
HDassert(loc);
|
||||
HDassert(loc->file);
|
||||
HDassert(H5F_addr_defined(loc->addr));
|
||||
if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Create/Update the modification time message */
|
||||
@ -1826,7 +2071,7 @@ H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
|
||||
oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -1915,6 +2160,8 @@ herr_t
|
||||
H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Object header information */
|
||||
H5O_loc_t loc; /* Object location for object to delete */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_delete, FAIL)
|
||||
@ -1923,16 +2170,24 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
|
||||
HDassert(f);
|
||||
HDassert(H5F_addr_defined(addr));
|
||||
|
||||
/* Set up the object location */
|
||||
loc.file = f;
|
||||
loc.addr = addr;
|
||||
loc.holding_file = FALSE;
|
||||
|
||||
/* Get the object header information */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE)))
|
||||
if(NULL == (oh = H5O_protect(&loc, dxpl_id, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Delete object */
|
||||
if(H5O_delete_oh(f, dxpl_id, oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file")
|
||||
|
||||
/* Mark object header as deleted */
|
||||
oh_flags = H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0)
|
||||
if(oh && H5O_unprotect(&loc, dxpl_id, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2005,7 +2260,7 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id)
|
||||
FUNC_ENTER_NOAPI(H5O_obj_type, FAIL)
|
||||
|
||||
/* Load the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Retrieve the type of the object */
|
||||
@ -2013,7 +2268,7 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2083,7 +2338,7 @@ H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id)
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_obj_class)
|
||||
|
||||
/* Load the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
|
||||
|
||||
/* Test whether entry qualifies as a particular type of object */
|
||||
@ -2091,7 +2346,7 @@ H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2354,7 +2609,7 @@ done:
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
|
||||
H5O_get_hdr_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Object header */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
@ -2362,14 +2617,14 @@ H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
|
||||
FUNC_ENTER_NOAPI(H5O_get_hdr_info, FAIL)
|
||||
|
||||
/* Check args */
|
||||
HDassert(oloc);
|
||||
HDassert(loc);
|
||||
HDassert(hdr);
|
||||
|
||||
/* Reset the object header info structure */
|
||||
HDmemset(hdr, 0, sizeof(*hdr));
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
|
||||
|
||||
/* Get the information for the object header */
|
||||
@ -2377,7 +2632,7 @@ H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2493,7 +2748,7 @@ H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info,
|
||||
HDassert(oinfo);
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Reset the object info structure */
|
||||
@ -2581,7 +2836,7 @@ H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info,
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2614,7 +2869,7 @@ H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, H5P_genplist_t *oc_pli
|
||||
HDassert(oc_plist);
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Set property values, if they were used for the object */
|
||||
@ -2636,7 +2891,7 @@ H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, H5P_genplist_t *oc_pli
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2669,14 +2924,14 @@ H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks)
|
||||
HDassert(nlinks);
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Retrieve the # of link messages seen when the object header was loaded */
|
||||
*nlinks = oh->link_msgs_seen;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2784,22 +3039,22 @@ H5O_get_rc_and_type(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc, H5O_type_
|
||||
|
||||
/* Check args */
|
||||
HDassert(loc);
|
||||
HDassert(rc);
|
||||
HDassert(otype);
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Set the object's reference count */
|
||||
*rc = oh->nlink;
|
||||
if(rc)
|
||||
*rc = oh->nlink;
|
||||
|
||||
/* Retrieve the type of the object */
|
||||
if(H5O_obj_type_real(oh, otype) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
|
||||
if(otype)
|
||||
if(H5O_obj_type_real(oh, otype) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -2823,7 +3078,7 @@ H5O_free_visit_visited(void *item, void UNUSED *key, void UNUSED *operator_data/
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_free_visit_visited)
|
||||
|
||||
(void)H5FL_FREE(H5_obj_t, item);
|
||||
item = H5FL_FREE(H5_obj_t, item);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O_free_visit_visited() */
|
||||
@ -3060,6 +3315,78 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_visit() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_inc_rc
|
||||
*
|
||||
* Purpose: Increments the reference count on an object header
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 13 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_inc_rc(H5O_t *oh)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_inc_rc, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(oh);
|
||||
|
||||
/* Pin the object header when the reference count goes above 0 */
|
||||
if(oh->rc == 0)
|
||||
if(H5AC_pin_protected_entry(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Increment reference count */
|
||||
oh->rc++;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_inc_rc() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_dec_rc
|
||||
*
|
||||
* Purpose: Decrements the reference count on an object header
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 13 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_dec_rc(H5O_t *oh)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_dec_rc, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(oh);
|
||||
|
||||
/* Decrement reference count */
|
||||
oh->rc--;
|
||||
|
||||
/* Unpin the object header when the reference count goes back to 0 */
|
||||
if(oh->rc == 0)
|
||||
if(H5AC_unpin_entry(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_dec_rc() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_free
|
||||
@ -3086,12 +3413,8 @@ H5O_free(H5O_t *oh)
|
||||
|
||||
/* Destroy chunks */
|
||||
if(oh->chunk) {
|
||||
for(u = 0; u < oh->nchunks; u++) {
|
||||
/* Verify that chunk is clean */
|
||||
HDassert(oh->chunk[u].dirty == 0);
|
||||
|
||||
for(u = 0; u < oh->nchunks; u++)
|
||||
oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
|
||||
} /* end for */
|
||||
|
||||
oh->chunk = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_chunk_t, oh->chunk);
|
||||
} /* end if */
|
||||
|
633
src/H5Oalloc.c
633
src/H5Oalloc.c
File diff suppressed because it is too large
Load Diff
@ -223,7 +223,6 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Pointer to actual object header */
|
||||
H5O_ainfo_t ainfo; /* Attribute information for object */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */
|
||||
htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
@ -233,9 +232,9 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
|
||||
HDassert(loc);
|
||||
HDassert(attr);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Check if this object already has attribute information */
|
||||
if(oh->version > H5O_VERSION_1) {
|
||||
@ -396,12 +395,9 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
|
||||
if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
|
||||
|
||||
/* Indicate that the object header was modified */
|
||||
oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_attr_create() */
|
||||
@ -487,7 +483,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
|
||||
HDassert(name);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
@ -544,7 +540,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -628,7 +624,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, NULL, "can't locate attribute")
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header")
|
||||
|
||||
/* Find out whether it has already been opened. If it has, close the object
|
||||
@ -654,7 +650,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -836,6 +832,8 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
|
||||
unsigned UNUSED sequence, hbool_t *oh_modified, void *_udata/*in,out*/)
|
||||
{
|
||||
H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */
|
||||
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
|
||||
unsigned chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting chunk */
|
||||
herr_t ret_value = H5_ITER_CONT; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_write_cb)
|
||||
@ -847,14 +845,35 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
|
||||
|
||||
/* Check for correct attribute message to modify */
|
||||
if(0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) {
|
||||
/* Protect chunk */
|
||||
if(NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk")
|
||||
|
||||
/* Allocate storage for the message's data, if necessary */
|
||||
if(NULL == ((H5A_t *)mesg->native)->shared->data)
|
||||
if(NULL == (((H5A_t *)mesg->native)->shared->data = H5FL_BLK_MALLOC(attr_buf, udata->attr->shared->data_size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed")
|
||||
|
||||
/* Copy the data into the header message */
|
||||
/* (Needs to occur before updating the shared message, or the hash
|
||||
* value on the old & new messages will be the same)
|
||||
*/
|
||||
HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size);
|
||||
|
||||
/* Mark the message as modified */
|
||||
mesg->dirty = TRUE;
|
||||
chk_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
/* Release chunk */
|
||||
if(H5O_chunk_unprotect(udata->f, udata->dxpl_id, oh, chk_proxy, chk_flags) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
|
||||
chk_proxy = NULL;
|
||||
|
||||
/* Update the shared attribute in the SOHM storage */
|
||||
if(mesg->flags & H5O_MSG_FLAG_SHARED)
|
||||
if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, udata->attr, (H5O_shared_t *)mesg->native) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, "unable to update attribute in shared storage")
|
||||
|
||||
/* Mark message as dirty */
|
||||
mesg->dirty = TRUE;
|
||||
|
||||
/* Indicate that the object header was modified */
|
||||
*oh_modified = TRUE;
|
||||
|
||||
@ -866,6 +885,10 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
/* Release chunk, if not already done */
|
||||
if(chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, oh, chk_proxy, chk_flags) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_attr_write_cb() */
|
||||
|
||||
@ -887,7 +910,6 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Pointer to actual object header */
|
||||
H5O_ainfo_t ainfo; /* Attribute information for object */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_write)
|
||||
@ -896,9 +918,9 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
|
||||
HDassert(loc);
|
||||
HDassert(attr);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
ainfo.fheap_addr = HADDR_UNDEF;
|
||||
@ -939,12 +961,9 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr)
|
||||
if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
|
||||
|
||||
/* Indicate that the object header was modified */
|
||||
oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_attr_write */
|
||||
@ -1015,6 +1034,8 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
|
||||
unsigned UNUSED sequence, hbool_t *oh_modified, void *_udata/*in,out*/)
|
||||
{
|
||||
H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */
|
||||
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
|
||||
unsigned chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting chunk */
|
||||
herr_t ret_value = H5_ITER_CONT; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_rename_mod_cb)
|
||||
@ -1028,6 +1049,10 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
|
||||
if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) {
|
||||
unsigned old_version = ((H5A_t *)mesg->native)->shared->version; /* Old version of the attribute */
|
||||
|
||||
/* Protect chunk */
|
||||
if(NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk")
|
||||
|
||||
/* Change the name for the attribute */
|
||||
H5MM_xfree(((H5A_t *)mesg->native)->shared->name);
|
||||
((H5A_t *)mesg->native)->shared->name = H5MM_xstrdup(udata->new_name);
|
||||
@ -1038,6 +1063,12 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
|
||||
|
||||
/* Mark the message as modified */
|
||||
mesg->dirty = TRUE;
|
||||
chk_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
/* Release chunk */
|
||||
if(H5O_chunk_unprotect(udata->f, udata->dxpl_id, oh, chk_proxy, chk_flags) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
|
||||
chk_proxy = NULL;
|
||||
|
||||
/* Check for shared message */
|
||||
if(mesg->flags & H5O_MSG_FLAG_SHARED) {
|
||||
@ -1098,6 +1129,10 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
/* Release chunk, if not already done */
|
||||
if(chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, oh, chk_proxy, chk_flags) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_attr_rename_mod_cb() */
|
||||
|
||||
@ -1120,7 +1155,6 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
|
||||
{
|
||||
H5O_t *oh = NULL; /* Pointer to actual object header */
|
||||
H5O_ainfo_t ainfo; /* Attribute information for object */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_rename)
|
||||
@ -1130,9 +1164,9 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
|
||||
HDassert(old_name);
|
||||
HDassert(new_name);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
ainfo.fheap_addr = HADDR_UNDEF;
|
||||
@ -1184,12 +1218,9 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name,
|
||||
if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
|
||||
|
||||
/* Indicate that the object header was modified */
|
||||
oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_attr_rename */
|
||||
@ -1226,7 +1257,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
|
||||
HDassert(attr_op);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
@ -1244,7 +1275,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
|
||||
|
||||
/* Release the object header */
|
||||
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
oh = NULL;
|
||||
|
||||
@ -1258,7 +1289,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
|
||||
|
||||
/* Release the object header */
|
||||
if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
oh = NULL;
|
||||
|
||||
@ -1273,7 +1304,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id,
|
||||
|
||||
done:
|
||||
/* Release resources */
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(atable.attrs && H5A_attr_release_table(&atable) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
|
||||
@ -1511,7 +1542,6 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
|
||||
H5O_t *oh = NULL; /* Pointer to actual object header */
|
||||
H5O_ainfo_t ainfo; /* Attribute information for object */
|
||||
htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_remove)
|
||||
@ -1520,9 +1550,9 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
|
||||
HDassert(loc);
|
||||
HDassert(name);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
ainfo.fheap_addr = HADDR_UNDEF;
|
||||
@ -1568,12 +1598,9 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
|
||||
if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
|
||||
|
||||
/* Indicate that the object header was modified */
|
||||
oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_attr_remove() */
|
||||
@ -1599,7 +1626,6 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
|
||||
H5O_t *oh = NULL; /* Pointer to actual object header */
|
||||
H5O_ainfo_t ainfo; /* Attribute information for object */
|
||||
htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */
|
||||
H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
@ -1608,9 +1634,9 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
|
||||
/* Check arguments */
|
||||
HDassert(loc);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
ainfo.fheap_addr = HADDR_UNDEF;
|
||||
@ -1664,12 +1690,9 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type,
|
||||
if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
|
||||
|
||||
/* Indicate that the object header was modified */
|
||||
oh_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
if(atable.attrs && H5A_attr_release_table(&atable) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table")
|
||||
|
||||
@ -1797,7 +1820,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
|
||||
HDassert(name);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
@ -1835,7 +1858,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id)
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -1951,7 +1974,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id)
|
||||
HDassert(loc);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Retrieve # of attributes on object */
|
||||
@ -1962,7 +1985,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id)
|
||||
ret_value = (int)nattrs;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
1315
src/H5Ocache.c
1315
src/H5Ocache.c
File diff suppressed because it is too large
Load Diff
359
src/H5Ochunk.c
Normal file
359
src/H5Ochunk.c
Normal file
@ -0,0 +1,359 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Created: H5Ochunk.c
|
||||
* Jul 13 2008
|
||||
* Quincey Koziol <koziol@hdfgroup.org>
|
||||
*
|
||||
* Purpose: Object header chunk routines.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
||||
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
|
||||
/********************/
|
||||
/* Package Typedefs */
|
||||
/********************/
|
||||
|
||||
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
|
||||
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/* Declare the free list for H5O_chunk_proxy_t's */
|
||||
H5FL_DEFINE(H5O_chunk_proxy_t);
|
||||
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_chunk_add
|
||||
*
|
||||
* Purpose: Add new chunk for object header to metadata cache
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 13 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
|
||||
{
|
||||
H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for chunk, to mark it dirty in the cache */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_chunk_add, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
HDassert(idx < oh->nchunks);
|
||||
HDassert(idx > 0);
|
||||
|
||||
/* Allocate space for the object header data structure */
|
||||
if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||
|
||||
/* Set the values in the chunk proxy */
|
||||
chk_proxy->oh = oh;
|
||||
chk_proxy->chunkno = idx;
|
||||
|
||||
/* Insert the chunk proxy into the cache */
|
||||
if(H5AC_set(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk")
|
||||
chk_proxy = NULL;
|
||||
|
||||
/* Increment reference count on object header */
|
||||
if(H5O_inc_rc(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_chunk_add() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_chunk_protect
|
||||
*
|
||||
* Purpose: Protect an object header chunk for modifications
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 17 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
H5O_chunk_proxy_t *
|
||||
H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
|
||||
{
|
||||
H5O_chunk_proxy_t *chk_proxy; /* Proxy for protected chunk */
|
||||
H5O_chunk_proxy_t *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_chunk_protect, NULL)
|
||||
|
||||
/* check args */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
HDassert(idx < oh->nchunks);
|
||||
|
||||
/* Check for protecting first chunk */
|
||||
if(0 == idx) {
|
||||
/* Create new "fake" chunk proxy for first chunk */
|
||||
/* (since the first chunk is already handled by the H5O_t object) */
|
||||
if(NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed")
|
||||
|
||||
/* Set chunk proxy fields */
|
||||
chk_proxy->oh = oh;
|
||||
chk_proxy->chunkno = idx;
|
||||
} /* end if */
|
||||
else {
|
||||
H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */
|
||||
|
||||
/* Construct the user data for protecting chunk proxy */
|
||||
/* (and _not_ decoding it) */
|
||||
HDmemset(&chk_udata, 0, sizeof(chk_udata));
|
||||
chk_udata.oh = oh;
|
||||
chk_udata.chunkno = idx;
|
||||
chk_udata.chunk_size = oh->chunk[idx].size;
|
||||
|
||||
/* Get the chunk proxy */
|
||||
if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, NULL, &chk_udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk")
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(chk_proxy->oh == oh);
|
||||
HDassert(chk_proxy->chunkno == idx);
|
||||
} /* end else */
|
||||
|
||||
/* Set return value */
|
||||
ret_value = chk_proxy;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_chunk_protect() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_chunk_unprotect
|
||||
*
|
||||
* Purpose: Unprotect an object header chunk after modifications
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 17 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_proxy,
|
||||
unsigned chk_flags)
|
||||
{
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_chunk_unprotect, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
HDassert(chk_proxy);
|
||||
HDassert(!(chk_flags & (unsigned)~(H5AC__DIRTIED_FLAG | H5AC__SIZE_CHANGED_FLAG)));
|
||||
|
||||
/* Check for releasing first chunk */
|
||||
if(0 == chk_proxy->chunkno) {
|
||||
/* Check for resizing the first chunk */
|
||||
if(chk_flags & H5AC__SIZE_CHANGED_FLAG) {
|
||||
/* Resize object header in cache */
|
||||
if(H5AC_resize_pinned_entry(oh, oh->chunk[0].size) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache")
|
||||
} /* end if */
|
||||
/* Check for dirtying the first chunk */
|
||||
else if(chk_flags & H5AC__DIRTIED_FLAG) {
|
||||
/* Mark object header as dirty in cache */
|
||||
if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
|
||||
} /* end else/if */
|
||||
else {
|
||||
/* Sanity check */
|
||||
HDassert(0 && "Unknown chunk proxy flag(s)?!?");
|
||||
} /* end else */
|
||||
|
||||
/* Free fake chunk proxy */
|
||||
chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy);
|
||||
} /* end if */
|
||||
else {
|
||||
/* Release the chunk proxy from the cache, marking it dirty */
|
||||
if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[chk_proxy->chunkno].addr, chk_proxy, chk_flags) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_chunk_unprotect() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_chunk_update_idx
|
||||
*
|
||||
* Purpose: Update the chunk index for a chunk proxy
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 13 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_chunk_update_idx(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
|
||||
{
|
||||
H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to mark it dirty in the cache */
|
||||
H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_chunk_update_idx, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
HDassert(idx < oh->nchunks);
|
||||
HDassert(idx > 0);
|
||||
|
||||
/* Construct the user data for protecting chunk proxy */
|
||||
/* (and _not_ decoding it) */
|
||||
HDmemset(&chk_udata, 0, sizeof(chk_udata));
|
||||
chk_udata.oh = oh;
|
||||
chk_udata.chunkno = idx;
|
||||
chk_udata.chunk_size = oh->chunk[idx].size;
|
||||
|
||||
/* Get the chunk proxy */
|
||||
if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, NULL, &chk_udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
|
||||
|
||||
/* Update index for chunk proxy in cache */
|
||||
chk_proxy->chunkno = idx;
|
||||
|
||||
/* Release the chunk proxy from the cache, marking it deleted */
|
||||
if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__DIRTIED_FLAG) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_chunk_update_idx() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_chunk_delete
|
||||
*
|
||||
* Purpose: Notify metadata cache that a chunk has been deleted
|
||||
*
|
||||
* Return: Success: Non-negative
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@hdfgroup.org
|
||||
* Jul 13 2008
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx)
|
||||
{
|
||||
H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to mark it dirty in the cache */
|
||||
H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_chunk_delete, FAIL)
|
||||
|
||||
/* check args */
|
||||
HDassert(f);
|
||||
HDassert(oh);
|
||||
HDassert(idx < oh->nchunks);
|
||||
HDassert(idx > 0);
|
||||
|
||||
/* Construct the user data for protecting chunk proxy */
|
||||
/* (and _not_ decoding it) */
|
||||
HDmemset(&chk_udata, 0, sizeof(chk_udata));
|
||||
chk_udata.oh = oh;
|
||||
chk_udata.chunkno = idx;
|
||||
chk_udata.chunk_size = oh->chunk[idx].size;
|
||||
|
||||
/* Get the chunk proxy */
|
||||
if(NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, NULL, &chk_udata, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(chk_proxy->oh == oh);
|
||||
HDassert(chk_proxy->chunkno == idx);
|
||||
|
||||
/* Release the chunk proxy from the cache, marking it deleted */
|
||||
if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, (H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG)) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_chunk_delete() */
|
||||
|
@ -224,7 +224,7 @@ H5O_cont_free(void *mesg)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_cont_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *_mesg)
|
||||
H5O_cont_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
|
||||
{
|
||||
H5O_cont_t *mesg = (H5O_cont_t *) _mesg;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
@ -235,9 +235,10 @@ H5O_cont_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *_mesg)
|
||||
HDassert(f);
|
||||
HDassert(mesg);
|
||||
|
||||
/* Release space for chunk */
|
||||
if(H5MF_xfree(f, H5FD_MEM_OHDR, dxpl_id, mesg->addr, (hsize_t)mesg->size) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header chunk")
|
||||
/* Notify the cache that the chunk has been deleted */
|
||||
/* (releases the space for the chunk) */
|
||||
if(H5O_chunk_delete(f, dxpl_id, open_oh, mesg->chunkno) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove chunk from cache")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
@ -316,7 +316,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
|
||||
HDassert(cpy_info);
|
||||
|
||||
/* Get source object header */
|
||||
if(NULL == (oh_src = (H5O_t *)H5AC_protect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh_src = H5O_protect(oloc_src, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Get pointer to object class for this object */
|
||||
@ -579,7 +579,6 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||
|
||||
/* Set dest. chunk information */
|
||||
oh_dst->chunk[0].dirty = TRUE;
|
||||
oh_dst->chunk[0].size = (size_t)dst_oh_size;
|
||||
oh_dst->chunk[0].gap = dst_oh_gap;
|
||||
|
||||
@ -739,7 +738,7 @@ done:
|
||||
HDfree(deleted);
|
||||
|
||||
/* Release pointer to source object header and its derived objects */
|
||||
if(oh_src && H5AC_unprotect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, oh_src, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh_src && H5O_unprotect(oloc_src, dxpl_id, oh_src, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
/* Release pointer to destination object header */
|
||||
|
14
src/H5Odbg.c
14
src/H5Odbg.c
@ -377,10 +377,6 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
|
||||
|
||||
HDfprintf(stream, "%*sChunk %d...\n", indent, "", i);
|
||||
|
||||
HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||
"Dirty:",
|
||||
oh->chunk[i].dirty);
|
||||
|
||||
HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||
"Address:",
|
||||
oh->chunk[i].addr);
|
||||
@ -538,6 +534,7 @@ herr_t
|
||||
H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Object header to display */
|
||||
H5O_loc_t loc; /* Object location for object to delete */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_debug, FAIL)
|
||||
@ -549,14 +546,19 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
|
||||
HDassert(indent >= 0);
|
||||
HDassert(fwidth >= 0);
|
||||
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_READ)))
|
||||
/* Set up the object location */
|
||||
loc.file = f;
|
||||
loc.addr = addr;
|
||||
loc.holding_file = FALSE;
|
||||
|
||||
if(NULL == (oh = H5O_protect(&loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* debug */
|
||||
H5O_debug_real(f, dxpl_id, oh, addr, stream, indent, fwidth);
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(&loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
@ -127,21 +127,17 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
|
||||
HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
|
||||
HDassert(mesg);
|
||||
|
||||
/* Check for write access on the file */
|
||||
if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
|
||||
|
||||
/* Protect the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Go append message to object header */
|
||||
if(H5O_msg_append_oh(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_msg_create() */
|
||||
@ -280,21 +276,17 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
|
||||
HDassert(mesg);
|
||||
HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
|
||||
|
||||
/* Check for write access on the file */
|
||||
if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
|
||||
|
||||
/* Protect the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Call the "real" modify routine */
|
||||
if(H5O_msg_write_real(loc->file, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_msg_write() */
|
||||
@ -484,7 +476,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg,
|
||||
HDassert(type_id < NELMTS(H5O_msg_class_g));
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header")
|
||||
|
||||
/* Call the "real" read routine */
|
||||
@ -492,7 +484,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg,
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to load object header")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -809,14 +801,14 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
|
||||
HDassert(type);
|
||||
|
||||
/* Load the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Count the messages of the correct type */
|
||||
ret_value = H5O_msg_count_real(oh, type);
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -890,7 +882,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
|
||||
HDassert(type_id < NELMTS(H5O_msg_class_g));
|
||||
|
||||
/* Load the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Call the "real" exists routine */
|
||||
@ -898,7 +890,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to verify object header message")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -986,17 +978,17 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj
|
||||
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
|
||||
HDassert(type);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Call the "real" remove routine */
|
||||
if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link, dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_msg_remove() */
|
||||
@ -1038,17 +1030,17 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
|
||||
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
|
||||
HDassert(type);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
/* Pin the object header */
|
||||
if(NULL == (oh = H5O_pin(loc, dxpl_id)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header")
|
||||
|
||||
/* Call the "real" remove routine */
|
||||
if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link, dxpl_id)) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(oh && H5O_unpin(oh) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_msg_remove_op() */
|
||||
@ -1230,7 +1222,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id,
|
||||
HDassert(op);
|
||||
|
||||
/* Protect the object header to iterate over */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Call the "real" iterate routine */
|
||||
@ -1238,7 +1230,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id,
|
||||
HERROR(H5E_OHDR, H5E_BADITER, "unable to iterate over object header messages");
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -1962,7 +1954,9 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
|
||||
const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags,
|
||||
unsigned update_flags)
|
||||
{
|
||||
H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */
|
||||
H5O_mesg_t *idx_msg = &oh->mesg[idx]; /* Pointer to message to modify */
|
||||
unsigned chk_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting chunk */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_copy_mesg)
|
||||
@ -1974,6 +1968,10 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
|
||||
HDassert(type->copy);
|
||||
HDassert(mesg);
|
||||
|
||||
/* Protect chunk */
|
||||
if(NULL == (chk_proxy = H5O_chunk_protect(f, dxpl_id, oh, idx_msg->chunkno)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
|
||||
|
||||
/* Reset existing native information for the header's message */
|
||||
H5O_msg_reset_real(type, idx_msg->native);
|
||||
|
||||
@ -1986,17 +1984,23 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
|
||||
|
||||
/* Mark the message as modified */
|
||||
idx_msg->dirty = TRUE;
|
||||
chk_flags |= H5AC__DIRTIED_FLAG;
|
||||
|
||||
/* Release chunk */
|
||||
if(H5O_chunk_unprotect(f, dxpl_id, oh, chk_proxy, chk_flags) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
|
||||
chk_proxy = NULL;
|
||||
|
||||
/* Update the modification time, if requested */
|
||||
if(update_flags & H5O_UPDATE_TIME)
|
||||
if(H5O_touch_oh(f, dxpl_id, oh, FALSE) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object")
|
||||
|
||||
/* Mark object header as dirty in cache */
|
||||
if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty")
|
||||
|
||||
done:
|
||||
/* Release chunk, if not already released */
|
||||
if(chk_proxy && H5O_chunk_unprotect(f, dxpl_id, oh, chk_proxy, chk_flags) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_copy_mesg() */
|
||||
|
||||
@ -2183,9 +2187,8 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
|
||||
} /* end if */
|
||||
|
||||
/* Pass "modifiedness" from message to chunk */
|
||||
/* Mark the message as clean now */
|
||||
mesg->dirty = FALSE;
|
||||
oh->chunk[mesg->chunkno].dirty = TRUE;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
|
70
src/H5Opkg.h
70
src/H5Opkg.h
@ -253,7 +253,6 @@ struct H5O_mesg_t {
|
||||
};
|
||||
|
||||
typedef struct H5O_chunk_t {
|
||||
hbool_t dirty; /*dirty flag */
|
||||
haddr_t addr; /*chunk file address */
|
||||
size_t size; /*chunk size */
|
||||
size_t gap; /*space at end of chunk too small for null message */
|
||||
@ -268,9 +267,6 @@ struct H5O_t {
|
||||
size_t sizeof_size; /* Size of file sizes */
|
||||
size_t sizeof_addr; /* Size of file addresses */
|
||||
|
||||
/* Misc. information (not stored) */
|
||||
unsigned npins; /* Number of times the header is pinned */
|
||||
|
||||
/* Debugging information (not stored) */
|
||||
#ifdef H5O_ENABLE_BAD_MESG_COUNT
|
||||
hbool_t store_bad_mesg_count; /* Flag to indicate that a bad message count should be stored */
|
||||
@ -282,6 +278,12 @@ struct H5O_t {
|
||||
size_t ndecode_dirtied; /* Number of messages dirtied by decoding */
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/* Chunk management information (not stored) */
|
||||
size_t rc; /* Reference count of [continuation] chunks using this structure */
|
||||
size_t chunk0_size; /* Size of serialized first chunk */
|
||||
hbool_t mesgs_modified; /* Whether any messages were modified when the object header was deserialized */
|
||||
hbool_t prefix_modified; /* Whether prefix was modified when the object header was deserialized */
|
||||
|
||||
/* Object information (stored) */
|
||||
hbool_t has_refcount_msg; /* Whether the object has a ref. count message */
|
||||
unsigned nlink; /*link count */
|
||||
@ -332,10 +334,55 @@ typedef struct H5O_addr_map_t {
|
||||
hsize_t inc_ref_count; /* Number of deferred increments to reference count */
|
||||
} H5O_addr_map_t;
|
||||
|
||||
/* Stack of continuation messages to interpret */
|
||||
typedef struct H5O_cont_msgs_t {
|
||||
size_t nmsgs; /* Number of continuation messages found so far */
|
||||
size_t alloc_nmsgs; /* Continuation messages allocated */
|
||||
H5O_cont_t *msgs; /* Array of continuation messages */
|
||||
} H5O_cont_msgs_t;
|
||||
|
||||
/* H5O inherits cache-like properties from H5AC */
|
||||
/* Common callback information for loading object header prefix from disk */
|
||||
typedef struct H5O_common_cache_ud_t {
|
||||
H5F_t *f; /* Pointer to file for object header/chunk */
|
||||
hid_t dxpl_id; /* DXPL for operation */
|
||||
unsigned file_intent; /* Read/write intent for file */
|
||||
unsigned merged_null_msgs; /* Number of null messages merged together */
|
||||
hbool_t mesgs_modified; /* Whether any messages were modified when the object header was deserialized */
|
||||
H5O_cont_msgs_t *cont_msg_info; /* Pointer to continuation messages to work on */
|
||||
} H5O_common_cache_ud_t;
|
||||
|
||||
/* Callback information for loading object header prefix from disk */
|
||||
typedef struct H5O_cache_ud_t {
|
||||
hbool_t made_attempt; /* Whether the deserialize routine was already attempted */
|
||||
unsigned v1_pfx_nmesgs; /* Number of messages from v1 prefix header */
|
||||
H5O_common_cache_ud_t common; /* Common object header cache callback info */
|
||||
} H5O_cache_ud_t;
|
||||
|
||||
/* Structure representing each chunk in the cache */
|
||||
typedef struct H5O_chunk_proxy_t {
|
||||
H5AC_info_t cache_info; /* Information for metadata cache functions, _must_ be */
|
||||
/* first field in structure */
|
||||
|
||||
H5O_t *oh; /* Object header for this chunk */
|
||||
unsigned chunkno; /* Chunk number for this chunk */
|
||||
} H5O_chunk_proxy_t;
|
||||
|
||||
/* Callback information for loading object header chunk from disk */
|
||||
typedef struct H5O_chk_cache_ud_t {
|
||||
hbool_t decoding; /* Whether the object header is being decoded */
|
||||
H5O_t *oh; /* Object header for this chunk */
|
||||
unsigned chunkno; /* Index of chunk being brought in (for re-loads) */
|
||||
size_t chunk_size; /* Chunk size */
|
||||
H5O_common_cache_ud_t common; /* Common object header cache callback info */
|
||||
} H5O_chk_cache_ud_t;
|
||||
|
||||
|
||||
/* H5O object header inherits cache-like properties from H5AC */
|
||||
H5_DLLVAR const H5AC_class_t H5AC_OHDR[1];
|
||||
|
||||
/* H5O object header chunk inherits cache-like properties from H5AC */
|
||||
H5_DLLVAR const H5AC_class_t H5AC_OHDR_CHK[1];
|
||||
|
||||
/* Header message ID to class mapping */
|
||||
H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES];
|
||||
|
||||
@ -476,6 +523,9 @@ H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
|
||||
H5_DLL hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref);
|
||||
H5_DLL herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_mesg_t *mesg);
|
||||
H5_DLL const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh);
|
||||
H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted);
|
||||
H5_DLL herr_t H5O_inc_rc(H5O_t *oh);
|
||||
H5_DLL herr_t H5O_dec_rc(H5O_t *oh);
|
||||
H5_DLL herr_t H5O_free(H5O_t *oh);
|
||||
|
||||
/* Object header message routines */
|
||||
@ -498,6 +548,15 @@ H5_DLL void *H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src,
|
||||
H5_DLL herr_t H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
|
||||
const H5O_mesg_operator_t *op, void *op_data, hid_t dxpl_id);
|
||||
|
||||
/* Object header chunk routines */
|
||||
H5_DLL herr_t H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx);
|
||||
H5_DLL H5O_chunk_proxy_t *H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
|
||||
unsigned idx);
|
||||
H5_DLL herr_t H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
|
||||
H5O_chunk_proxy_t *chk_proxy, unsigned chk_flags);
|
||||
H5_DLL herr_t H5O_chunk_update_idx(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx);
|
||||
H5_DLL herr_t H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx);
|
||||
|
||||
/* Collect storage info for btree and heap */
|
||||
H5_DLL herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
|
||||
H5_ih_info_t *bh_info);
|
||||
@ -544,6 +603,7 @@ H5_DLL htri_t H5O_is_attr_dense_test(hid_t oid);
|
||||
H5_DLL herr_t H5O_num_attrs_test(hid_t oid, hsize_t *nattrs);
|
||||
H5_DLL herr_t H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count);
|
||||
H5_DLL herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val);
|
||||
H5_DLL herr_t H5O_expunge_chunks_test(const H5O_loc_t *oloc, hid_t dxpl_id);
|
||||
#endif /* H5O_TESTING */
|
||||
|
||||
/* Object header debugging routines */
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "H5Spublic.h" /* Dataspace functions */
|
||||
|
||||
/* Private headers needed by this file */
|
||||
#include "H5ACprivate.h" /* Metadata cache */
|
||||
#include "H5Fprivate.h" /* File access */
|
||||
#include "H5SLprivate.h" /* Skip lists */
|
||||
#include "H5Tprivate.h" /* Datatype functions */
|
||||
@ -623,9 +624,11 @@ H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint,
|
||||
H5_DLL herr_t H5O_open(H5O_loc_t *loc);
|
||||
H5_DLL herr_t H5O_close(H5O_loc_t *loc);
|
||||
H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id);
|
||||
H5_DLL int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags);
|
||||
H5_DLL H5O_t *H5O_pin(H5O_loc_t *loc, hid_t dxpl_id);
|
||||
H5_DLL H5O_t *H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot);
|
||||
H5_DLL H5O_t *H5O_pin(const H5O_loc_t *loc, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_unpin(H5O_t *oh);
|
||||
H5_DLL herr_t H5O_unprotect(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh,
|
||||
unsigned oh_flags);
|
||||
H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
|
||||
hbool_t force);
|
||||
|
@ -256,12 +256,12 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
||||
* is possible, for example, if an attribute's datatype is shared in
|
||||
* the same object header the attribute is in. Adjust the link
|
||||
* count directly. */
|
||||
unsigned oh_flags = H5AC__NO_FLAGS_SET; /* This is used only to satisfy H5O_link_oh */
|
||||
hbool_t deleted = FALSE; /* This is used only to satisfy H5O_link_oh */
|
||||
|
||||
if(H5O_link_oh(f, adjust, dxpl_id, open_oh, &oh_flags) < 0)
|
||||
if(H5O_link_oh(f, adjust, dxpl_id, open_oh, &deleted) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
|
||||
|
||||
HDassert(!(oh_flags & H5AC__DELETED_FLAG));
|
||||
HDassert(!deleted);
|
||||
} else
|
||||
/* The shared message is in another object header */
|
||||
if(H5O_link(&oloc, adjust, dxpl_id) < 0)
|
||||
|
@ -98,7 +98,7 @@ H5O_is_attr_dense_test(hid_t oid)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Object header */
|
||||
H5O_ainfo_t ainfo; /* Attribute information for object */
|
||||
H5O_loc_t *loc; /* Pointer to object's location */
|
||||
H5O_loc_t *loc; /* Pointer to object's location */
|
||||
htri_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_is_attr_dense_test, FAIL)
|
||||
@ -108,7 +108,7 @@ H5O_is_attr_dense_test(hid_t oid)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
@ -130,7 +130,7 @@ H5O_is_attr_dense_test(hid_t oid)
|
||||
ret_value = FALSE;
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -173,7 +173,7 @@ H5O_is_attr_empty_test(hid_t oid)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
@ -217,7 +217,7 @@ done:
|
||||
/* Release resources */
|
||||
if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
|
||||
if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -260,7 +260,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
@ -301,7 +301,7 @@ done:
|
||||
/* Release resources */
|
||||
if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
|
||||
if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -346,7 +346,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Check for attribute info stored */
|
||||
@ -390,7 +390,7 @@ done:
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index")
|
||||
if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index")
|
||||
if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@ -434,7 +434,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
|
||||
/* Locate "unknown" message */
|
||||
@ -453,9 +453,68 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found")
|
||||
|
||||
done:
|
||||
if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5O_check_msg_marked_test() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_expunge_chunks_test
|
||||
PURPOSE
|
||||
Expunge all the chunks for an object header from the cache.
|
||||
USAGE
|
||||
herr_t H5O_expunge_chunks_test(f, dxpl_id, loc)
|
||||
H5F_t *f; IN: Pointer to file that object is within
|
||||
hid_t dxpl_id; IN: DXPL to use for operation
|
||||
H5O_loc_t *loc; IN: Object location for object header to expunge
|
||||
RETURNS
|
||||
Non-negative on success, negative on failure
|
||||
DESCRIPTION
|
||||
Iterates over all the chunks for an object header an expunges each from the
|
||||
metadata cache.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5O_expunge_chunks_test(const H5O_loc_t *loc, hid_t dxpl_id)
|
||||
{
|
||||
H5O_t *oh = NULL; /* Object header */
|
||||
haddr_t chk_addr[16]; /* Array of chunk addresses */
|
||||
unsigned nchunks; /* Number of chunks in object header */
|
||||
unsigned u; /* Local index variable */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_expunge_chunks_test, FAIL)
|
||||
|
||||
/* Get the object header */
|
||||
if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_WRITE)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header")
|
||||
|
||||
/* Safety check */
|
||||
nchunks = oh->nchunks;
|
||||
HDassert(nchunks < NELMTS(chk_addr));
|
||||
|
||||
/* Iterate over all the chunks, saving the chunk addresses */
|
||||
for(u = 0; u < oh->nchunks; u++)
|
||||
chk_addr[u] = oh->chunk[u].addr;
|
||||
|
||||
/* Release the object header */
|
||||
if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header")
|
||||
|
||||
/* Iterate over all the saved chunk addresses, evicting them from the cache */
|
||||
/* (in reverse order, so that chunk #0 is unpinned) */
|
||||
for(u = nchunks - 1; u < nchunks; u--)
|
||||
if(H5AC_expunge_entry(loc->file, dxpl_id, (u == 0 ? H5AC_OHDR : H5AC_OHDR_CHK), chk_addr[u], H5AC__NO_FLAGS_SET) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTEXPUNGE, FAIL, "unable to expunge object header chunk")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5O_expunge_chunks_test() */
|
||||
|
||||
|
22
src/H5R.c
22
src/H5R.c
@ -366,8 +366,9 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
|
||||
H5O_loc_t oloc; /* Object location */
|
||||
H5G_name_t path; /* Path of object */
|
||||
H5G_loc_t loc; /* Group location */
|
||||
unsigned rc; /* Reference count of object */
|
||||
H5O_type_t obj_type; /* Type of object */
|
||||
hid_t ret_value;
|
||||
hid_t ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5R_dereference)
|
||||
|
||||
@ -415,8 +416,9 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
|
||||
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
|
||||
} /* end switch */
|
||||
|
||||
/* Check to make certain that this object hasn't been deleted since the reference was created */
|
||||
if(H5O_link(&oloc, 0, dxpl_id) <= 0)
|
||||
/* Get the # of links for object, and its type */
|
||||
/* (To check to make certain that this object hasn't been deleted since the reference was created) */
|
||||
if(H5O_get_rc_and_type(&oloc, dxpl_id, &rc, &obj_type) < 0 || 0 == rc)
|
||||
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
|
||||
|
||||
/* Construct a group location for opening the object */
|
||||
@ -424,10 +426,6 @@ H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_re
|
||||
loc.oloc = &oloc;
|
||||
loc.path = &path;
|
||||
|
||||
/* Get the type of the object */
|
||||
if(H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get object type")
|
||||
|
||||
/* Open the object */
|
||||
switch(obj_type) {
|
||||
case H5O_TYPE_GROUP:
|
||||
@ -688,6 +686,7 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
|
||||
const void *_ref, H5O_type_t *obj_type)
|
||||
{
|
||||
H5O_loc_t oloc; /* Object location */
|
||||
unsigned rc; /* Reference count of object */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5R_get_obj_type)
|
||||
@ -736,14 +735,11 @@ H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type,
|
||||
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)")
|
||||
} /* end switch */
|
||||
|
||||
/* Check to make certain that this object hasn't been deleted since the reference was created */
|
||||
if(H5O_link(&oloc, 0, dxpl_id) <= 0)
|
||||
/* Get the # of links for object, and its type */
|
||||
/* (To check to make certain that this object hasn't been deleted since the reference was created) */
|
||||
if(H5O_get_rc_and_type(&oloc, dxpl_id, &rc, obj_type) < 0 || 0 == rc)
|
||||
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
|
||||
|
||||
/* Get the object type */
|
||||
if(H5O_obj_type(&oloc, obj_type, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get object type")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5R_get_obj_type() */
|
||||
|
@ -25,7 +25,6 @@
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5ACprivate.h" /* Metadata cache */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fpkg.h" /* File access */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
@ -2247,7 +2246,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
|
||||
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header")
|
||||
|
||||
/* Load the object header from the cache */
|
||||
if(NULL == (oh = (H5O_t *)H5AC_protect(oloc.file, dxpl_id, H5AC_OHDR, oloc.addr, NULL, NULL, H5AC_READ)))
|
||||
if(NULL == (oh = H5O_protect(&oloc, dxpl_id, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header")
|
||||
} /* end if */
|
||||
else
|
||||
@ -2276,7 +2275,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
|
||||
done:
|
||||
/* Close the object header if we opened one and had an error */
|
||||
if(oh && oh != open_oh) {
|
||||
if(H5AC_unprotect(oloc.file, dxpl_id, H5AC_OHDR, oloc.addr, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(oh && H5O_unprotect(&oloc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
|
||||
if(H5O_close(&oloc) < 0)
|
||||
HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close object header")
|
||||
|
@ -76,7 +76,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
|
||||
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
|
||||
H5MM.c H5MP.c H5MPtest.c \
|
||||
H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
|
||||
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c \
|
||||
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ochunk.c \
|
||||
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
|
||||
H5Ofill.c H5Ofsinfo.c H5Oginfo.c \
|
||||
H5Olayout.c \
|
||||
|
@ -126,7 +126,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
|
||||
H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \
|
||||
H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \
|
||||
H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \
|
||||
H5Obtreek.lo H5Ocache.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo \
|
||||
H5Obtreek.lo H5Ocache.lo H5Ochunk.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo \
|
||||
H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo \
|
||||
H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo \
|
||||
H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo \
|
||||
@ -494,7 +494,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
|
||||
H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \
|
||||
H5MM.c H5MP.c H5MPtest.c \
|
||||
H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
|
||||
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c \
|
||||
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ochunk.c \
|
||||
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \
|
||||
H5Ofill.c H5Ofsinfo.c H5Oginfo.c \
|
||||
H5Olayout.c \
|
||||
@ -818,6 +818,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Obogus.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Obtreek.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ocache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ochunk.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ocont.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ocopy.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Odbg.Plo@am__quote@
|
||||
|
@ -104,7 +104,7 @@ test_cont(char *filename, hid_t fapl)
|
||||
|
||||
if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_locA.addr, H5AC__NO_FLAGS_SET) < 0)
|
||||
if(H5O_expunge_chunks_test(&oh_locA, H5P_DATASET_XFER_DEFAULT) < 0)
|
||||
FAIL_STACK_ERROR
|
||||
|
||||
if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user