diff options
Diffstat (limited to 'src')
43 files changed, 971 insertions, 173 deletions
@@ -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) */ |