diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-06-15 20:00:22 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-06-15 20:00:22 (GMT) |
commit | 60ecd356b2e24f125a5fd7abbdb57569af76f3ba (patch) | |
tree | d5f77e77b2f5d62529e98101ed7af65d0dcd3650 | |
parent | 84f6de6f28553171029bc61560eb869bc2207fa2 (diff) | |
download | hdf5-60ecd356b2e24f125a5fd7abbdb57569af76f3ba.zip hdf5-60ecd356b2e24f125a5fd7abbdb57569af76f3ba.tar.gz hdf5-60ecd356b2e24f125a5fd7abbdb57569af76f3ba.tar.bz2 |
[svn-r19005] Purpose:
Commit metadata tagging framework.
Description:
This check-in contains a new framework whose goal is to apply
a tag value to each new entry in the metadata cache as it is created.
This tag value is such that it relates each piece of metadata to the
HDF5 object that it belongs to (dataset, group, et cetera).
This changeset includes the framework that applies the tags as
well as a suite of tests to verify correct tag application, though does
not yet make use of the tag values to flush/evict individual objects.
Please refer to the "flush/evict individual objects" RFC for further
discussion of these changes.
Tested:
jam, amani, linew (h5committest)
liberty, abe, blue print
56 files changed, 5383 insertions, 188 deletions
@@ -808,6 +808,7 @@ ./test/cache_api.c ./test/cache_common.c ./test/cache_common.h +./test/cache_tagging.c ./test/cmpd_dset.c ./test/corrupt_stab_msg.h5 ./test/cross_read.c @@ -369,7 +369,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, htri_t tri_ret; /* htri_t return value */ hid_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5A_create) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5A_create, dxpl_id, loc->oloc->addr, FAIL) /* check args */ HDassert(loc); @@ -500,7 +500,7 @@ done: if(ret_value < 0 && attr && H5A_close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5A_create() */ @@ -959,7 +959,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5A_write) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5A_write, dxpl_id, attr->oloc.addr, FAIL) HDassert(attr); HDassert(mem_type); @@ -1038,7 +1038,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5A_write() */ @@ -4037,3 +4037,129 @@ done: } /* H5AC_flush_entries() */ #endif /* H5_HAVE_PARALLEL */ + +/*------------------------------------------------------------------------------ + * Function: H5AC_ignore_tags() + * + * Purpose: Override all assertion frameworks and force application of + * global tag everywhere. This should really only be used in the + * tests that need to access functions without going through + * API paths. + * + * Return: SUCCEED on success, FAIL otherwise. + * + * Programmer: Mike McGreevy + * December 1, 2009 + * + *------------------------------------------------------------------------------ + */ +herr_t +H5AC_ignore_tags(H5F_t * f) +{ + /* Variable Declarations */ + H5AC_t * cache_ptr = NULL; + herr_t ret_value = SUCCEED; + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5AC_ignore_tags, FAIL) + + /* Assertions */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->cache); + + /* Get cache pointer */ + cache_ptr = f->shared->cache; + + /* Set up a new metadata tag */ + if (H5C_ignore_tags(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "H5C_ignore_tags() failed.") + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC_ignore_tags() */ + + +/*------------------------------------------------------------------------------ + * Function: H5AC_tag() + * + * Purpose: Sets the metadata tag property in the provided property list. + * + * Return: SUCCEED on success, FAIL otherwise. + * + * Programmer: Mike McGreevy + * December 1, 2009 + * + *------------------------------------------------------------------------------ + */ +herr_t +H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t * prev_tag) +{ + /* Variable Declarations */ + H5P_genplist_t *dxpl; /* dataset transfer property list */ + herr_t ret_value = SUCCEED; + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI_NOINIT(H5AC_tag) + + /* Check Arguments */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + + /* Get the current tag value and return that (if prev_tag is NOT null)*/ + if (prev_tag) { + if( (H5P_get(dxpl, "H5AC_metadata_tag", prev_tag)) < 0 ) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to query dxpl"); + } + + /* Set the provided tag value in the dxpl_id. */ + if(H5P_set(dxpl, "H5AC_metadata_tag", &metadata_tag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set property in dxpl") + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5AC_tag */ + + +/*------------------------------------------------------------------------------ + * Function: H5AC_retag_copied_metadata() + * + * Purpose: Searches through cache index for all entries with the + * H5AC__COPIED_TAG, indicating that it was created as a + * result of an object copy, and applies the provided tag. + * + * Return: SUCCEED on success, FAIL otherwise. + * + * Programmer: Mike McGreevy + * March 17, 2010 + * + *------------------------------------------------------------------------------ + */ +herr_t +H5AC_retag_copied_metadata(H5F_t * f, haddr_t metadata_tag) +{ + /* Variable Declarations */ + herr_t ret_value = SUCCEED; + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI_NOINIT(H5AC_retag_copied_metadata) + + /* Assertions */ + HDassert(f); + HDassert(f->shared); + + /* Call cache-level function to retag entries */ + H5C_retag_copied_metadata(f->shared->cache, metadata_tag); + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5AC_retag_copied_metadata */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 5763e14..a320f46 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -41,6 +41,14 @@ #define H5AC__TRACE_FILE_ENABLED 0 #endif /* H5_METADATA_TRACE_FILE */ +#define H5AC__INVALID_TAG (haddr_t)0 +#define H5AC__IGNORE_TAG (haddr_t)1 +#define H5AC__SUPERBLOCK_TAG (haddr_t)2 +#define H5AC__FREESPACE_TAG (haddr_t)3 +#define H5AC__SOHM_TAG (haddr_t)4 +#define H5AC__GLOBALHEAP_TAG (haddr_t)5 +#define H5AC__COPIED_TAG (haddr_t)6 + /* Types of metadata objects cached */ typedef enum { H5AC_BT_ID = 0, /*B-tree nodes */ @@ -197,6 +205,10 @@ typedef H5C_t H5AC_t; #define H5AC_LIBRARY_INTERNAL_DEF 0 #endif /* H5_HAVE_PARALLEL */ +#define H5AC_METADATA_TAG_NAME "H5AC_metadata_tag" +#define H5AC_METADATA_TAG_SIZE sizeof(haddr_t) +#define H5AC_METADATA_TAG_DEF H5AC__INVALID_TAG + /* Dataset transfer property list for flush calls */ /* (Collective set, "block before metadata write" set and "library internal" set) */ /* (Global variable declaration, definition is in H5AC.c) */ @@ -374,5 +386,9 @@ H5_DLL herr_t H5AC_close_trace_file( H5AC_t * cache_ptr); H5_DLL herr_t H5AC_open_trace_file(H5AC_t * cache_ptr, const char * trace_file_name); +H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t * prev_tag); + +H5_DLL herr_t H5AC_retag_copied_metadata(H5F_t * f, haddr_t metadata_tag); + #endif /* !_H5ACprivate_H */ diff --git a/src/H5Aint.c b/src/H5Aint.c index 81b5c60..ba30506 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -688,7 +688,7 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5A_get_ainfo, FAIL) + FUNC_ENTER_NOAPI_TAG(H5A_get_ainfo, dxpl_id, oh->cache_info.addr, FAIL) /* check arguments */ HDassert(f); @@ -727,7 +727,7 @@ done: if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5A_get_ainfo() */ @@ -1157,10 +1157,16 @@ H5A_dense_copy_file_cb(const H5A_t *attr_src, void *_udata) if(H5O_msg_reset_share(H5O_ATTR_ID, attr_dst) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing") + /* Set COPIED tag for destination object's metadata */ + H5_BEGIN_TAG(udata->dxpl_id, H5AC__COPIED_TAG, H5_ITER_ERROR); + /* Insert attribute into dense storage */ if(H5A_dense_insert(udata->file, udata->dxpl_id, udata->ainfo, attr_dst) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage") + /* Reset metadata tag */ + H5_END_TAG(H5_ITER_ERROR); + done: if(attr_dst) { (void)H5A_free(attr_dst); @@ -159,6 +159,29 @@ static herr_t H5C_make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted, hbool_t * first_flush_ptr); + +static herr_t H5C_tag_entry(H5C_t * cache_ptr, + H5C_cache_entry_t * entry_ptr, + hid_t dxpl_id); + +static herr_t H5C_flush_tagged_entries(H5F_t * f, + hid_t primary_dxpl_id, + hid_t secondary_dxpl_id, + H5C_t * cache_ptr, + haddr_t tag); + +static herr_t H5C_mark_tagged_entries(H5C_t * cache_ptr, + haddr_t tag); + +static herr_t H5C_flush_marked_entries(H5F_t * f, + hid_t primary_dxpl_id, + hid_t secondary_dxpl_id, + H5C_t * cache_ptr); + +#if H5C_DO_TAGGING_SANITY_CHECKS +static herr_t H5C_verify_tag(int id, haddr_t tag); +#endif + #if H5C_DO_EXTREME_SANITY_CHECKS static herr_t H5C_validate_lru_list(H5C_t * cache_ptr); static herr_t H5C_verify_not_in_index(H5C_t * cache_ptr, @@ -413,6 +436,9 @@ H5C_create(size_t max_cache_size, cache_ptr->clean_index_size = (size_t)0; cache_ptr->dirty_index_size = (size_t)0; + /* Tagging Field Initializations */ + cache_ptr->ignore_tags = FALSE; + cache_ptr->slist_len = 0; cache_ptr->slist_size = (size_t)0; @@ -1989,6 +2015,10 @@ H5C_insert_entry(H5F_t * f, entry_ptr->cache_ptr = cache_ptr; entry_ptr->addr = addr; entry_ptr->type = type; + + /* Apply tag to newly inserted entry */ + if(H5C_tag_entry(cache_ptr, entry_ptr, primary_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry") entry_ptr->is_protected = FALSE; entry_ptr->is_read_only = FALSE; @@ -3046,8 +3076,35 @@ H5C_protect(H5F_t * f, if(entry_ptr->type != type) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type") + #if H5C_DO_TAGGING_SANITY_CHECKS + /* The entry is already in the cache, but make sure that the tag value + being passed in via dxpl is still legal. This will ensure that had + the entry NOT been in the cache, tagging was still set up correctly + and it would have received a legal tag value after getting loaded + from disk. */ + haddr_t tag = HADDR_UNDEF; + H5P_genplist_t *dxpl; /* dataset transfer property list */ + + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(primary_dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); + + /* Get the tag from the DXPL */ + if( (H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0 ) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value"); + + /* Verify tag value */ + if (cache_ptr->ignore_tags != TRUE) { + + /* Verify legal tag value */ + if ( (H5C_verify_tag(entry_ptr->type->id, tag)) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed"); + + } /* end if */ + #endif + hit = TRUE; - thing = (void *)entry_ptr; + thing = (void *)entry_ptr; } else { @@ -3064,6 +3121,10 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; + /* Apply tag to newly protected entry */ + if(H5C_tag_entry(cache_ptr, entry_ptr, primary_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry") + /* If the entry is very large, and we are configured to allow it, * we may wish to perform a flash cache size increase. */ @@ -8531,3 +8592,431 @@ done: #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + +/*------------------------------------------------------------------------- + * + * Function: H5C_ignore_tags + * + * Purpose: Override all assertion frameworks associated with making + * sure proper tags are applied to metadata. + * + * NOTE: This should really only be used in tests that need + * to access internal functions without going through + * standard API paths. Since tags are set inside dxpl_id's + * before coming into the cache, any external functions that + * use the internal library functions (i.e., tests) should + * use this function if they don't plan on setting up proper + * metadata tags. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mike McGreevy + * December 1, 2009 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_ignore_tags(H5C_t * cache_ptr) +{ + /* Variable Declarations */ + herr_t ret_value = SUCCEED; /* Return value */ + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5C_ignore_tags, FAIL) + + /* Assertions */ + HDassert( cache_ptr != NULL ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + + /* Set variable to ignore tag values upon assignment */ + cache_ptr->ignore_tags = TRUE; + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_ignore_tags */ + + +/*------------------------------------------------------------------------- + * + * Function: H5C_tag_entry + * + * Purpose: Tags an entry with the provided tag (contained in the dxpl_id). + * If sanity checking is enabled, this function will perform + * validation that a proper tag is contained within the provided + * data access property list id before application. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mike McGreevy + * January 14, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C_tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hid_t dxpl_id) +{ + /* Variable Declarations */ + hid_t ret_value = SUCCEED; + haddr_t tag; + H5P_genplist_t *dxpl; /* dataset transfer property list */ + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5C_tag_entry, FAIL) + + /* Assertions */ + HDassert( cache_ptr != NULL ); + HDassert( entry_ptr != NULL ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + + /* Get the tag from the DXPL */ + if( (H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0 ) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to query property value"); + + if (cache_ptr->ignore_tags != TRUE) { + + /* Perform some sanity checks to ensure that + a correct tag is being applied */ + #if H5C_DO_TAGGING_SANITY_CHECKS + if ( (H5C_verify_tag(entry_ptr->type->id, tag)) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed"); + #endif + + } else { + + /* if we're ignoring tags, it's because we're running + tests on internal functions and may not have inserted a tag + value into a given dxpl_id before creating some metadata. Thus, + in this case only, if a tag value has not been set, we can + arbitrarily set it to something for the sake of passing the tests. + If the tag value is set, then we'll just let it get assigned without + additional checking for correctness. */ + + if (!tag) tag = H5AC__IGNORE_TAG; + + } /* end if */ + + /* Apply the tag to the entry */ + entry_ptr->tag = tag; + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_tag_entry */ + + +/*------------------------------------------------------------------------- + * + * Function: H5C_flush_tagged_entries + * + * WARNING: Not yet tested or used anywhere. (written awhile ago, + * will keep it around in anticipation of being used in + * subsequent changes to support flushing individual objects). + * + * Purpose: Flushes all entries with the specified tag to disk. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mike McGreevy + * November 3, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C_flush_tagged_entries(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, H5C_t * cache_ptr, haddr_t tag) +{ + /* Variable Declarations */ + herr_t result; + herr_t ret_value = SUCCEED; + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5C_flush_tagged_entries, FAIL) + + /* Assertions */ + HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */ + HDassert( cache_ptr != NULL ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + + /* Mark all entries with specified tag */ + if ( (result = H5C_mark_tagged_entries(cache_ptr, tag)) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries") + + /* Flush all marked entries */ + if ( (result = H5C_flush_marked_entries(f, + primary_dxpl_id, + secondary_dxpl_id, + cache_ptr)) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries") + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_flush_tagged_entries */ + + +/*------------------------------------------------------------------------- + * + * Function: H5C_mark_tagged_entries + * + * WARNING: Not yet tested or used anywhere. (written awhile ago, + * will keep it around in anticipation of being used in + * subsequent changes to support flushing individual objects). + * + * Purpose: Set the flush marker on entries in the cache that have + * the specified tag. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mike McGreevy + * November 3, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C_mark_tagged_entries(H5C_t * cache_ptr, haddr_t tag) +{ + /* Variable Declarations */ + int i; /* Iterator */ + herr_t result; /* Result */ + H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */ + herr_t ret_value = SUCCEED; /* Return Value */ + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5C_mark_tagged_entries, FAIL) + + /* Assertions */ + HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */ + HDassert( cache_ptr != NULL ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + + /* Iterate through entries, marking those with specified tag. */ + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + next_entry_ptr = cache_ptr->index[i]; + + while ( next_entry_ptr != NULL ) { + + if ( next_entry_ptr->tag == tag ) { + + next_entry_ptr->flush_marker = TRUE; + + } /* end if */ + + next_entry_ptr = next_entry_ptr->ht_next; + + } /* end while */ + + } /* for */ + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5C_mark_tagged_entries */ + + +/*------------------------------------------------------------------------- + * + * Function: H5C_flush_marked_entries + * + * WARNING: Not yet tested or used anywhere. (written awhile ago, + * will keep it around in anticipation of being used in + * subsequent changes to support flushing individual objects). + * + * Purpose: Flushes all marked entries in the cache. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mike McGreevy + * November 3, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C_flush_marked_entries(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, H5C_t * cache_ptr) +{ + /* Variable Declarations */ + herr_t ret_value = SUCCEED; + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5C_flush_marked_entries, FAIL) + + /* Assertions */ + HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */ + HDassert( cache_ptr != NULL ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + + /* Flush all marked entries */ + if (H5C_flush_cache(f, + primary_dxpl_id, + secondary_dxpl_id, + H5C__FLUSH_MARKED_ENTRIES_FLAG | + H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") + + } /* end if */ + +done: + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5C_flush_marked_entries */ + +#if H5C_DO_TAGGING_SANITY_CHECKS + +/*------------------------------------------------------------------------- + * + * Function: H5C_verify_tag + * + * Purpose: Performs sanity checking on an entrytype/tag pair. + * + * Return: SUCCEED or FAIL. + * + * Programmer: Mike McGreevy + * January 14, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C_verify_tag(int id, haddr_t tag) +{ + /* Variable Declarations */ + herr_t ret_value = SUCCEED; + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5C_verify_tag, FAIL) + + /* Perform some sanity checks on tag value. Certain entry + * types require certain tag values, so check that these + * constraints are met. */ + if (tag == H5AC__IGNORE_TAG) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "cannot ignore a tag while doing verification."); + + } else if (tag == H5AC__INVALID_TAG) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided"); + + } else { + + /* Perform some sanity checks on tag value. Certain entry + * types require certain tag values, so check that these + * constraints are met. */ + + /* Superblock */ + if (id == H5AC_SUPERBLOCK_ID) { + if (tag != H5AC__SUPERBLOCK_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "superblock not tagged with H5AC__SUPERBLOCK_TAG"); + } + else { + if (tag == H5AC__SUPERBLOCK_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__SUPERBLOCK_TAG applied to non-superblock entry"); + } + + /* Free Space Manager */ + if ((id == H5AC_FSPACE_HDR_ID) || (id == H5AC_FSPACE_SINFO_ID)) { + if (tag != H5AC__FREESPACE_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "freespace entry not tagged with H5AC__FREESPACE_TAG"); + } + else { + if (tag == H5AC__FREESPACE_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry"); + } + + /* SOHM */ + if ((id == H5AC_SOHM_TABLE_ID) || (id == H5AC_SOHM_LIST_ID)) { + if (tag != H5AC__SOHM_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "sohm entry not tagged with H5AC__SOHM_TAG"); + } + + /* Global Heap */ + if (id == H5AC_GHEAP_ID) { + if (tag != H5AC__GLOBALHEAP_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "global heap not tagged with H5AC__GLOBALHEAP_TAG"); + } + else { + if (tag == H5AC__GLOBALHEAP_TAG) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry"); + } + } + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5C_verify_tag */ +#endif + + +/*------------------------------------------------------------------------- + * + * Function: H5C_retag_copied_metadata + * + * Purpose: Searches through cache index for all entries with the + * H5AC__COPIED_TAG, indicating that it was created as a + * result of an object copy, and applies the provided tag. + * + * Return: SUCCEED or FAIL. + * + * Programmer: Mike McGreevy + * March 17, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag) +{ + /* Variable Declarations */ + herr_t ret_value = SUCCEED; /* Return Value */ + int i = 0; /* Iterator */ + H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */ + + /* Assertions */ + HDassert(cache_ptr); + + /* Function Enter Macro */ + FUNC_ENTER_NOAPI(H5C_retag_copied_metadata, FAIL) + + /* Iterate through entries, retagging those with the H5AC__COPIED_TAG tag */ + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + next_entry_ptr = cache_ptr->index[i]; + + while ( next_entry_ptr != NULL ) { + if (cache_ptr->index[i] != NULL) { + if ((cache_ptr->index[i])->tag == H5AC__COPIED_TAG) { + (cache_ptr->index[i])->tag = metadata_tag; + } /* end if */ + } /* end if */ + next_entry_ptr = next_entry_ptr->ht_next; + } /* end while */ + + } /* end for */ + +done: + + /* Function Leave Macro */ + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5C_retag_copied_metadata */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 678e0d0..22d3514 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -892,6 +892,7 @@ struct H5C_t size_t dirty_index_size; H5C_cache_entry_t * (index[H5C__HASH_TABLE_LEN]); + hbool_t ignore_tags; int32_t slist_len; size_t slist_size; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 0441213..3f38500 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -38,6 +38,7 @@ #define H5C_DO_SANITY_CHECKS 0 +#define H5C_DO_TAGGING_SANITY_CHECKS 1 #define H5C_DO_EXTREME_SANITY_CHECKS 0 /* This sanity checking constant was picked out of the air. Increase @@ -569,6 +570,7 @@ typedef struct H5C_cache_entry_t haddr_t addr; size_t size; const H5C_class_t * type; + haddr_t tag; hbool_t is_dirty; hbool_t dirtied; hbool_t is_protected; @@ -1173,5 +1175,9 @@ H5_DLL herr_t H5C_unprotect(H5F_t * f, H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, unsigned int tests); +H5_DLL herr_t H5C_ignore_tags(H5C_t * cache_ptr); + +H5_DLL herr_t H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag); + #endif /* !_H5Cprivate_H */ diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 374c1b6..a2b3a37 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -1211,7 +1211,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_btree_idx_copy_setup) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_btree_idx_copy_setup, idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL) HDassert(idx_info_src); HDassert(idx_info_src->f); @@ -1237,7 +1237,7 @@ H5D_btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_btree_idx_copy_setup() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index da00d0a..e1d6c1b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2345,7 +2345,7 @@ H5D_chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * hbool_t point_of_no_return = FALSE; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_flush_entry) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_chunk_flush_entry, dxpl_id, dset->oloc.addr, FAIL) HDassert(dset); HDassert(dset->shared); @@ -2474,7 +2474,7 @@ done: ent->chunk = (uint8_t *)H5D_chunk_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_chunk_flush_entry() */ @@ -3152,7 +3152,7 @@ H5D_chunk_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hid_t data_dxpl_id; /* DXPL ID to use for raw data I/O operations */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_chunk_allocate, FAIL) + FUNC_ENTER_NOAPI_TAG(H5D_chunk_allocate, dxpl_id, dset->oloc.addr, FAIL) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -3449,7 +3449,7 @@ done: if(fb_info_init && H5D_fill_term(&fb_info) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_chunk_allocate() */ @@ -4432,10 +4432,16 @@ H5D_chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata->buf_size = buf_size; } /* end if */ + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(udata->idx_info_dst->dxpl_id, H5AC__COPIED_TAG, H5_ITER_ERROR); + /* Insert chunk into the destination index */ if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk into index") + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(H5_ITER_ERROR); + /* Write chunk data to destination file */ HDassert(H5F_addr_defined(udata_dst.addr)); if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.addr, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0) @@ -4875,7 +4881,7 @@ H5D_chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset) int nerrors = 0; /* Accumulated count of errors */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_chunk_dest, FAIL) + FUNC_ENTER_NOAPI_TAG(H5D_chunk_dest, dxpl_id, dset->oloc.addr, FAIL) HDassert(f); HDassert(dset); @@ -4910,7 +4916,7 @@ H5D_chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_chunk_dest() */ #ifdef H5D_CHUNK_DEBUG diff --git a/src/H5Dint.c b/src/H5Dint.c index 538ff80..20c02c1 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1205,7 +1205,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) htri_t msg_exists; /* Whether a particular type of message exists */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_open_oid) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_open_oid, dxpl_id, dataset->oloc.addr, FAIL) /* check args */ HDassert(dataset); @@ -1330,7 +1330,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_open_oid() */ @@ -1791,7 +1791,7 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) { hsize_t ret_value; - FUNC_ENTER_NOAPI_NOINIT(H5D_get_storage_size) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_get_storage_size, dxpl_id, dset->oloc.addr, 0) switch(dset->shared->layout.type) { case H5D_CHUNKED: @@ -1822,7 +1822,7 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) } /*lint !e788 All appropriate cases are covered */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, 0) } /* end H5D_get_storage_size() */ @@ -2120,7 +2120,7 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) htri_t changed; /* Whether the dataspace changed size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_set_extent) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_set_extent, dxpl_id, dset->oloc.addr, FAIL) /* Check args */ HDassert(dset); @@ -2200,7 +2200,7 @@ H5D_set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_set_extent() */ @@ -2264,7 +2264,7 @@ H5D_flush_real(H5D_t *dataset, hid_t dxpl_id) H5O_t *oh = NULL; /* Pointer to dataset's object header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_flush_real) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_flush_real, dxpl_id, dataset->oloc.addr, FAIL) /* Check args */ HDassert(dataset); @@ -2312,7 +2312,7 @@ done: if(H5O_unpin(oh) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_flush_real() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index d3120b1..285451e 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -302,7 +302,7 @@ H5D_read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_read) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_read, dxpl_id, dataset->oloc.addr, FAIL) /* check args */ HDassert(dataset && dataset->oloc.file); @@ -417,7 +417,7 @@ done: if(type_info_init && H5D_typeinfo_term(&type_info) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_read() */ @@ -453,7 +453,7 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_write) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_write, dxpl_id, dataset->oloc.addr, FAIL) /* check args */ HDassert(dataset && dataset->oloc.file); @@ -608,7 +608,7 @@ done: if(type_info_init && H5D_typeinfo_term(&type_info) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_write() */ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 6aa5b44..c865b32 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -202,7 +202,7 @@ H5D_layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_layout_oh_create) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5D_layout_oh_create, dxpl_id, dset->oloc.addr, FAIL) /* Sanity checking */ HDassert(file); @@ -302,7 +302,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D_layout_oh_create() */ diff --git a/src/H5Edefin.h b/src/H5Edefin.h index b871396..887c2bb 100644 --- a/src/H5Edefin.h +++ b/src/H5Edefin.h @@ -152,6 +152,7 @@ hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ /* Cache related errors */ hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */ hid_t H5E_CANTSERIALIZE_g = FAIL; /* Unable to serialize data from cache */ +hid_t H5E_CANTTAG_g = FAIL; /* Unable to tag metadata in the cache */ hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */ hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */ hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */ diff --git a/src/H5Einit.h b/src/H5Einit.h index d1ff816..802c94a 100644 --- a/src/H5Einit.h +++ b/src/H5Einit.h @@ -562,6 +562,11 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache")) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") +assert(H5E_CANTTAG_g==(-1)); +if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to tag metadata in the cache"))==NULL) + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") +if((H5E_CANTTAG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") assert(H5E_CANTLOAD_g==(-1)); if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL) HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h index c1c222a..f6a20f2 100644 --- a/src/H5Epubgen.h +++ b/src/H5Epubgen.h @@ -256,6 +256,7 @@ H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ /* Cache related errors */ #define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) #define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g) +#define H5E_CANTTAG (H5OPEN H5E_CANTTAG_g) #define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g) #define H5E_PROTECT (H5OPEN H5E_PROTECT_g) #define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g) @@ -274,6 +275,7 @@ H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ #define H5E_CANTNOTIFY (H5OPEN H5E_CANTNOTIFY_g) H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */ H5_DLLVAR hid_t H5E_CANTSERIALIZE_g; /* Unable to serialize data from cache */ +H5_DLLVAR hid_t H5E_CANTTAG_g; /* Unable to tag metadata in the cache */ H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */ H5_DLLVAR hid_t H5E_PROTECT_g; /* Protected metadata error */ H5_DLLVAR hid_t H5E_NOTCACHED_g; /* Metadata not currently cached */ diff --git a/src/H5Eterm.h b/src/H5Eterm.h index be40694..921b3b6 100644 --- a/src/H5Eterm.h +++ b/src/H5Eterm.h @@ -154,6 +154,7 @@ H5E_NOIDS_g= /* Cache related errors */ H5E_CANTFLUSH_g= H5E_CANTSERIALIZE_g= +H5E_CANTTAG_g= H5E_CANTLOAD_g= H5E_PROTECT_g= H5E_NOTCACHED_g= @@ -109,7 +109,7 @@ H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr, const H5FS_create_t *fs_c H5FS_t *fspace = NULL; /* New free space structure */ H5FS_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FS_create, NULL) + FUNC_ENTER_NOAPI_TAG(H5FS_create, dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, nclasses); #endif /* H5FS_DEBUG */ @@ -167,7 +167,7 @@ done: #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* H5FS_DEBUG */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* H5FS_create() */ @@ -198,7 +198,7 @@ H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, size_t nclasses, H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ H5FS_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FS_open, NULL) + FUNC_ENTER_NOAPI_TAG(H5FS_open, dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", FUNC, fs_addr, nclasses); #endif /* H5FS_DEBUG */ @@ -242,7 +242,7 @@ HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc); ret_value = fspace; done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* H5FS_open() */ @@ -267,7 +267,7 @@ H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr) H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FS_delete, FAIL) + FUNC_ENTER_NOAPI_TAG(H5FS_delete, dxpl_id, H5AC__FREESPACE_TAG, FAIL) #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_addr); #endif /* H5FS_DEBUG */ @@ -334,7 +334,7 @@ done: if(fspace && H5AC_unprotect(f, dxpl_id, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space header") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5FS_delete() */ @@ -358,7 +358,7 @@ H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FS_close, FAIL) + FUNC_ENTER_NOAPI_TAG(H5FS_close, dxpl_id, H5AC__FREESPACE_TAG, FAIL) /* Check arguments. */ HDassert(f); @@ -497,7 +497,7 @@ done: #ifdef H5FS_DEBUG HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_value, fspace->rc); #endif /* H5FS_DEBUG */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5FS_close() */ @@ -755,7 +755,7 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FS_alloc_hdr, FAIL) + FUNC_ENTER_NOAPI_TAG(H5FS_alloc_hdr, dxpl_id, H5AC__FREESPACE_TAG, FAIL) /* Check arguments. */ HDassert(f); @@ -775,7 +775,7 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr, hid_t dxpl_id) *fs_addr = fspace->addr; done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5FS_alloc_hdr() */ @@ -795,7 +795,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FS_alloc_sect, FAIL) + FUNC_ENTER_NOAPI_TAG(H5FS_alloc_sect, dxpl_id, H5AC__FREESPACE_TAG, FAIL) /* Check arguments. */ HDassert(f); @@ -821,7 +821,7 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5FS_alloc_sect() */ @@ -843,7 +843,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) unsigned cache_flags; /* Flags for unprotecting cache entries */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FS_free, FAIL) + FUNC_ENTER_NOAPI_TAG(H5FS_free, dxpl_id, H5AC__FREESPACE_TAG, FAIL) /* Check arguments. */ HDassert(f); @@ -927,7 +927,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hid_t dxpl_id) } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5FS_free() */ diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 5ad6233..9fb34df 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -209,7 +209,8 @@ H5FS_sinfo_lock(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5AC_protect_t accmode) H5FS_sinfo_cache_ud_t cache_udata; /* User-data for cache callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5FS_sinfo_lock) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5FS_sinfo_lock, dxpl_id, H5AC__FREESPACE_TAG, FAIL) + #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, fspace->addr, fspace->sinfo, fspace->sect_addr); HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); @@ -291,7 +292,7 @@ done: HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, fspace->addr, fspace->sinfo, fspace->sect_addr); HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5FS_sinfo_lock() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 154af1e..fd8c692 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -300,7 +300,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) hbool_t dirtied = FALSE; /* Bool for sblock protect call */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(H5F_super_read, FAIL) + FUNC_ENTER_NOAPI_TAG(H5F_super_read, dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Find the superblock */ if(HADDR_UNDEF == (super_addr = H5F_locate_signature(f->shared->lf, dxpl_id))) @@ -339,7 +339,7 @@ done: if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5F_super_read() */ @@ -372,7 +372,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) hbool_t need_ext; /* Whether the superblock extension is needed */ herr_t ret_value = SUCCEED; /* Return Value */ - FUNC_ENTER_NOAPI(H5F_super_init, FAIL) + FUNC_ENTER_NOAPI_TAG(H5F_super_init, dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Allocate space for the superblock */ if(NULL == (sblock = H5FL_CALLOC(H5F_super_t))) @@ -631,7 +631,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5F_super_init() */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 793034a..ef38380 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1306,10 +1306,17 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, name = (const char *)H5HL_offset_into(heap, src_ent->name_off); HDassert(name); + /* Set copied metadata tag */ + H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, H5_ITER_ERROR); + /* Insert the new object in the destination file's group */ /* (Don't increment the link count - that's already done above for hard links) */ if(H5G_stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") + + /* Reset metadata tag */ + H5_END_TAG(H5_ITER_ERROR); + } /* end of for (i=0; i<sn->nsyms; i++) */ done: diff --git a/src/H5Gobj.c b/src/H5Gobj.c index daad6ae..0dcf015 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -60,6 +60,7 @@ */ typedef struct { H5F_t *f; /* Pointer to file for insertion */ + haddr_t oh_addr; /* Address of the object header */ hid_t dxpl_id; /* DXPL during insertion */ H5O_linfo_t *linfo; /* Pointer to link info */ } H5G_obj_oh_it_ud1_t; @@ -312,7 +313,7 @@ H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id) H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_get_linfo, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_get_linfo, dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc); @@ -352,7 +353,7 @@ done: if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_get_linfo() */ @@ -377,7 +378,7 @@ H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned UNUSED idx, void *_udata H5G_obj_oh_it_ud1_t *udata = (H5G_obj_oh_it_ud1_t *)_udata; /* 'User data' passed in */ herr_t ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_obj_compact_to_dense_cb) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5G_obj_compact_to_dense_cb, udata->dxpl_id, udata->oh_addr, FAIL) /* check arguments */ HDassert(lnk); @@ -388,7 +389,7 @@ H5G_obj_compact_to_dense_cb(const void *_mesg, unsigned UNUSED idx, void *_udata HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_compact_to_dense_cb() */ @@ -457,7 +458,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, hbool_t use_new_dense = FALSE; /* Whether to use "dense" form of 'new format' group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_insert, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_insert, dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -521,6 +522,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Set up user data for object header message iteration */ udata.f = grp_oloc->file; + udata.oh_addr = grp_oloc->addr; udata.dxpl_id = dxpl_id; udata.linfo = &linfo; @@ -625,7 +627,7 @@ done: if(pline && H5O_msg_reset(H5O_PLINE_ID, pline) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't release pipeline") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_insert() */ @@ -653,7 +655,7 @@ H5G_obj_iterate(const H5O_loc_t *grp_oloc, htri_t linfo_exists; /* Whether the link info message exists */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_iterate, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_iterate, dxpl_id, grp_oloc->addr, FAIL) /* Sanity check */ HDassert(grp_oloc); @@ -696,7 +698,7 @@ H5G_obj_iterate(const H5O_loc_t *grp_oloc, } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_iterate() */ @@ -800,7 +802,7 @@ H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, htri_t linfo_exists; /* Whether the link info message exists */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_get_name_by_idx, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_get_name_by_idx, dxpl_id, oloc->addr, FAIL) /* Sanity check */ HDassert(oloc && oloc->file); @@ -839,7 +841,7 @@ H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5_index_t idx_type, } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_get_name_by_idx() */ @@ -973,7 +975,7 @@ H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, h hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for deletion or not */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_remove, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_remove, dxpl_id, oloc->addr, FAIL) /* Sanity check */ HDassert(oloc); @@ -1013,7 +1015,7 @@ H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, h HGOTO_ERROR(H5E_SYM, H5E_CANTUPDATE, FAIL, "unable to update link info") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_remove() */ @@ -1039,7 +1041,7 @@ H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, hbool_t use_old_format; /* Whether to use 'old format' (symbol table) for deletion or not */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_remove_by_idx, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_remove_by_idx, dxpl_id, grp_oloc->addr, FAIL) /* Sanity check */ HDassert(grp_oloc && grp_oloc->file); @@ -1090,7 +1092,7 @@ H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_remove() */ @@ -1115,7 +1117,7 @@ H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, htri_t linfo_exists; /* Whether the link info message exists */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_lookup, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_lookup, dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -1144,7 +1146,7 @@ H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_lookup() */ @@ -1170,7 +1172,7 @@ H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, htri_t linfo_exists; /* Whether the link info message exists */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_obj_lookup_by_idx, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_obj_lookup_by_idx, dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -1209,6 +1211,6 @@ H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5_index_t idx_type, } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_obj_lookup_by_idx() */ diff --git a/src/H5Goh.c b/src/H5Goh.c index d6e3a55..4dc569c 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -340,7 +340,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_group_bh_info) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_group_bh_info, dxpl_id, oh->cache_info.addr, FAIL) /* Sanity check */ HDassert(f); @@ -411,6 +411,6 @@ done: if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_group_bh_info() */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 74ef829..31ee008 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -171,7 +171,7 @@ H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo, size_t size_hint; /* Local heap size hint */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_stab_create, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_stab_create, dxpl_id, grp_oloc->addr, FAIL) /* * Check arguments. @@ -200,7 +200,7 @@ H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id, const H5O_ginfo_t *ginfo, HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_stab_create() */ @@ -279,7 +279,7 @@ H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk H5O_stab_t stab; /* Symbol table message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_stab_insert, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_stab_insert, dxpl_id, grp_oloc->addr, FAIL) /* check arguments */ HDassert(grp_oloc && grp_oloc->file); @@ -294,7 +294,7 @@ H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, H5_ITER_ERROR) } /* end H5G_stab_insert() */ @@ -491,7 +491,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, H5G_link_table_t ltable = {0, NULL}; /* Link table */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_stab_iterate, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_stab_iterate, dxpl_id, oloc->addr, FAIL) /* Sanity check */ HDassert(oloc); @@ -558,7 +558,7 @@ done: if(ltable.lnks && H5G_link_release_table(<able) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_stab_iterate() */ @@ -580,7 +580,7 @@ H5G_stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id) H5O_stab_t stab; /* Info about symbol table */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5G_stab_count, FAIL) + FUNC_ENTER_NOAPI_TAG(H5G_stab_count, dxpl_id, oloc->addr, FAIL) /* Sanity check */ HDassert(oloc); @@ -598,7 +598,7 @@ H5G_stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_stab_count() */ @@ -1138,7 +1138,7 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ H5G_obj_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5G_stab_get_type_by_idx, H5G_UNKNOWN) + FUNC_ENTER_NOAPI_TAG(H5G_stab_get_type_by_idx, dxpl_id, oloc->addr, H5G_UNKNOWN) /* Sanity check */ HDassert(oloc); @@ -1167,7 +1167,7 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) ret_value = udata.type; done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, H5G_UNKNOWN) } /* end H5G_stab_get_type_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 9e6fca0..96ecfda 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -394,6 +394,9 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) if(NULL == (grp = (H5G_t *)H5I_object_verify(gid, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(H5AC_dxpl_id, grp->oloc.addr, FAIL); + /* Get the link info */ if(H5G_obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") @@ -432,6 +435,9 @@ done: if(bt2_corder && H5B2_close(bt2_corder, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(FAIL); + FUNC_LEAVE_NOAPI(ret_value) } /* H5G_new_dense_info_test() */ @@ -603,7 +609,7 @@ H5G_verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) H5HL_t *heap = NULL; /* Pointer to local heap */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_verify_cached_stab_test) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5G_verify_cached_stab_test, H5AC_ind_dxpl_id, grp_oloc->addr, FAIL) /* Verify that stab info is cached in ent */ if(ent->type != H5G_CACHED_STAB) @@ -632,6 +638,6 @@ done: if(heap && H5HL_unprotect(heap) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5G_verify_cached_stab_test() */ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 0779c89..5b1f71c 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -946,11 +946,22 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver if(H5P_get(lapl, H5L_ACS_NLINKS_NAME, &nlinks) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links") } /* end else */ + + /* Set up invalid tag. This is a precautionary step only. Setting an invalid + tag here will ensure that no metadata accessed while doing the traversal + is given an improper tag, unless another one is specifically set up + first. This will ensure we're not accidentally tagging something we + shouldn't be during the traversal. Note that for best tagging assertion + coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */ + H5_BEGIN_TAG(dxpl_id, H5AC__INVALID_TAG, FAIL); /* Go perform "real" traversal */ if(H5G_traverse_real(loc, name, target, &nlinks, op, op_data, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "internal path traversal failed") + /* Reset tag after traversal */ + H5_END_TAG(FAIL); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_traverse() */ @@ -148,7 +148,7 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size) size_t n; haddr_t ret_value = HADDR_UNDEF; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5HG_create) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5HG_create, dxpl_id, H5AC__GLOBALHEAP_TAG, HADDR_UNDEF) /* Check args */ HDassert(f); @@ -248,7 +248,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI_TAG(ret_value, HADDR_UNDEF); } /* H5HG_create() */ @@ -545,7 +545,7 @@ H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/ hbool_t found = FALSE; /* Flag to indicate a heap with enough space was found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_insert, FAIL) + FUNC_ENTER_NOAPI_TAG(H5HG_insert, dxpl_id, H5AC__GLOBALHEAP_TAG, FAIL) /* Check args */ HDassert(f); @@ -659,7 +659,7 @@ done: if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, heap->addr, heap, heap_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to unprotect heap.") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* H5HG_insert() */ @@ -690,7 +690,7 @@ H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/, void *orig_object = object; /* Keep a copy of the original object pointer */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_read, NULL) + FUNC_ENTER_NOAPI_TAG(H5HG_read, dxpl_id, H5AC__GLOBALHEAP_TAG, NULL) /* Check args */ HDassert(f); @@ -741,7 +741,7 @@ done: if(NULL == ret_value && NULL == orig_object && object) H5MM_free(object); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5HG_read() */ @@ -770,7 +770,7 @@ H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) unsigned heap_flags = H5AC__NO_FLAGS_SET; int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_link, FAIL) + FUNC_ENTER_NOAPI_TAG(H5HG_link, dxpl_id, H5AC__GLOBALHEAP_TAG, FAIL) /* Check args */ HDassert(f); @@ -800,7 +800,7 @@ done: if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5HG_link() */ @@ -833,7 +833,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) unsigned flags = H5AC__NO_FLAGS_SET;/* Whether the heap gets deleted */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5HG_remove, FAIL); + FUNC_ENTER_NOAPI_TAG(H5HG_remove, dxpl_id, H5AC__GLOBALHEAP_TAG, FAIL); /* Check args */ HDassert(f); @@ -905,7 +905,7 @@ done: if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL); } /* end H5HG_remove() */ @@ -2353,7 +2353,7 @@ H5L_delete_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name, H5L_trav_gvbi_t *udata = (H5L_trav_gvbi_t *)_udata; /* User data passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5L_delete_by_idx_cb) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5L_delete_by_idx_cb, udata->dxpl_id, obj_loc->oloc->addr, FAIL) /* Check if the name of the group resolved to a valid object */ if(obj_loc == NULL) @@ -2369,7 +2369,7 @@ done: * location for the object */ *own_loc = H5G_OWN_NONE; - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5L_delete_by_idx_cb() */ @@ -1231,11 +1231,17 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, oh->mesg[0].raw_size = size_hint - H5O_SIZEOF_MSGHDR_OH(oh); oh->mesg[0].chunkno = 0; + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(dxpl_id, oh_addr, FAIL); + /* Cache object header */ if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") oh = NULL; + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(FAIL); + /* Set up object location */ loc->file = f; loc->addr = oh_addr; @@ -1580,7 +1586,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) hbool_t deleted = FALSE; /* Whether the object was deleted */ int ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_link, FAIL) + FUNC_ENTER_NOAPI_TAG(H5O_link, dxpl_id, loc->addr, FAIL) /* check args */ HDassert(loc); @@ -1601,7 +1607,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_link() */ @@ -1631,7 +1637,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) unsigned file_intent; /* R/W intent on file */ H5O_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_protect, NULL) + FUNC_ENTER_NOAPI_TAG(H5O_protect, dxpl_id, loc->addr, NULL) /* check args */ HDassert(loc); @@ -1818,7 +1824,7 @@ done: 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") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5O_protect() */ @@ -2168,7 +2174,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) 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) + FUNC_ENTER_NOAPI_TAG(H5O_delete, dxpl_id, addr, FAIL) /* Check args */ HDassert(f); @@ -2194,7 +2200,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_delete() */ @@ -2261,7 +2267,7 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id) H5O_t *oh = NULL; /* Object header for location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_obj_type, FAIL) + FUNC_ENTER_NOAPI_TAG(H5O_obj_type, dxpl_id, loc->addr, FAIL) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) @@ -2275,7 +2281,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_obj_type() */ @@ -2339,7 +2345,7 @@ H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id) H5O_t *oh = NULL; /* Object header for location */ const H5O_obj_class_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_obj_class) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_obj_class, dxpl_id, loc->addr, NULL) /* Load the object header */ if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) @@ -2353,7 +2359,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5O_obj_class() */ @@ -2745,7 +2751,7 @@ H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info, H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_get_info, FAIL) + FUNC_ENTER_NOAPI_TAG(H5O_get_info, dxpl_id, loc->addr, FAIL) /* Check args */ HDassert(loc); @@ -2843,7 +2849,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_get_info() */ diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 158f795..8ff9cf6 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -427,10 +427,16 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, if(H5F_addr_defined(ainfo_src->fheap_addr)) { /* copy dense attribute */ + + /* Set copied metadata tag */ + H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL); if(H5A_dense_create(file_dst, dxpl_id, ainfo_dst) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") + /* Reset metadata tag */ + H5_END_TAG(NULL); + if((H5A_dense_copy_file_all(file_src, ainfo_src, file_dst, ainfo_dst, recompute_size, cpy_info, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") } /* end if */ diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index aa9e660..9f0f189 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -476,7 +476,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) H5A_t *exist_attr = NULL; /* Opened attribute object */ htri_t found_open_attr = FALSE; /* Whether opened object is found */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_open_by_name) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_attr_open_by_name, dxpl_id, loc->addr, NULL) /* Check arguments */ HDassert(loc); @@ -543,7 +543,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5O_attr_open_by_name() */ @@ -1157,7 +1157,7 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, H5O_ainfo_t ainfo; /* Attribute information for object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_rename) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_attr_rename, dxpl_id, loc->addr, FAIL) /* Check arguments */ HDassert(loc); @@ -1222,7 +1222,7 @@ done: if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_attr_rename */ @@ -1248,7 +1248,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_iterate_real) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_attr_iterate_real, dxpl_id, loc->addr, FAIL) /* Check arguments */ HDassert(loc); @@ -1309,7 +1309,7 @@ done: if(atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_attr_iterate_real() */ @@ -1544,7 +1544,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_remove) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_attr_remove, dxpl_id, loc->addr, FAIL) /* Check arguments */ HDassert(loc); @@ -1602,7 +1602,7 @@ done: if(oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_attr_remove() */ @@ -1629,7 +1629,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_remove_by_idx) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_attr_remove_by_idx, dxpl_id, loc->addr, FAIL) /* Check arguments */ HDassert(loc); @@ -1696,7 +1696,7 @@ done: if(atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_attr_remove_by_idx() */ @@ -1717,7 +1717,7 @@ H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_count_real) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_attr_count_real, dxpl_id, oh->cache_info.addr, FAIL) /* Check arguments */ HDassert(f); @@ -1750,7 +1750,7 @@ H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs) } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_attr_count_real */ @@ -1813,7 +1813,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_attr_exists) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_attr_exists, dxpl_id, loc->addr, FAIL) /* Check arguments */ HDassert(loc); @@ -1861,7 +1861,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_attr_exists */ diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 5def4f7..79c4442 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -97,7 +97,7 @@ 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) + FUNC_ENTER_NOAPI_TAG(H5O_chunk_add, dxpl_id, oh->cache_info.addr, FAIL) /* check args */ HDassert(f); @@ -127,7 +127,7 @@ done: if(chk_proxy) chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_chunk_add() */ @@ -151,7 +151,7 @@ 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) + FUNC_ENTER_NOAPI_TAG(H5O_chunk_protect, dxpl_id, oh->cache_info.addr, NULL) /* check args */ HDassert(f); @@ -196,7 +196,7 @@ H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) ret_value = chk_proxy; done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5O_chunk_protect() */ @@ -368,7 +368,7 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) 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) + FUNC_ENTER_NOAPI_TAG(H5O_chunk_delete, dxpl_id, oh->cache_info.addr, FAIL) /* check args */ HDassert(f); @@ -396,6 +396,6 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_chunk_delete() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 08ee56b..94f7d9a 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -307,7 +307,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, size_t msghdr_size; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5O_copy_header_real) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_copy_header_real, dxpl_id, oloc_src->addr, FAIL) HDassert(oloc_src); HDassert(oloc_src->file); @@ -727,10 +727,20 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, oh_dst->nlink += (unsigned)addr_map->inc_ref_count; } /* end if */ + /* Set metadata tag for destination object's object header */ + H5_BEGIN_TAG(dxpl_id, oloc_dst->addr, FAIL); + /* Insert destination object header in cache */ if(H5AC_set(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") oh_dst = NULL; + + /* Reset metadat tag */ + H5_END_TAG(FAIL); + + /* Retag all copied metadata to apply the destination object's tag */ + if(H5AC_retag_copied_metadata(oloc_dst->file, oloc_dst->addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to re-tag metadata entries") done: /* Free deleted array */ @@ -752,7 +762,7 @@ done: (obj_class->free_copy_file_udata)(udata); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_copy_header_real() */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 25cac88..0d71be9 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -460,7 +460,7 @@ H5O_efl_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t *file_dst, size_t idx, size, name_offset, heap_size; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_efl_copy_file) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_efl_copy_file, dxpl_id, H5AC__COPIED_TAG, NULL) /* check args */ HDassert(efl_src); @@ -520,7 +520,7 @@ done: if(efl_dst) H5MM_xfree(efl_dst); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5O_efl_copy_file() */ diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 891631f..7644131 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -385,7 +385,7 @@ H5O_linfo_copy_file(H5F_t UNUSED *file_src, void *native_src, H5F_t *file_dst, H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *) _udata; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_linfo_copy_file) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5O_linfo_copy_file, dxpl_id, H5AC__COPIED_TAG, NULL) /* check args */ HDassert(linfo_src); @@ -426,7 +426,7 @@ done: if(linfo_dst) linfo_dst = H5FL_FREE(H5O_linfo_t, linfo_dst); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* H5O_linfo_copy_file() */ @@ -465,11 +465,17 @@ H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy link") dst_lnk_init = TRUE; + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(udata->dxpl_id, H5AC__COPIED_TAG, FAIL); + /* Insert the new object in the destination file's group */ /* (Doesn't increment the link count - that's already been taken care of for hard links) */ if(H5G_dense_insert(udata->dst_oloc->file, udata->dxpl_id, udata->dst_linfo, &dst_lnk) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert destination link") + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(FAIL); + done: /* Check if the destination link has been initialized */ if(dst_lnk_init) diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 62a1e1c..0dd4565 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -318,7 +318,7 @@ H5O_msg_write_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_msg_write_oh, FAIL) + FUNC_ENTER_NOAPI_TAG(H5O_msg_write_oh, dxpl_id, oh->cache_info.addr, FAIL) /* check args */ HDassert(f); @@ -335,7 +335,7 @@ H5O_msg_write_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message") done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_msg_write_oh() */ @@ -467,7 +467,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, H5O_t *oh = NULL; /* Object header to use */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_msg_read, NULL) + FUNC_ENTER_NOAPI_TAG(H5O_msg_read, dxpl_id, loc->addr, NULL) /* check args */ HDassert(loc); @@ -487,7 +487,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, NULL) } /* end H5O_msg_read() */ @@ -875,7 +875,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) H5O_t *oh = NULL; /* Object header for location */ htri_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_msg_exists, FAIL) + FUNC_ENTER_NOAPI_TAG(H5O_msg_exists, dxpl_id, loc->addr, FAIL) HDassert(loc); HDassert(loc->file); @@ -893,7 +893,7 @@ done: 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) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5O_msg_exists() */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 4a9c2bb..ad7e594 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -623,8 +623,16 @@ H5O_shared_copy_file(H5F_t UNUSED *file_src, H5F_t *file_dst, /* Message is always shared in heap in dest. file because the dest. * object header doesn't quite exist yet - JML */ + + /* Set copied metadata tag */ + H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, FAIL); + if(H5SM_try_share(file_dst, dxpl_id, NULL, mesg_type->id, _native_dst, NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared") + + /* Reset metadata tag */ + H5_END_TAG(FAIL); + } /* end else */ done: diff --git a/src/H5Ostab.c b/src/H5Ostab.c index abc4739..4829e93 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -328,11 +328,17 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, /* Get the old local heap's size and use that as the hint for the new heap */ if(H5HL_get_size(file_src, dxpl_id, stab_src->heap_addr, &size_hint) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size") + + /* Set copy metadata tag */ + H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL); /* Create components of symbol table message */ if(H5G_stab_create_components(file_dst, stab_dst, size_hint, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") + /* Reset metadata tag */ + H5_END_TAG(NULL); + /* Set return value */ ret_value = stab_dst; diff --git a/src/H5Otest.c b/src/H5Otest.c index 77b7540..557ac9e 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -193,11 +193,17 @@ H5O_is_attr_empty_test(hid_t oid) if(H5F_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ HDassert(nattrs == 0); + + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); /* Open the name index v2 B-tree */ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(FAIL); + /* Retrieve # of records in name index */ if(H5B2_get_nrec(bt2_name, &nattrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") @@ -281,10 +287,16 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) /* Check for any messages in object header */ HDassert(obj_nattrs == 0); + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + /* Open the name index v2 B-tree */ if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(FAIL); + /* Retrieve # of records in name index */ if(H5B2_get_nrec(bt2_name, &obj_nattrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") @@ -345,6 +357,9 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + /* Set metadata tag in dxpl_id */ + H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + /* Get the object header */ if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC_READ))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") @@ -393,6 +408,9 @@ done: 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") + /* Reset metadata tag in dxpl_id */ + H5_END_TAG(FAIL); + FUNC_LEAVE_NOAPI(ret_value) } /* H5O_attr_dense_info_test() */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 1186868..042951e 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -34,6 +34,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ @@ -194,6 +195,7 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF; /* Default value for file driver ID */ void *def_vfl_info = H5D_XFER_VFL_INFO_DEF; /* Default value for file driver info */ size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */ + haddr_t metadata_tag = H5AC_METADATA_TAG_DEF; /* Default value for metadata tag */ #ifdef H5_HAVE_PARALLEL H5FD_mpio_xfer_t def_io_xfer_mode = H5D_XFER_IO_XFER_MODE_DEF; /* Default value for I/O transfer mode */ H5FD_mpio_chunk_opt_t def_mpio_chunk_opt_mode = H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF; @@ -213,6 +215,10 @@ H5P_dxfr_reg_prop(H5P_genclass_t *pclass) if(H5P_register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata tag property */ + if(H5P_register_real(pclass, H5AC_METADATA_TAG_NAME, H5AC_METADATA_TAG_SIZE, &metadata_tag, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the type conversion buffer property */ if(H5P_register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &def_tconv_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -131,7 +131,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d unsigned x; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5SM_init, NULL) + FUNC_ENTER_NOAPI_TAG(H5SM_init, dxpl_id, H5AC__SOHM_TAG, NULL) HDassert(f); /* File should not already have a SOHM table */ @@ -236,7 +236,7 @@ done: table = H5FL_FREE(H5SM_master_table_t, table); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_init() */ @@ -346,7 +346,7 @@ H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id) size_t u; /* Local index variable */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5SM_type_shared) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_type_shared, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Translate the H5O type_id into an H5SM type flag */ if(H5SM_type_to_flag(type_id, &type_flag) < 0) @@ -378,7 +378,7 @@ done: if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_type_shared() */ @@ -403,7 +403,7 @@ H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id, haddr_t *fheap_ad ssize_t index_num; /* Which index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5SM_get_fheap_addr, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_get_fheap_addr, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Sanity checks */ HDassert(f); @@ -428,7 +428,7 @@ done: if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_get_fheap_addr() */ @@ -630,7 +630,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id) haddr_t addr = HADDR_UNDEF; /* Address of the list on disk */ haddr_t ret_value; - FUNC_ENTER_NOAPI_NOINIT(H5SM_create_list) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_create_list, dxpl_id, H5AC__SOHM_TAG, HADDR_UNDEF) HDassert(f); HDassert(header); @@ -672,7 +672,7 @@ done: H5MF_xfree(f, H5FD_MEM_SOHM_INDEX, dxpl_id, addr, (hsize_t)header->list_size); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, HADDR_UNDEF) } /* end H5SM_create_list */ @@ -813,7 +813,7 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i haddr_t btree_addr; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5SM_convert_btree_to_list) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_convert_btree_to_list, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Remember the address of the old B-tree, but change the header over to be * a list.. @@ -846,7 +846,7 @@ done: if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to unprotect SOHM index") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_convert_btree_to_list() */ @@ -922,7 +922,7 @@ H5SM_can_share(H5F_t *f, hid_t dxpl_id, H5SM_master_table_t *table, htri_t tri_ret; htri_t ret_value = TRUE; - FUNC_ENTER_NOAPI(H5SM_can_share, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_can_share, dxpl_id, H5AC__SOHM_TAG, FAIL) /* "trivial" sharing checks */ if((tri_ret = H5SM_can_share_common(f, type_id, mesg)) < 0) @@ -967,7 +967,7 @@ done: if(my_table && my_table != table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, my_table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_can_share() */ @@ -1036,7 +1036,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, htri_t tri_ret; htri_t ret_value = TRUE; - FUNC_ENTER_NOAPI(H5SM_try_share, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_try_share, dxpl_id, H5AC__SOHM_TAG, FAIL) /* "trivial" sharing checks */ if(mesg_flags && (*mesg_flags & H5O_MSG_FLAG_DONTSHARE)) @@ -1090,7 +1090,7 @@ done: if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, cache_flags) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_try_share() */ @@ -1195,7 +1195,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, size_t empty_pos = UFAIL; /* Empty entry in list */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5SM_write_mesg) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_write_mesg, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Sanity check */ HDassert(header); @@ -1402,7 +1402,7 @@ done: if(encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_write_mesg() */ @@ -1436,7 +1436,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg) unsigned type_id; /* Message type ID to operate on */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(H5SM_delete, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_delete, dxpl_id, H5AC__SOHM_TAG, FAIL) HDassert(f); HDassert(f->shared->sohm_addr != HADDR_UNDEF); @@ -1493,7 +1493,7 @@ done: if(mesg_buf) mesg_buf = H5MM_xfree(mesg_buf); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_delete() */ @@ -1665,7 +1665,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id; /* Message type to operate on */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5SM_delete_from_index) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_delete_from_index, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Sanity check */ HDassert(f); @@ -1826,7 +1826,7 @@ done: if(encoding_buf && (NULL == *encoded_mesg || ret_value < 0)) encoding_buf = H5MM_xfree(encoding_buf); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_delete_from_index() */ @@ -1852,7 +1852,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) htri_t status; /* Status for message existing */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5SM_get_info, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_get_info, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Sanity check */ HDassert(ext_loc); @@ -1941,7 +1941,7 @@ done: if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_get_info() */ @@ -2039,7 +2039,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id, void * encoding_buf = NULL; /* Buffer for encoded message */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5SM_get_refcount) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_get_refcount, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Sanity check */ HDassert(f); @@ -2133,7 +2133,7 @@ done: if(encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_get_refcount() */ @@ -2257,7 +2257,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *oh = NULL; /* Object header for message in object header */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5SM_read_mesg) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_read_mesg, dxpl_id, H5AC__SOHM_TAG, FAIL) HDassert(f); HDassert(mesg); @@ -2331,7 +2331,7 @@ done: if(ret_value < 0 && udata.encoding_buf) udata.encoding_buf = H5MM_xfree(udata.encoding_buf); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_read_mesg */ @@ -2417,7 +2417,7 @@ H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr, unsigned x; /* Counter variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5SM_table_debug, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_table_debug, dxpl_id, H5AC__SOHM_TAG, FAIL) HDassert(f); HDassert(table_addr != HADDR_UNDEF); @@ -2478,7 +2478,7 @@ done: if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_table_debug() */ @@ -2508,7 +2508,7 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr, unsigned x; /* Counter variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5SM_list_debug, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_list_debug, dxpl_id, H5AC__SOHM_TAG, FAIL) HDassert(f); HDassert(list_addr != HADDR_UNDEF); @@ -2568,7 +2568,7 @@ done: if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_list_debug() */ @@ -2595,10 +2595,10 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info) H5SM_table_cache_ud_t cache_udata; /* User-data for callback */ H5HF_t *fheap = NULL; /* Fractal heap handle */ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5SM_ih_size, FAIL) + FUNC_ENTER_NOAPI_TAG(H5SM_ih_size, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Sanity check */ HDassert(f); @@ -2665,6 +2665,6 @@ done: if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_ih_size() */ diff --git a/src/H5SMtest.c b/src/H5SMtest.c index a22e9cc..5f4a89b 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -82,7 +82,7 @@ H5SM_get_mesg_count_test(H5F_t *f, hid_t dxpl_id, unsigned type_id, H5SM_master_table_t *table = NULL; /* SOHM master table */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5SM_get_mesg_count_test) + FUNC_ENTER_NOAPI_NOINIT_TAG(H5SM_get_mesg_count_test, dxpl_id, H5AC__SOHM_TAG, FAIL) /* Sanity check */ HDassert(f); @@ -118,6 +118,6 @@ done: if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, f->shared->sohm_addr, table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5SM_get_mesg_count_test() */ diff --git a/src/H5err.txt b/src/H5err.txt index 891638a..71d27a6 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -156,6 +156,7 @@ MINOR, ATOM, H5E_NOIDS, Out of IDs for group # Cache related errors MINOR, CACHE, H5E_CANTFLUSH, Unable to flush data from cache MINOR, CACHE, H5E_CANTSERIALIZE, Unable to serialize data from cache +MINOR, CACHE, H5E_CANTTAG, Unable to tag metadata in the cache MINOR, CACHE, H5E_CANTLOAD, Unable to load metadata into cache MINOR, CACHE, H5E_PROTECT, Protected metadata error MINOR, CACHE, H5E_NOTCACHED, Metadata not currently cached diff --git a/src/H5private.h b/src/H5private.h index b606407..7666d31 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1934,6 +1934,30 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \ { +/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI + * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set + * up a metadata tag. */ +#define FUNC_ENTER_NOAPI_TAG(func_name, dxpl_id, tag, err) { \ + FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ + \ + haddr_t prev_tag = HADDR_UNDEF; \ + hid_t tag_dxpl_id = dxpl_id; \ + if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ + { + +#define FUNC_ENTER_NOAPI_NOINIT_TAG(func_name, dxpl_id, tag, err) { \ + FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ + haddr_t prev_tag = HADDR_UNDEF; \ + hid_t tag_dxpl_id = dxpl_id; \ + if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + H5_PUSH_FUNC(#func_name) \ + { + + /*------------------------------------------------------------------------- * Purpose: Register function exit for code profiling. This should be * the last statement executed by a function. @@ -1989,6 +2013,16 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ +/* Use this macro when exiting a function that set up a metadata tag */ +#define FUNC_LEAVE_NOAPI_TAG(ret_value, err) \ + \ + if(H5AC_tag(tag_dxpl_id, prev_tag, NULL)<0) \ + HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + \ + H5_POP_FUNC \ + return(ret_value); \ + } /*end scope from end of FUNC_ENTER*/ \ +} /*end scope from beginning of FUNC_ENTER*/ /****************************************/ /* Revisions to FUNC_ENTER/LEAVE Macros */ @@ -2252,6 +2286,17 @@ func_init_failed: \ /* Close Function */ \ } +/* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient) */ +#define H5_BEGIN_TAG(dxpl, tag, err) { \ + haddr_t prv_tag = HADDR_UNDEF; \ + hid_t my_dxpl_id = dxpl; \ + if(H5AC_tag(my_dxpl_id, tag, &prv_tag) < 0) \ + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") + +#define H5_END_TAG(err) \ + if(H5AC_tag(my_dxpl_id, prv_tag, NULL) <0) \ + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ +} /* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ /* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 70f85c2..b0269f2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -81,6 +81,7 @@ SET (H5_TESTS gheap #cache #cache_api + #cache_tagging pool hyperslab istore @@ -141,12 +142,20 @@ TARGET_LINK_LIBRARIES (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache COMMAND $<TARGET_FILE:cache>) +#-- Adding test for cache_api ADD_EXECUTABLE (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) H5_NAMING (cache_api) TARGET_LINK_LIBRARIES (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME cache_api COMMAND $<TARGET_FILE:cache_api>) +#-- Adding test for cache_tagging +ADD_EXECUTABLE (cache_tagging ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) +H5_NAMING (cache_tagging) +TARGET_LINK_LIBRARIES (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + +ADD_TEST (NAME cache_tagging COMMAND $<TARGET_FILE:cache_tagging>) + #-- Adding test for ttsafe SET (ttsafe_SRCS ttsafe.c diff --git a/test/Makefile.am b/test/Makefile.am index d342c17..043e05d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -36,7 +36,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) # These tests (fheap, btree2) are under development and are not used by # the library yet. Move them to the end so that their failure do not block # other current library code tests. -TEST_PROG=testhdf5 lheap ohdr stab gheap cache cache_api \ +TEST_PROG=testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \ fillval mount flush1 flush2 app_ref enum \ diff --git a/test/Makefile.in b/test/Makefile.in index b31652b..38b63da 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -77,17 +77,18 @@ am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS) am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) cache_api$(EXEEXT) \ - pool$(EXEEXT) hyperslab$(EXEEXT) istore$(EXEEXT) \ - bittests$(EXEEXT) dt_arith$(EXEEXT) dtypes$(EXEEXT) \ - dsets$(EXEEXT) cmpd_dset$(EXEEXT) extend$(EXEEXT) \ - external$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \ - unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \ - mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \ - app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ - ttsafe$(EXEEXT) getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) \ - dangle$(EXEEXT) dtransform$(EXEEXT) reserved$(EXEEXT) \ - cross_read$(EXEEXT) freespace$(EXEEXT) mf$(EXEEXT) \ - farray$(EXEEXT) earray$(EXEEXT) btree2$(EXEEXT) fheap$(EXEEXT) + cache_tagging$(EXEEXT) pool$(EXEEXT) hyperslab$(EXEEXT) \ + istore$(EXEEXT) bittests$(EXEEXT) dt_arith$(EXEEXT) \ + dtypes$(EXEEXT) dsets$(EXEEXT) cmpd_dset$(EXEEXT) \ + extend$(EXEEXT) external$(EXEEXT) objcopy$(EXEEXT) \ + links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) \ + fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \ + flush2$(EXEEXT) app_ref$(EXEEXT) enum$(EXEEXT) \ + set_extent$(EXEEXT) ttsafe$(EXEEXT) getname$(EXEEXT) \ + vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ + dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \ + freespace$(EXEEXT) mf$(EXEEXT) farray$(EXEEXT) earray$(EXEEXT) \ + btree2$(EXEEXT) fheap$(EXEEXT) am__EXEEXT_2 = gen_bad_ohdr$(EXEEXT) gen_bogus$(EXEEXT) \ gen_cross$(EXEEXT) gen_deflate$(EXEEXT) gen_filters$(EXEEXT) \ gen_new_array$(EXEEXT) gen_new_fill$(EXEEXT) \ @@ -121,6 +122,10 @@ cache_api_SOURCES = cache_api.c cache_api_OBJECTS = cache_api.$(OBJEXT) cache_api_LDADD = $(LDADD) cache_api_DEPENDENCIES = libh5test.la $(LIBHDF5) +cache_tagging_SOURCES = cache_tagging.c +cache_tagging_OBJECTS = cache_tagging.$(OBJEXT) +cache_tagging_LDADD = $(LDADD) +cache_tagging_DEPENDENCIES = libh5test.la $(LIBHDF5) cmpd_dset_SOURCES = cmpd_dset.c cmpd_dset_OBJECTS = cmpd_dset.$(OBJEXT) cmpd_dset_LDADD = $(LDADD) @@ -399,6 +404,21 @@ DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \ set_extent.c space_overflow.c stab.c tcheck_version.c \ $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ vfd.c +DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \ + btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \ + cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \ + earray.c enum.c err_compat.c error_test.c extend.c external.c \ + farray.c fheap.c fillval.c flush1.c flush2.c freespace.c \ + gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \ + gen_filespace.c gen_filters.c gen_idx.c gen_new_array.c \ + gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \ + gen_noencoder.c gen_nullspace.c gen_specmetaread.c \ + gen_udlinks.c getname.c gheap.c hyperslab.c istore.c lheap.c \ + links.c mf.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \ + reserved.c set_extent.c space_overflow.c stab.c \ + swmr_generator.c swmr_reader.c swmr_writer.c tcheck_version.c \ + $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ + vfd.c ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -703,7 +723,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) # These tests (fheap, btree2) are under development and are not used by # the library yet. Move them to the end so that their failure do not block # other current library code tests. -TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api \ +TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \ fillval mount flush1 flush2 app_ref enum \ @@ -852,6 +872,9 @@ cache$(EXEEXT): $(cache_OBJECTS) $(cache_DEPENDENCIES) cache_api$(EXEEXT): $(cache_api_OBJECTS) $(cache_api_DEPENDENCIES) @rm -f cache_api$(EXEEXT) $(LINK) $(cache_api_OBJECTS) $(cache_api_LDADD) $(LIBS) +cache_tagging$(EXEEXT): $(cache_tagging_OBJECTS) $(cache_tagging_DEPENDENCIES) + @rm -f cache_tagging$(EXEEXT) + $(LINK) $(cache_tagging_OBJECTS) $(cache_tagging_LDADD) $(LIBS) cmpd_dset$(EXEEXT): $(cmpd_dset_OBJECTS) $(cmpd_dset_DEPENDENCIES) @rm -f cmpd_dset$(EXEEXT) $(LINK) $(cmpd_dset_OBJECTS) $(cmpd_dset_LDADD) $(LIBS) @@ -1037,6 +1060,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_api.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_common.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_tagging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cross_read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@ diff --git a/test/btree2.c b/test/btree2.c index eabd208..1d1796c 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -107,6 +107,11 @@ create_file(hid_t *file, H5F_t **f, hid_t fapl) if(NULL == (*f = (H5F_t *)H5I_object(*file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(*f) < 0) { + STACK_ERROR + } + /* Success */ return(0); @@ -2804,6 +2809,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR @@ -2838,6 +2848,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR @@ -6363,6 +6378,11 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, bt2_addr) < 0) TEST_ERROR @@ -6514,6 +6534,11 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Re-shuffle record #'s */ for(u = 0; u < INSERT_MANY; u++) { hsize_t temp_rec; /* Temporary record */ @@ -6605,6 +6630,11 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR @@ -6689,6 +6719,11 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR @@ -6770,6 +6805,11 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) FAIL_STACK_ERROR @@ -7116,6 +7156,11 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR @@ -7156,6 +7201,11 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR @@ -7209,6 +7259,11 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR @@ -7262,6 +7317,11 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) { + STACK_ERROR + } + /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR diff --git a/test/cache_common.c b/test/cache_common.c index 3de01c5..312de3d 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -2689,6 +2689,9 @@ setup_cache(size_t max_cache_size, if ( pass ) { + /* Need to set this else all cache tests will fail */ + cache_ptr->ignore_tags = TRUE; + H5C_stats__reset(cache_ptr); H5C_set_skip_flags(cache_ptr, TRUE, TRUE); diff --git a/test/cache_tagging.c b/test/cache_tagging.c new file mode 100644 index 0000000..4ec256e --- /dev/null +++ b/test/cache_tagging.c @@ -0,0 +1,3990 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Mike McGreevy + * January 25, 2010 + * + * This file contains tests for metadata tagging. + */ +#include "hdf5.h" +#include "testhdf5.h" +#include "h5test.h" +#include "H5Iprivate.h" +#include "H5ACprivate.h" +#include "H5ACpublic.h" +#include "cache_common.h" +#include "H5HLprivate.h" + +/* ============ */ +/* Test Defines */ +/* ============ */ + +#define FILENAME "tagging_test.h5" +#define FILENAME2 "tagging_ext_test.h5" +#define GROUPNAME "Group" +#define GROUPNAMEPATH "/Group" +#define GROUPNAMECOPY "GroupCopy" +#define ATTRNAME "Attribute 1" +#define ATTRNAME3 "Attribute 3" +#define DATASETNAME "Dataset" +#define DATASETNAME2 "Dataset2" +#define LINKNAME "Link" +#define RANK 2 +#define DIMS 32 + +#define MULTIGROUPS 10 + +#define TEST_DEFAULT 0 +#define TEST_SHMESG 1 +#define NUM_TEST_TYPES 2 + +/* ===================== */ +/* Function Declarations */ +/* ===================== */ + +/* Helper Functions */ +static void print_entry_type_to_screen(int id); +static int print_index(hid_t fid); +static int verify_no_unknown_tags(hid_t fid); +static int mark_all_entries_investigated(hid_t fid); +static int verify_tag(hid_t fid, int id, haddr_t tag); +static int get_new_object_header_tag(hid_t fid, haddr_t *tag); +/* Tests */ +static unsigned check_file_creation_tags(hid_t fcpl_id, int type); +static unsigned check_file_open_tags(hid_t fcpl, int type); +static unsigned check_group_creation_tags(hid_t fcpl, int type); +static unsigned check_multi_group_creation_tags(hid_t fcpl, int type); +static unsigned check_group_open_tags(hid_t fcpl, int type); +static unsigned check_attribute_creation_tags(hid_t fcpl, int type); +static unsigned check_attribute_open_tags(hid_t fcpl, int type); +static unsigned check_attribute_write_tags(hid_t fcpl, int type); +static unsigned check_attribute_delete_tags(hid_t fcpl, int type); +static unsigned check_attribute_rename_tags(hid_t fcpl, int type); +static unsigned check_dataset_creation_tags(hid_t fcpl, int type); +static unsigned check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type); +static unsigned check_dataset_open_tags(hid_t fcpl, int type); +static unsigned check_dataset_write_tags(hid_t fcpl, int type); +static unsigned check_dataset_read_tags(hid_t fcpl, int type); +static unsigned check_dataset_size_retrieval(hid_t fcpl, int type); +static unsigned check_dataset_extend_tags(hid_t fcpl, int type); +static unsigned check_object_info_tags(hid_t fcpl, int type); +static unsigned check_link_removal_tags(hid_t fcpl, int type); +static unsigned check_link_getname_tags(hid_t fcpl, int type); +static unsigned check_external_link_creation_tags(hid_t fcpl, int type); +static unsigned check_external_link_open_tags(hid_t fcpl, int type); +static unsigned check_object_copy_tags(hid_t fcpl, int type); + +static unsigned check_dense_attribute_tags(void); +static unsigned check_link_iteration_tags(void); +static unsigned check_invalid_tag_application(void); + + +/* ================ */ +/* Helper Functions */ +/* ================ */ + + +/*------------------------------------------------------------------------- + * + * Function: print_entry_type_to_screen + * + * Purpose: DEBUG CODE (for when verbose is set). + * + * Prints type of entry to stdout. + * + * Return: void + * + * Programmer: Mike McGreevy + * September 3, 2009 + * + *------------------------------------------------------------------------- + */ +static void +print_entry_type_to_screen(int id) +{ + printf("Type = "); + + switch (id) { + + case 0: + printf("B-tree Node"); + break; + case 1: + printf("Symbol Table Node"); + break; + case 2: + printf("Local Heap Prefix"); + break; + case 3: + printf("Local Heap Data Block"); + break; + case 4: + printf("Global Heap"); + break; + case 5: + printf("Object Header"); + break; + case 6: + printf("Object Header Chunk"); + break; + case 7: + printf("v2 B-tree Header"); + break; + case 8: + printf("v2 B-tree Internal Node"); + break; + case 9: + printf("v2 B-tree Leaf Node"); + break; + case 10: + printf("Fractal Heap Header"); + break; + case 11: + printf("Fractal Heap Direct Block"); + break; + case 12: + printf("Fractal Heap Indirect Block"); + break; + case 13: + printf("Free Space Header"); + break; + case 14: + printf("Free Space Section"); + break; + case 15: + printf("Shared Object Header Message Master Table"); + break; + case 16: + printf("Shared Message Index Stored As A List"); + break; + case 17: + printf("Extensible Array Header"); + break; + case 18: + printf("Extensible Array Index Block"); + break; + case 19: + printf("Extensible Array Super Block"); + break; + case 20: + printf("Extensible Array Data Block"); + break; + case 21: + printf("Extensible Array Data Block Page"); + break; + case 22: + printf("Chunk Proxy"); + break; + case 23: + printf("Fixed Array Header"); + break; + case 24: + printf("Fixed Array Data Block"); + break; + case 25: + printf("Fixed Array Data Block Page"); + break; + case 26: + printf("File Superblock"); + break; + case 27: + printf("Test Entry"); + break; + case 28: + printf("Number of Types"); + break; + default: + printf("*Unknown*"); + break; + + } /* end switch */ + +} /* print_entry_type_to_screen */ + + +/*------------------------------------------------------------------------- + * Function: print_index() + * + * Purpose: DEBUG CODE (for when verbose is set). + * + * Prints cache index to screen, including address of entries, + * tag values of entries, and entry types. + * + * Return: void + * + * Programmer: Mike McGreevy + * January 25, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int print_index(hid_t fid) { + + H5F_t * f = NULL; /* File Pointer */ + H5C_t * cache_ptr = NULL; /* Cache Pointer */ + int i = 0; /* Iterator */ + H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */ + + /* Get Internal File / Cache Pointers */ + if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + cache_ptr = f->shared->cache; + + /* Initial (debugging) loop */ + printf("CACHE SNAPSHOT:\n"); + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { + next_entry_ptr = cache_ptr->index[i]; + + while (next_entry_ptr != NULL) { + printf("Addr = %u, ", (unsigned int)next_entry_ptr->addr); + printf("Tag = %u, ", (unsigned int)next_entry_ptr->tag); + printf("Dirty = %d, ", (int)next_entry_ptr->is_dirty); + printf("Protected = %d, ", (int)next_entry_ptr->is_protected); + print_entry_type_to_screen(next_entry_ptr->type->id); + printf("\n"); + next_entry_ptr = next_entry_ptr->ht_next; + } /* end if */ + + } /* end for */ + printf("\n"); + + return 0; + +error: + + return -1; + +} /* print_index */ + + +/*------------------------------------------------------------------------- + * Function: verify_no_unknown_tags() + * + * Purpose: Verifies that all tags in the provided cache are set to the + * H5AC__IGNORE_TAG. Other verification functions in this test + * file set entry tag values to ignore after checking them, so + * this is handy to verify that tests have checked all entries + * in the cache. + * + * Return: 0 on Success, -1 on Failure + * + * Programmer: Mike McGreevy + * January 25, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int verify_no_unknown_tags(hid_t fid) +{ + + H5F_t * f = NULL; /* File Pointer */ + H5C_t * cache_ptr = NULL; /* Cache Pointer */ + int i = 0; /* Iterator */ + H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */ + + /* Get Internal File / Cache Pointers */ + if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + cache_ptr = f->shared->cache; + + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + next_entry_ptr = cache_ptr->index[i]; + + while (next_entry_ptr != NULL) { + + if ( next_entry_ptr->tag != H5AC__IGNORE_TAG ) TEST_ERROR; + + next_entry_ptr = next_entry_ptr->ht_next; + + } /* end if */ + + } /* for */ + + return 0; + +error: + return -1; +} /* verify_no_unknown_tags */ + + +/*------------------------------------------------------------------------- + * Function: mark_all_entries_investigated() + * + * Purpose: Marks all entries in the cache with the tag H5AC__IGNORE_TAG, + * which is a convention in this test file that indicates that + * a tag has been checked and is valid. This may come in handy + * for tests that have a lot of setup that has been checked + * for correctness elsewhere, so should save time in not having + * to check the same sort of tag application in many places. + * + * Return: 0 on Success, -1 on Failure + * + * Programmer: Mike McGreevy + * February 3, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int mark_all_entries_investigated(hid_t fid) +{ + + H5F_t * f = NULL; /* File Pointer */ + H5C_t * cache_ptr = NULL; /* Cache Pointer */ + int i = 0; /* Iterator */ + H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */ + + /* Get Internal File / Cache Pointers */ + if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + cache_ptr = f->shared->cache; + + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + next_entry_ptr = cache_ptr->index[i]; + + while (next_entry_ptr != NULL) { + + if ( next_entry_ptr->tag != H5AC__IGNORE_TAG ) { + + next_entry_ptr->tag = H5AC__IGNORE_TAG; + + } /* end if */ + + next_entry_ptr = next_entry_ptr->ht_next; + + } /* end if */ + + } /* for */ + + return 0; + +error: + return -1; + +} /* mark_all_entries_investigated */ + + +/*------------------------------------------------------------------------- + * Function: verify_tag() + * + * Purpose: Asserts that there is an entry in the specified cache with + * the provided entry id and provided tag. The function will + * fail if this is not the case. If found, this function will + * set the entry's tag value to ignore, so future verification + * attemps can skip over this entry, knowing it has already been + * checked. + * + * Return: 0 on Success, -1 on Failure + * + * Programmer: Mike McGreevy + * January 25, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int verify_tag(hid_t fid, int id, haddr_t tag) +{ + int i = 0; /* Iterator */ + H5C_cache_entry_t *entry_ptr = NULL; /* Entry Pointer */ + int found = FALSE; /* If Entry Found */ + H5F_t * f = NULL; /* File Pointer */ + H5C_t * cache_ptr = NULL; /* Cache Pointer */ + H5C_cache_entry_t *next_entry_ptr = NULL; /* entry pointer */ + + /* Get Internal File / Cache Pointers */ + if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + cache_ptr = f->shared->cache; + + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + next_entry_ptr = cache_ptr->index[i]; + + while (next_entry_ptr != NULL) { + + if ( (next_entry_ptr->type->id == id) && (next_entry_ptr->tag != H5AC__IGNORE_TAG) ) { + + if (!found) { + + if (next_entry_ptr->tag != tag) TEST_ERROR; + + /* note that we've found the entry */ + found = TRUE; + + /* Ignore this tag now that we've verified it was initially tagged correctly. */ + next_entry_ptr->tag = H5AC__IGNORE_TAG; + + } + + } /* end if */ + + next_entry_ptr = next_entry_ptr->ht_next; + + } /* end if */ + + } /* for */ + + if (found == FALSE) TEST_ERROR; + + return 0; + +error: + return -1; +} /* verify_tag */ + +static int evict_entries(hid_t fid) +{ + + H5F_t * f = NULL; /* File Pointer */ + + /* Get Internal File / Cache Pointers */ + if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + + /* Mark all entries investigated */ + mark_all_entries_investigated(fid); + + /* Evict all we can from the cache to examine full tag creation tree */ + /* This function will likely return failure since the root group + * is still protected. Thus, don't check its return value. */ + H5C_flush_cache(f, H5P_DEFAULT, H5P_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + + return 0; + +error: + + return -1; + +} /* evict entries */ + + +/*------------------------------------------------------------------------- + * Function: get_new_object_header_tag() + * + * Purpose: This function retrieves the tag associated with the latest + * uninvestigated object header it finds in the provided cache + * and returns it in *tag. It sets the object header's entry + * tag value to ignore, so future searches won't find it. + * + * Return: 0 on Success; 1 on Failure + * + * Programmer: Mike McGreevy + * January 25, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int get_new_object_header_tag(hid_t fid, haddr_t *tag) +{ + H5F_t * f = NULL; /* File Pointer */ + H5C_t * cache_ptr = NULL; /* Cache Pointer */ + int i = 0; /* Iterator */ + H5C_cache_entry_t * next_entry_ptr = NULL; /* Entry Pointer */ + int found = FALSE; /* If entry is found */ + + /* Get Internal File / Cache Pointers */ + if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + cache_ptr = f->shared->cache; + + for (i = 0; i < H5C__HASH_TABLE_LEN; i++) { + + next_entry_ptr = cache_ptr->index[i]; + + while (next_entry_ptr != NULL) { + + if ( (next_entry_ptr->tag != H5AC__IGNORE_TAG) && (next_entry_ptr->type->id == H5AC_OHDR_ID) ) { + + *tag = next_entry_ptr->tag; + next_entry_ptr->tag = H5AC__IGNORE_TAG; + found = TRUE; + break; + + } /* end if */ + + next_entry_ptr = next_entry_ptr->ht_next; + + } /* end if */ + + if (found) break; + + } /* end for */ + + if (found == FALSE) TEST_ERROR; + + return 0; + +error: + return -1; +} /* get_new_object_header_tag */ + +/* ============== */ +/* Test Functions */ +/* ============== */ + + +/*------------------------------------------------------------------------- + * Function: check_file_creation_tags + * + * Purpose: This function verifies the correct application of tags + * during file creation. + * + * Return: 0 on Success; 1 on Failure + * + * Programmer: Mike McGreevy + * January 25, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_file_creation_tags(hid_t fcpl_id, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + int verbose = FALSE; /* verbose test outout */ + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + + /* Testing Macro */ + TESTING("tag application during file creation"); + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* if verbose, print cache index to screen before verification . */ + if ( verbose ) print_index(fid); + + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of superblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + /* verify object header chunk belonging to superblock extension */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, sbe_tag) < 0 ) TEST_ERROR; + + /* verify sohm master table with sohm tag */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify there is a superblock entry with superblock tag */ + if ( verify_tag(fid, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0 ) TEST_ERROR; + + /* verify local heap prefix belonging to root group */ + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify b-tree node belonging to root group */ + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify no other cache entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* Close the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + PASSED(); + return 0; + +error: + return 1; + +} /* check_file_creation_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_file_open_tags + * + * Purpose: This function verifies the correct application of tags + * during file open. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * January 25, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_file_open_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + int verbose = FALSE; /* verbose file outout */ + haddr_t root_tag; /* Root Group Tag */ + haddr_t sbe_tag; /* Sblock Extension Tag */ + + /* Testing Macro */ + TESTING("tag application during file open"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Close the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* =================== */ + /* TEST: Open The File */ + /* =================== */ + if ( (fid = H5Fopen(FILENAME, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen before verification . */ + if ( verbose ) print_index(fid); + + /* verify there is a superblock entry with superblock tag. */ + if ( verify_tag(fid, H5AC_SUPERBLOCK_ID, H5AC__SUPERBLOCK_TAG) < 0 ) TEST_ERROR; + + /* Verify test-type-dependent tags */ + if ( type == TEST_DEFAULT ) { + + /* verify there is an object header belonging to the root group. */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* verify there is a superblock extension object header. */ + if ( verify_tag(fid, H5AC_OHDR_ID, sbe_tag) < 0 ) TEST_ERROR; + + /* verify sohm master table with sohm tag */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify object header chunk belonging to superblock extension */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, sbe_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* ========== */ + /* Close file */ + /* ========== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_file_open_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_group_creation_tags + * + * Purpose: This function verifies the correct application of tags + * during group creation. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * January 27, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_group_creation_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + int verbose = FALSE; /* verbose file outout */ + haddr_t root_tag; /* Root Group Tag */ + haddr_t g_tag; /* Group Tag */ + haddr_t sbe_tag; /* Sblock Extension Tag */ + + /* Testing Macro */ + TESTING("tag application during group creation"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ==================== */ + /* TEST: Create a Group */ + /* ==================== */ + + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group's tagged metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* Verify new group's tagged metadata */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify no other cache entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_group_creation_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_multi_group_creation_tags + * + * Purpose: This function verifies the correct application of tags + * during multiple group creation. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 2, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_multi_group_creation_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + int verbose = FALSE; /* verbose file outout */ + char gname[10]; /* group name buffer */ + int i = 0; /* iterator */ + hid_t fapl = -1; /* File access prop list */ + haddr_t g_tag = 0; /* Group tag value */ + haddr_t root_tag = 0; /* Root group tag value */ + haddr_t sbe_tag = 0; /* Root group tag value */ + + /* Testing Macro */ + TESTING("tag application during multiple group creation"); + + /* Create Fapl */ + if ( (fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) TEST_ERROR; + + /* Set latest version of library */ + if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; + + /* =========== */ + /* Create File */ + /* =========== */ + + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Clear Metadata Tags (don't care about them for this test */ + mark_all_entries_investigated(fid); + + /* ============ */ + /* Create Group */ + /* ============ */ + + for (i = 0; i < MULTIGROUPS; i++) { + + sprintf(gname, "%d", i); + if ( (gid = H5Gcreate(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + + } /* end for */ + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify there is an object header for each group */ + for (i = 0; i < MULTIGROUPS; i++) { + + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + } /* end for */ + + /* Verify free space header and section info */ + if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + + /* verify fractal heap header belonging to root group */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify fractal heap direct block belonging to root group */ + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify btree header and leaf node belonging to root group */ + if ( verify_tag(fid, H5AC_BT2_HDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_multi_group_creation_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_link_iteration_tags + * + * Purpose: This function verifies the correct application of tags + * during iteration over links in a group. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 2, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_link_iteration_tags(void) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t sid = -1; /* Group Identifier */ + hid_t did = -1; /* Group Identifier */ + int verbose = FALSE; /* verbose file outout */ + int i = 0; /* iterator */ + haddr_t root_tag = 0; /* Root Group Tag Value */ + char dsetname[500]; /* Name of dataset */ + H5G_info_t ginfo; /* Group Info Struct */ + hid_t root_group = -1; /* Root Group Identifier */ + + /* Testing Macro */ + TESTING("tag application during iteration over links in a group"); + + /* =========== */ + /* Create File */ + /* =========== */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Get root group tag */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + /* Create dataspace */ + if ( (sid = H5Screate(H5S_SCALAR)) < 0 ) TEST_ERROR; + + /* Create many datasets in root group */ + for (i=0;i<500;i++) { + + sprintf(dsetname, "Dset %d", i); + if ( (did = H5Dcreate2(fid, dsetname, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Dclose(did) < 0 ) TEST_ERROR; + } + + /* Close and Reopen the file (to clear cache) */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + /* clear remaining metadata tags */ + mark_all_entries_investigated(fid); + + /* ================================ */ + /* Iterate over links in root group */ + /* ================================ */ + + /* Open root group */ + if ( (root_group = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Get root group info (will iterate over all links in group) */ + if ( H5Gget_info(root_group, &ginfo) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify 112 symbol table nodes belonging to the root group */ + for (i = 0; i < 112; i++) { + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + } + + /* Verify 9 b-tree nodes belonging to the root group */ + for (i = 0; i < 9; i++) { + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + } + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Sclose(sid) < 0 ) TEST_ERROR; + if ( H5Gclose(root_group) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_link_iteration_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_dense_attribute_tags + * + * Purpose: This function verifies the correct application of tags + * during various dense attribute manipulations. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 2, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dense_attribute_tags(void) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t aid = -1; /* File Identifier */ + hid_t sid = -1; /* Group Identifier */ + hid_t did = -1; /* Group Identifier */ + hid_t dcpl = -1; /* Group Identifier */ + int verbose = FALSE; /* verbose file outout */ + int i = 0; /* iterator */ + hid_t fapl = -1; /* File access property list */ + haddr_t d_tag = 0; /* Dataset tag value */ + haddr_t root_tag = 0; /* Root group tag value */ + char attrname[500]; /* Name of attribute */ + + /* Testing Macro */ + TESTING("tag application during dense attribute manipulation"); + + /* Create Fapl */ + if ( (fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 ) TEST_ERROR; + if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; + + /* Create Dcpl */ + if ( (dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0 ) TEST_ERROR; + + /* =========== */ + /* Create File */ + /* =========== */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; + + /* Get root group tag */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + /* Create dataspace */ + if ( (sid = H5Screate(H5S_SCALAR)) < 0 ) TEST_ERROR; + + /* Create dataset */ + if ( (did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* get dataset object header */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* Clear Metadata Tags (don't care about them for this test */ + mark_all_entries_investigated(fid); + + /* ================================================ */ + /* Create Many attributes, triggering dense storage */ + /* ================================================ */ + + for (i=0;i<50;i++) { + + sprintf(attrname, "attr %d", i); + if ( (aid = H5Acreate2(did, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0 ) TEST_ERROR; + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + + } /* end for */ + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify free space header and section info */ + if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + + /* verify fractal heap header belonging to dataset */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify fractal heap direct block belonging to root group */ + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FHEAP_IBLOCK_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify btree header and leaf node belonging to dataset */ + if ( verify_tag(fid, H5AC_BT2_HDR_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_INT_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ======================= */ + /* Reopen file and dataset */ + /* ======================= */ + + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Clear Metadata Tags (don't care about them for this test */ + mark_all_entries_investigated(fid); + + /* ======================= */ + /* Open attribute by index */ + /* ======================= */ + + if ( (aid = H5Aopen_by_idx(did, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)4, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* verify fractal heap header belonging to dataset */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify fractal heap direct block belonging to root group */ + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FHEAP_IBLOCK_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify btree header and leaf node belonging to dataset */ + if ( verify_tag(fid, H5AC_BT2_HDR_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, d_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_INT_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dense_attribute_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_group_open_tags + * + * Purpose: This function verifies the correct application of tags + * during group open. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * January 27, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_group_open_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + int verbose = FALSE; /* verbose file output */ + haddr_t root_tag; + haddr_t sbe_tag; + haddr_t g_tag; + + /* Testing Macro */ + TESTING("tag application during group open"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Close Group */ + if (H5Gclose(gid) < 0) TEST_ERROR; + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ================ */ + /* TEST: Open Group */ + /* ================ */ + + if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* Verify opened group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_group_open_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_attribute_creation_tags + * + * Purpose: This function verifies the correct application of tags + * during attribute creation. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 24, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_attribute_creation_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t aid = -1; /* Attribute Identifier */ + hid_t gid = -1; /* Group Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + haddr_t root_tag = 0; /* Root group tag */ + haddr_t sbe_tag = 0; + haddr_t g_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during attribute creation"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and group */ + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ========================= */ + /* Create Attribute on Group */ + /* ========================= */ + + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* verify object header belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify (another) object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify shared message index tagged with sohm */ + if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify fractal heap header belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify fractal heap direct block belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* Verify free space header and free space section */ + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + + /* verify btree header and leaf node belonging to group */ + if ( verify_tag(fid, H5AC_BT2_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_attribute_creation_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_attribute_open_tags + * + * Purpose: This function verifies the correct application of tags + * during attribute open. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 24, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_attribute_open_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t aid = -1; /* Attribute Identifier */ + hid_t gid = -1; /* Group Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t g_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during attribute open"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Create attribute dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create attribute on group */ + if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Close attribute */ + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and group */ + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ========================= */ + /* Open Attribute of Group */ + /* ========================= */ + + if ( (aid = H5Aopen(gid, ATTRNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* verify object header belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify (another) object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify shared header message master table */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify fractal heap header belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify fractal heap direct block belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify btree header and leaf node belonging to group */ + if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_attribute_open_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_attribute_rename_tags + * + * Purpose: This function verifies the correct application of tags + * during attribute renaming. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 3, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_attribute_rename_tags(hid_t fcpl, int type) +{ + /* Variable declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + hid_t aid = -1; /* Attribute Identifier */ + hid_t sid = -1; /* Dataset Identifier */ + int verbose = FALSE; /* verbose file outout */ + int data[DIMS][DIMS]; /* data buffer */ + int i,j,k = 0; /* iterators */ + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t g_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during attribute renaming"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Set up attribute dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create attribute */ + if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to attribute */ + if ( H5Awrite(aid, H5T_NATIVE_INT, data) < 0 ) TEST_ERROR; + + /* Close Attribute */ + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and group */ + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ========================= */ + /* Rename Attribute of Group */ + /* ========================= */ + + if ( H5Arename_by_name(fid, GROUPNAME, ATTRNAME, ATTRNAME3, H5P_DEFAULT) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify object header belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify (another) object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify shared header message master table */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify fractal heap header belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify fractal heap direct block belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify shared header message stored as a list */ + if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify free space header */ + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + + /* verify btree header and leaf node belonging to group */ + if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_attribute_rename_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_attribute_delete_tags + * + * Purpose: This function verifies the correct application of tags + * during attribute deletion. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 3, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_attribute_delete_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + hid_t aid = -1; /* Attribute Identifier */ + hid_t sid = -1; /* Dataset Identifier */ + int verbose = FALSE; /* verbose file outout */ + int data[DIMS][DIMS]; /* data buffer */ + int i,j,k = 0; /* iterators */ + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t g_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during attribute delete"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Set up attribute dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create attribute */ + if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to attribute */ + if ( (H5Awrite(aid, H5T_NATIVE_INT, data)) < 0 ) TEST_ERROR; + + /* Close Attribute */ + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and group */ + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ========================= */ + /* Delete Attribute of Group */ + /* ========================= */ + + if ( (H5Adelete(gid, ATTRNAME)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* verify object header belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify shared header message master table */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify free space */ + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_attribute_delete_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_dataset_creation_tags + * + * Purpose: This function verifies the correct application of tags + * during dataset creation. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 10, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dataset_creation_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during dataset creation"); + + /* ===== */ + /* Setup */ + /* ===== */ + + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ============================ */ + /* Create Dataset in Root Group */ + /* ============================ */ + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* Get dataset's object header address */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify shared header message master table */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* Verify dataset's tagged metadata */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* Verify shared object header message tags */ + if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dataset_creation_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_dataset_creation_earlyalloc_tags + * + * Purpose: This function verifies the correct application of tags + * during dataset creation. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 1, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + int i = 0; /* iterator */ + + /* Testing Macro */ + TESTING("tag application during dataset creation with early allocation"); + + /* ===== */ + /* Setup */ + /* ===== */ + + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ============================ */ + /* Create Dataset in Root Group */ + /* ============================ */ + + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set early allocation time */ + if ( H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + if (( did = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* Get dataset's object header address */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify shared header message master table */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* Verify dataset's tagged metadata */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* Verify shared object header message tags */ + if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Verify 19 b-tree nodes belonging to dataset */ + for (i=0; i<19; i++) + if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dataset_creation_earlyalloc_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_dataset_open_tags + * + * Purpose: This function verifies the correct application of tags + * during dataset open. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 10, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dataset_open_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during dataset open"); + + /* ========= */ + /* Open File */ + /* ========= */ + + /* Create file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve tag associated with this dataset */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* Close Dataset */ + if (H5Dclose(did) < 0 ) TEST_ERROR; + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ========================== */ + /* Open Dataset in Root Group */ + /* ========================== */ + + if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* Verify dataset's object header */ + if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dataset_open_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_dataset_write_tags + * + * Purpose: This function verifies the correct application of tags + * during dataset write. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 10, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dataset_write_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + int i,j,k = 0; /* iterators */ + int data[DIMS][DIMS]; + + /* Testing Macro */ + TESTING("tag application during dataset write"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve tag associated with this dataset */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and dataset */ + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ============================== */ + /* Write to Dataset in Root Group */ + /* ============================== */ + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to dataset */ + if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify 10 b-tree nodes belonging to dataset */ + for (i=0; i<10; i++) + if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dataset_write_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_attribute_write_tags + * + * Purpose: This function verifies the correct application of tags + * during attribute write. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 3, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_attribute_write_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + hid_t aid = -1; /* Attribute Identifier */ + hid_t sid = -1; /* Dataset Identifier */ + int verbose = FALSE; /* verbose file outout */ + int data[DIMS][DIMS]; /* data buffer */ + int i,j,k = 0; /* iterators */ + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t g_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during attribute write"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Create attribute dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create attribute on group */ + if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Close and Reopen the file, group, and attribute */ + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (aid = H5Aopen(gid, ATTRNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Write to Attribute in Group */ + /* =========================== */ + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write attribute */ + if ( (H5Awrite(aid, H5T_NATIVE_INT, data)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify object header of group */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify (another) object header chunk belonging to group */ + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify shared header message master table and list */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify fractal heap header belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify fractal heap direct block belonging to group */ + if ( verify_tag(fid, H5AC_FHEAP_DBLOCK_ID, g_tag) < 0 ) TEST_ERROR; + + /* Verify SOHM list */ + if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + /* verify btree header and leaf node belonging to group */ + if ( verify_tag(fid, H5AC_BT2_HDR_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT2_LEAF_ID, g_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Aclose(aid) < 0 ) TEST_ERROR; + if ( H5Gclose(gid) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_attribute_write_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_dataset_read_tags + * + * Purpose: This function verifies the correct application of tags + * during dataset read. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 10, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dataset_read_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + int i,j,k = 0; /* iterators */ + int data[DIMS][DIMS]; + + /* Testing Macro */ + TESTING("tag application during dataset read"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve tag associated with this dataset */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to dataset */ + if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and dataset */ + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ===================================== */ + /* TEST: Read from Dataset in Root Group */ + /* ===================================== */ + + if( (H5Dread(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify 19 b-tree nodes belonging to dataset */ + for (i=0; i<19; i++) + if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dataset_read_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_dataset_size_retrieval + * + * Purpose: This function verifies the correct application of tags + * during dataset size retrieval. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 24, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dataset_size_retrieval(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + int i,j,k = 0; /* iterators */ + int data[DIMS][DIMS]; + hsize_t dsize = 0; + + /* Testing Macro */ + TESTING("tag application during dataset storage size retrieval"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve tag associated with this dataset */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to dataset */ + if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and dataset */ + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ========================================= */ + /* Get storage size of dataset in Root Group */ + /* ========================================= */ + + if ( (dsize = H5Dget_storage_size(did)) == 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify 19 b-tree nodes belonging to dataset */ + for (i=0; i<19; i++) + if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dataset_size_retrieval */ + + +/*------------------------------------------------------------------------- + * Function: check_dataset_extend_tags + * + * Purpose: This function verifies the correct application of tags + * during dataset extension. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 24, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_dataset_extend_tags(hid_t fcpl, int type) +{ + + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + int i,j,k = 0; /* iterators */ + int data[DIMS][DIMS]; + hsize_t newdims[2] = {DIMS*2, DIMS}; /* dimensions */ + + /* Testing Macro */ + TESTING("tag application during dataset extend"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve tag associated with this dataset */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to dataset */ + if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and dataset */ + if ( H5Dclose(did) < 0 ) TEST_ERROR; + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ================== */ + /* Set Dataset extent */ + /* ================== */ + + if ( H5Dset_extent(did, newdims) < 0 ) TEST_ERROR; + + if ( H5Dclose(did) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_dataset_extend_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_object_info_tags + * + * Purpose: This function verifies the correct application of tags + * during object information retrieval. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 1, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_object_info_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + int verbose = FALSE; /* verbose file output */ + haddr_t root_tag; + haddr_t sbe_tag; + haddr_t g_tag; + H5O_info_t oinfo; /* Object info struct */ + + /* Testing Macro */ + TESTING("tag application during object info retrieval"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Close Group */ + if (H5Gclose(gid) < 0) TEST_ERROR; + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ===================================== */ + /* Get information on an object by name */ + /* ===================================== */ + + if ( H5Oget_info_by_name(fid, GROUPNAME, &oinfo, H5P_DEFAULT) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group's tagged metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* Verify dataset's tagged metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_object_info_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_object_copy_tags + * + * Purpose: This function verifies the correct application of tags + * during object copy. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 3, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_object_copy_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t gid = -1; /* Group Identifier */ + int verbose = FALSE; /* verbose file output */ + haddr_t root_tag; + haddr_t sbe_tag; + haddr_t g_tag; + haddr_t copy_tag; + + /* Testing Macro */ + TESTING("tag application during object copy"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Close Group */ + if (H5Gclose(gid) < 0) TEST_ERROR; + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* =========== */ + /* Copy Group */ + /* =========== */ + + H5Ocopy(fid, GROUPNAME, fid, GROUPNAMECOPY, H5P_DEFAULT, H5P_DEFAULT); + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group's tagged metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* Verify dataset's tagged metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR; + + /* Verify copied dataset's tagged metadata */ + if ( get_new_object_header_tag(fid, ©_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, copy_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, copy_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_object_copy_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_link_removal_tags + * + * Purpose: This function verifies the correct application of tags + * during link removal. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 1, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_link_removal_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + hid_t gid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + haddr_t g_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + int i,j,k = 0; /* iterators */ + int data[DIMS][DIMS]; + + /* Testing Macro */ + TESTING("tag application during link removal"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Close Group */ + if (H5Gclose(gid) < 0) TEST_ERROR; + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve tag associated with this dataset */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to dataset */ + if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR; + + /* Close Dataset */ + if ( H5Dclose(did) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and dataset */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ================================ */ + /* Remove link to group and dataset */ + /* ================================ */ + + if ( (H5Ldelete(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + if ( (H5Ldelete(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group's tagged metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + if ( type == TEST_SHMESG ) { + + /* verify shared header message master table */ + if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; + + } /* end if */ + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_link_removal_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_link_getname_tags + * + * Purpose: This function verifies the correct application of tags + * during link name retrieval. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * March 2, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_link_getname_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + char name[500]; + hid_t fid = -1; /* File Identifier */ + hid_t did = -1; /* Dataset Identifier */ + hid_t sid = -1; /* Dataspace Identifier */ + hid_t gid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + hid_t dcpl = -1; /* dataset creation pl */ + hsize_t cdims[2] = {1,1}; /* chunk dimensions */ + int fillval = 0; + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + haddr_t d_tag = 0; + haddr_t g_tag = 0; + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ + int i,j,k = 0; /* iterators */ + int data[DIMS][DIMS]; + + /* Testing Macro */ + TESTING("tag application during link name retrieval"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create group */ + if ( (gid = H5Gcreate(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve group tag */ + if ( get_new_object_header_tag(fid, &g_tag) < 0 ) TEST_ERROR; + + /* Close Group */ + if (H5Gclose(gid) < 0) TEST_ERROR; + + /* Set up creation property list */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + /* Enable chunking */ + if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; + + /* Set up a fill value */ + if ( H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0 ) TEST_ERROR; + + /* Set up dataset dataspace */ + if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; + + /* Create Dataset */ + if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve tag associated with this dataset */ + if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; + + /* fill out data buffer */ + for(i=0;i<DIMS;i++) { + for(j=0;j<DIMS;j++) { + + data[i][j] = k++; + } /* end for */ + } /* end for */ + + /* Write to dataset */ + if( (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data)) < 0 ) TEST_ERROR; + + /* Close Dataset */ + if ( H5Dclose(did) < 0 ) TEST_ERROR; + + /* Close and Reopen the file and dataset */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Get name by index location. */ + /* =========================== */ + + H5Lget_name_by_idx(fid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)1, name, (size_t)500, H5P_DEFAULT); + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group's tagged metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_link_getname_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_external_link_creation_tags + * + * Purpose: This function verifies the correct application of tags + * during external link creation. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 24, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_external_link_creation_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + hid_t fid = -1; /* File Identifier */ + hid_t fid2 = -1; /* File Identifier */ + hid_t gid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + + /* Testing Macro */ + TESTING("tag application during external link creation"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* Create a second file */ + if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Create group in second file */ + if ( (gid = H5Gcreate(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Close out second file */ + if ( (H5Gclose(gid)) < 0 ) TEST_ERROR; + if ( (H5Fclose(fid2)) < 0 ) TEST_ERROR; + + /* ==================== */ + /* Create External Link */ + /* ==================== */ + + if (H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* Verify root group metadata */ + if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, root_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, root_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_external_link_creation_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_external_link_open_tags + * + * Purpose: This function verifies the correct application of tags + * during external link open. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * February 24, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_external_link_open_tags(hid_t fcpl, int type) +{ + /* Variable Declarations */ + haddr_t link_tag = 0; /* link tag */ + hid_t fid = -1; /* File Identifier */ + hid_t fid2 = -1; /* File Identifier */ + hid_t gid = -1; /* Dataspace Identifier */ + hid_t xid = -1; /* Dataspace Identifier */ + int verbose = FALSE; /* verbose file outout */ + haddr_t root_tag = 0; + haddr_t sbe_tag = 0; + + /* Testing Macro */ + TESTING("tag application during external link open"); + + /* ===== */ + /* Setup */ + /* ===== */ + + /* Create a test file with provided fcpl_t */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Retrieve various tags */ + if ( type == TEST_DEFAULT ) { + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } else if ( type == TEST_SHMESG ) { + + /* determine tag value of sblock extension object header */ + if ( get_new_object_header_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; + + /* determine tag value of root group's object header */ + if ( get_new_object_header_tag(fid, &root_tag) < 0 ) TEST_ERROR; + + } /* end if */ + + /* Create a second file */ + if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Create group in second file */ + if ( (gid = H5Gcreate(fid2, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Close out second file */ + if ( (H5Gclose(gid)) < 0 ) TEST_ERROR; + if ( (H5Fclose(fid2)) < 0 ) TEST_ERROR; + + /* Create external link to second file */ + if ( H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0 ) TEST_ERROR; + + /* Close and Reopen the file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Evict as much as we can from the cache so we can track full tag path */ + if ( evict_entries(fid) < 0 ) TEST_ERROR; + + /* ================== */ + /* Open External Link */ + /* ================== */ + + if ( (xid = H5Gopen2(fid, LINKNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (H5Gclose(xid)) < 0 ) TEST_ERROR; + + /* =================================== */ + /* Verification of Metadata Tag Values */ + /* =================================== */ + + /* if verbose, print cache index to screen for visual verification */ + if ( verbose ) print_index(fid); + + /* determine tag value of linked group's object header */ + if ( get_new_object_header_tag(fid, &link_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_OHDR_CHK_ID, link_tag) < 0 ) TEST_ERROR; + + /* verify no other entries present */ + if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; + + /* =========================== */ + /* Close open objects and file */ + /* =========================== */ + + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* ========================================== */ + /* Finished Test. Print status and return. */ + /* ========================================== */ + + PASSED(); + return 0; + +error: + return 1; +} /* check_external_link_open_tags */ + + +/*------------------------------------------------------------------------- + * Function: check_invalid_tag_application + * + * Purpose: This function verifies that an error occurs if a tag + * has not been set up during a protect or set of + * a new piece of metadata. + * + * Return: 0 on Success, 1 on Failure + * + * Programmer: Mike McGreevy + * May 27, 2010 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned +check_invalid_tag_application(void) +{ + /* Variables */ + H5F_t * f = NULL; + hid_t fid, dxpl_id = -1; + haddr_t addr; + H5HL_t * lheap = NULL; + + /* Testing Macro */ + TESTING("failure on invalid tag application"); + + #if H5C_DO_TAGGING_SANITY_CHECKS + /* Create a test file */ + if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; + + /* Get internal file pointer*/ + if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR; + + /* Create dxpl */ + if ( dxpl_id = H5Pcreate(H5P_DATASET_XFER) < 0) TEST_ERROR; + + /* Call H5HL_create, an internal function that calls H5AC_set without setting up a tag */ + /* Ensure this returns FAILURE, as a tag has not been set up. */ + if ( H5HL_create(f, H5AC_ind_dxpl_id, 1024, &addr) >= 0) TEST_ERROR; + + /* Now set up a tag in the dxpl */ + if ( H5AC_tag(H5AC_ind_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; + + /* Verify the same call to H5HL_create now works as intended, with a tag set up. */ + if ( H5HL_create(f, H5AC_ind_dxpl_id, 1024, &addr) < 0) TEST_ERROR; + + /* Reset dxpl to use invalid tag. */ + if ( H5AC_tag(H5AC_ind_dxpl_id, H5AC__INVALID_TAG, NULL) < 0) TEST_ERROR; + + /* Call H5HL_protect to protect the local heap created above. */ + /* This should fail as no tag is set up during the protect call */ + if (( lheap = H5HL_protect(f, H5AC_ind_dxpl_id, addr, H5AC_WRITE)) != NULL ) TEST_ERROR; + + /* Again, set up a valid tag in the DXPL */ + if ( H5AC_tag(H5AC_ind_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; + + /* Call H5HL_protect again to protect the local heap. This should succeed. */ + if (( lheap = H5HL_protect(f, H5AC_ind_dxpl_id, addr, H5AC_WRITE)) == NULL ) TEST_ERROR; + + /* Now unprotect the heap, as we're done with the test. */ + if ( H5HL_unprotect(lheap) < 0 ) TEST_ERROR; + + /* Close open objects and file */ + if ( H5Fclose(fid) < 0 ) TEST_ERROR; + + /* Finished Test. Print status and return. */ + PASSED(); + #else + SKIPPED(); + printf(" test skipped because sanity checking on tag value is disabled.\n"); + #endif + + return 0; + +error: + return 1; +} /* check_invalid_tag_application */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Run tests on library's ability to tag metadata entries. + * + * Return: Success: + * + * Failure: + * + * Programmer: Mike McGreevy + * January 15, 2009 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +int +main(void) +{ + /* Variable Declarations */ + hid_t fcpl_default = -1; /* file creation prop list */ + hid_t fcpl_shmesg_all = -1; /* file creation prop list */ + hid_t fcpl = -1; /* file creation prop list */ + unsigned nerrs = 0; /* Error Encountered */ + int test_type = 0; /* test type iterator */ + + /* Open the HDF5 Library */ + H5open(); + + /* ========== */ + /* Test Setup */ + /* ========== */ + + /* Create a standard file creation property list */ + fcpl_default = H5Pcreate(H5P_FILE_CREATE); + + /* Create an fcpl with shared messages and file space managment enabled */ + fcpl_shmesg_all = H5Pcreate(H5P_FILE_CREATE); + H5Pset_shared_mesg_nindexes(fcpl_shmesg_all, 1); + H5Pset_shared_mesg_index(fcpl_shmesg_all, 0, H5O_SHMESG_ALL_FLAG, 20); + H5Pset_file_space(fcpl_shmesg_all, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); + + /* ========= */ + /* Run Tests */ + /* ========= */ + + for (test_type=0; test_type<NUM_TEST_TYPES; test_type++) { + + /* Run tests on each fcpl set up above. */ + if (test_type == TEST_DEFAULT) { + + if (!nerrs) printf("Testing standard tag application cases w/ default fcpl:\n"); + fcpl = fcpl_default; + + } else if (test_type == TEST_SHMESG) { + + if (!nerrs) printf("Testing standard tag application cases w/ shared messages:\n"); + fcpl = fcpl_shmesg_all; + + } else { + TEST_ERROR; + } + + /* Check tag application under different circumstances */ + if (!nerrs) nerrs += check_file_creation_tags(fcpl, test_type); + if (!nerrs) nerrs += check_file_open_tags(fcpl, test_type); + if (!nerrs) nerrs += check_group_creation_tags(fcpl, test_type); + if (!nerrs) nerrs += check_multi_group_creation_tags(fcpl, test_type); + if (!nerrs) nerrs += check_group_open_tags(fcpl, test_type); + if (!nerrs) nerrs += check_attribute_creation_tags(fcpl, test_type); + if (!nerrs) nerrs += check_attribute_open_tags(fcpl, test_type); + if (!nerrs) nerrs += check_attribute_write_tags(fcpl, test_type); + if (!nerrs) nerrs += check_attribute_delete_tags(fcpl, test_type); + if (!nerrs) nerrs += check_attribute_rename_tags(fcpl, test_type); + if (!nerrs) nerrs += check_dataset_creation_tags(fcpl, test_type); + if (!nerrs) nerrs += check_dataset_creation_earlyalloc_tags(fcpl, test_type); + if (!nerrs) nerrs += check_dataset_open_tags(fcpl, test_type); + if (!nerrs) nerrs += check_dataset_write_tags(fcpl, test_type); + if (!nerrs) nerrs += check_dataset_read_tags(fcpl, test_type); + if (!nerrs) nerrs += check_dataset_size_retrieval(fcpl, test_type); + if (!nerrs && (test_type == TEST_DEFAULT)) nerrs += check_dataset_extend_tags(fcpl, test_type); + if (!nerrs) nerrs += check_object_info_tags(fcpl, test_type); + if (!nerrs) nerrs += check_link_removal_tags(fcpl, test_type); + if (!nerrs) nerrs += check_link_getname_tags(fcpl, test_type); + if (!nerrs) nerrs += check_external_link_creation_tags(fcpl, test_type); + if (!nerrs) nerrs += check_external_link_open_tags(fcpl, test_type); + if (!nerrs) nerrs += check_object_copy_tags(fcpl, test_type); + + } /* end for */ + + if (!nerrs) printf("Testing other specific tag application cases:\n"); + if (!nerrs) nerrs += check_dense_attribute_tags(); + if (!nerrs) nerrs += check_link_iteration_tags(); + if (!nerrs) nerrs += check_invalid_tag_application(); + + /* Delete test files */ + HDremove(FILENAME); + HDremove(FILENAME2); + + /* Return Errors */ + return(nerrs > 0); + +error: + /* Return with Error */ + return(1); + +} /* main */ diff --git a/test/earray.c b/test/earray.c index fe9e9c1..3a29948 100644 --- a/test/earray.c +++ b/test/earray.c @@ -322,6 +322,11 @@ create_file(hid_t fapl, hid_t *file, H5F_t **f) if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(*f) < 0) { + FAIL_STACK_ERROR + } + /* Success */ return(0); @@ -449,6 +454,11 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(*f) < 0) { + FAIL_STACK_ERROR + } + /* Re-open array, if given */ if(ea) { if(NULL == (*ea = H5EA_open(*f, dxpl, ea_addr, NULL))) diff --git a/test/farray.c b/test/farray.c index 60a2200..8b6a617 100644 --- a/test/farray.c +++ b/test/farray.c @@ -158,6 +158,11 @@ create_file(hid_t fapl, hid_t *file, H5F_t **f) if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(*f) < 0) { + FAIL_STACK_ERROR + } + /* Success */ return(0); @@ -289,6 +294,11 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(*f) < 0) { + FAIL_STACK_ERROR + } + /* Re-open array, if given */ if(fa) { if(NULL == (*fa = H5FA_open(*f, dxpl, fa_addr, NULL))) diff --git a/test/fheap.c b/test/fheap.c index 314b9ce..f983184 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -592,6 +592,10 @@ reopen_file(hid_t *file, H5F_t **f, const char *filename, hid_t fapl, hid_t dxpl if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(*f) < 0) + FAIL_STACK_ERROR + /* Re-open heap */ if(NULL == (*fh = H5HF_open(*f, dxpl, fh_addr))) FAIL_STACK_ERROR @@ -639,6 +643,10 @@ open_heap(char *filename, hid_t fapl, hid_t dxpl, const H5HF_create_t *cparam, if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(*f) < 0) + FAIL_STACK_ERROR + /* Create absolute heap */ if(NULL == (*fh = H5HF_create(*f, dxpl, cparam))) FAIL_STACK_ERROR @@ -677,6 +685,10 @@ open_heap(char *filename, hid_t fapl, hid_t dxpl, const H5HF_create_t *cparam, if(NULL == (*f = (H5F_t *)H5I_object(*file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(*f) < 0) + FAIL_STACK_ERROR + /* Check for deleting the entire heap */ if(tparam->del_dir == FHEAP_DEL_HEAP) { /* Create absolute heap */ @@ -1843,6 +1855,10 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* * Test fractal heap creation */ @@ -1956,6 +1972,10 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* * Display testing message */ @@ -1994,6 +2014,11 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + } /* end if */ /* Re-open the heap */ @@ -2096,6 +2121,10 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tp if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* * Display testing message */ @@ -2144,6 +2173,10 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tp if(NULL == (f2 = (H5F_t *)H5I_object(file2))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f2) < 0) + FAIL_STACK_ERROR + /* Open the fractal heap through the second file handle */ if(NULL == (fh2 = H5HF_open(f2, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -2258,6 +2291,10 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Display test banner */ TESTING("deleting open fractal heap"); @@ -2326,6 +2363,11 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *t /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + } /* end if */ /* Try re-opening the heap again (should fail, as heap is now deleted) */ @@ -2408,6 +2450,10 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Display testing message */ TESTING("limits of heap ID lengths") @@ -2747,6 +2793,10 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Display testing message */ TESTING("creating heaps with I/O filters") @@ -2786,6 +2836,10 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -2862,6 +2916,10 @@ test_size(hid_t fapl, H5HF_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Display testing message */ TESTING("querying heap statistics") @@ -2912,6 +2970,10 @@ test_size(hid_t fapl, H5HF_create_t *cparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -2997,6 +3059,10 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -3103,6 +3169,10 @@ test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -3200,6 +3270,10 @@ test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -3293,6 +3367,10 @@ test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -3388,6 +3466,10 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -3490,6 +3572,10 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -3593,6 +3679,10 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -3700,6 +3790,10 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -3792,6 +3886,10 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -3891,6 +3989,10 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -3988,6 +4090,10 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4095,6 +4201,10 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4188,6 +4298,10 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4280,6 +4394,10 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_ if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4378,6 +4496,10 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4484,6 +4606,10 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_ if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4583,6 +4709,10 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4690,6 +4820,10 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4892,6 +5026,10 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -4997,6 +5135,10 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5096,6 +5238,10 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5202,6 +5348,10 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5309,6 +5459,10 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5412,6 +5566,10 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5516,6 +5674,10 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5627,6 +5789,10 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5743,6 +5909,10 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5851,6 +6021,10 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -5962,6 +6136,10 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) FAIL_STACK_ERROR @@ -6092,6 +6270,10 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -6241,6 +6423,10 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -6278,6 +6464,10 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Re-open heap */ if(NULL == (fh = H5HF_open(f, dxpl, fh_addr))) FAIL_STACK_ERROR @@ -6397,6 +6587,10 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -6434,6 +6628,10 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Re-open heap */ if(NULL == (fh = H5HF_open(f, dxpl, fh_addr))) FAIL_STACK_ERROR @@ -6582,6 +6780,10 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -6619,6 +6821,10 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Re-open heap */ if(NULL == (fh = H5HF_open(f, dxpl, fh_addr))) FAIL_STACK_ERROR @@ -6743,6 +6949,10 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -6780,6 +6990,10 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Re-open heap */ if(NULL == (fh = H5HF_open(f, dxpl, fh_addr))) FAIL_STACK_ERROR @@ -6979,6 +7193,10 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Create absolute heap */ if(NULL == (fh = H5HF_create(f, dxpl, cparam))) FAIL_STACK_ERROR @@ -7016,6 +7234,10 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Re-open heap */ if(NULL == (fh = H5HF_open(f, dxpl, fh_addr))) FAIL_STACK_ERROR @@ -13362,6 +13584,10 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -14538,6 +14764,10 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -14720,6 +14950,10 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -14780,6 +15014,10 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -14812,6 +15050,10 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -14845,6 +15087,10 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -14877,6 +15123,10 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -15514,6 +15764,10 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -15577,6 +15831,10 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -15738,6 +15996,10 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR @@ -15764,6 +16026,10 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Ignore metadata tags in the file's cache */ + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR diff --git a/test/lheap.c b/test/lheap.c index 52af202..1d98fc4 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -81,6 +81,11 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } + if (H5AC_ignore_tags(f) < 0) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; + } if(H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); @@ -124,6 +129,11 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } + if (H5AC_ignore_tags(f) < 0) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; + } for(i = 0; i < NOBJS; i++) { sprintf(buf, "%03d-", i); for(j = 4; j < i; j++) diff --git a/test/ohdr.c b/test/ohdr.c index 37699e5..dad06cf 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -71,6 +71,11 @@ test_cont(char *filename, hid_t fapl) /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + if (H5AC_ignore_tags(f) < 0) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; + } HDmemset(&oh_locA, 0, sizeof(oh_locA)); HDmemset(&oh_locB, 0, sizeof(oh_locB)); @@ -198,6 +203,11 @@ main(void) TEST_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + if (H5AC_ignore_tags(f) < 0) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; + } /* @@ -292,6 +302,8 @@ main(void) FAIL_STACK_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + if (H5AC_ignore_tags(f) < 0) + FAIL_STACK_ERROR oh_loc.file = f; if(H5O_open(&oh_loc) < 0) FAIL_STACK_ERROR diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 2590295..554a8cc 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -2711,8 +2711,9 @@ lock_entry(H5F_t * file_ptr, HDassert( ! (entry_ptr->locked) ); - cache_entry_ptr = (H5C_cache_entry_t *)H5AC_protect(file_ptr, -1, &(types[0]), - entry_ptr->base_addr, NULL, H5AC_WRITE); + cache_entry_ptr = (H5C_cache_entry_t *)H5AC_protect(file_ptr, + H5P_DATASET_XFER_DEFAULT, &(types[0]), entry_ptr->base_addr, + NULL, H5AC_WRITE); if ( ( cache_entry_ptr != (void *)(&(entry_ptr->header)) ) || ( entry_ptr->header.type != &(types[0]) ) || @@ -3203,6 +3204,7 @@ setup_cache_for_test(hid_t * fid_ptr, world_mpi_rank, fcn_name); } } else { + cache_ptr->ignore_tags = TRUE; *fid_ptr = fid; *file_ptr_ptr = file_ptr; *cache_ptr_ptr = cache_ptr; |