From 810f4373e340364b8862e807422262a34bac037b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 6 May 2010 08:11:38 -0500 Subject: [svn-r18720] Description: Bring changes from metadata journaling branch to 'merging' branch: Rename H5[A]C_mark_pinned_or_protected_entry_dirty() to H5[A]C_mark_entry_dirty() and get rid of H5[A]C_mark_pinned_entry_dirty(). Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode --- src/H5AC.c | 90 ++-------------------------------- src/H5ACprivate.h | 4 +- src/H5C.c | 109 ++--------------------------------------- src/H5Cprivate.h | 6 +-- src/H5FS.c | 2 +- src/H5FSsection.c | 20 ++++---- src/H5HFhdr.c | 2 +- src/H5HFiblock.c | 2 +- src/H5HL.c | 4 +- src/H5O.c | 8 ++-- src/H5Oalloc.c | 4 +- src/H5Ochunk.c | 2 +- src/H5Omessage.c | 2 +- test/cache.c | 83 +++++++------------------------- test/cache_common.c | 136 ++++++---------------------------------------------- test/cache_common.h | 13 ++--- testpar/t_cache.c | 110 +++++++++--------------------------------- 17 files changed, 91 insertions(+), 506 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index ca8bddd..5eced29 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -1355,91 +1355,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_mark_pinned_entry_dirty - * - * Purpose: Mark a pinned entry as dirty. The target entry MUST be - * be pinned, and MUST be unprotected. - * - * If the entry has changed size, the function updates - * data structures for the size change. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 4/11/06 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size) -{ -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5AC_mark_pinned_entry_dirty, FAIL) - - /* Sanity check */ - HDassert(thing); - -#if H5AC__TRACE_FILE_ENABLED - /* For the mark pinned entry dirty call, only the addr, size_changed, - * and new_size are really necessary in the trace file. Write the result - * to catch occult errors. - */ - if((H5C_get_trace_file_ptr_from_entry(thing, &trace_file_ptr) >= 0) && - (NULL != trace_file_ptr)) - sprintf(trace, "%s 0x%lx %d %d", FUNC, - (unsigned long)(((H5C_cache_entry_t *)thing)->addr), - (int)size_changed, - (int)new_size); -#endif /* H5AC__TRACE_FILE_ENABLED */ - -#ifdef H5_HAVE_PARALLEL -{ - H5AC_info_t *entry_ptr = (H5AC_info_t *)thing; - H5C_t *cache_ptr = entry_ptr->cache_ptr; - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if((!entry_ptr->is_dirty) && (NULL != cache_ptr->aux_ptr)) { - /* Check for usage errors */ - if(!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??") - if(entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??") - - if(H5AC_log_dirtied_entry(entry_ptr, entry_ptr->addr, size_changed, new_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") - } /* end if */ -} -#endif /* H5_HAVE_PARALLEL */ - - if(H5C_mark_pinned_entry_dirty(thing, size_changed, new_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned entry dirty") - -done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC_mark_pinned_entry_dirty() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC_mark_pinned_or_protected_entry_dirty + * Function: H5AC_mark_entry_dirty * * Purpose: Mark a pinned or protected entry as dirty. The target * entry MUST be either pinned, protected, or both. * - * Unlike H5AC_mark_pinned_entry_dirty(), this function does - * not support size changes. - * * Return: Non-negative on success/Negative on failure * * Programmer: John Mainzer @@ -1448,7 +1368,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_mark_pinned_or_protected_entry_dirty(void *thing) +H5AC_mark_entry_dirty(void *thing) { #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; @@ -1456,7 +1376,7 @@ H5AC_mark_pinned_or_protected_entry_dirty(void *thing) #endif /* H5AC__TRACE_FILE_ENABLED */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5AC_mark_pinned_or_protected_entry_dirty, FAIL) + FUNC_ENTER_NOAPI(H5AC_mark_entry_dirty, FAIL) /* Sanity check */ HDassert(thing); @@ -1488,7 +1408,7 @@ H5AC_mark_pinned_or_protected_entry_dirty(void *thing) } #endif /* H5_HAVE_PARALLEL */ - if(H5C_mark_pinned_or_protected_entry_dirty(thing) < 0) + if(H5C_mark_entry_dirty(thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty") done: @@ -1498,7 +1418,7 @@ done: #endif /* H5AC__TRACE_FILE_ENABLED */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC_mark_pinned_entry_dirty() */ +} /* H5AC_mark_entry_dirty() */ /*------------------------------------------------------------------------- diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index aa0f6e9..4d210ac 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -277,9 +277,7 @@ H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags); -H5_DLL herr_t H5AC_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, - size_t new_size); -H5_DLL herr_t H5AC_mark_pinned_or_protected_entry_dirty(void *thing); +H5_DLL herr_t H5AC_mark_entry_dirty(void *thing); H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr); diff --git a/src/H5C.c b/src/H5C.c index a2386e2..735fd09 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -2735,112 +2735,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5C_mark_pinned_entry_dirty - * - * Purpose: Mark a pinned entry as dirty. The target entry MUST be - * be pinned, and MUST be unprotected. - * - * If the entry has changed size, the function updates - * data structures for the size change. - * - * If the entry is not already dirty, the function places - * the entry on the skip list. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 3/22/06 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_mark_pinned_entry_dirty(void *thing, hbool_t size_changed, size_t new_size) -{ - H5C_t * cache_ptr; - H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; - size_t size_increase; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5C_mark_pinned_entry_dirty, FAIL) - - /* Sanity checks */ - HDassert(entry_ptr); - HDassert(H5F_addr_defined(entry_ptr->addr)); - cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - /* Check for usage errors */ - if(!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry isn't pinned??") - if(entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is protected??") - - /* mark the entry as dirty if it isn't already */ - entry_ptr->is_dirty = TRUE; - - /* update for change in entry size if necessary */ - if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { - - /* do a flash cache size increase if appropriate */ - if ( cache_ptr->flash_size_increase_possible ) { - - if ( new_size > entry_ptr->size ) { - - size_increase = new_size - entry_ptr->size; - - if ( size_increase >= - cache_ptr->flash_size_increase_threshold ) { - if(H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "flash cache increase failed") - } - } - } - - /* update the pinned entry list */ - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ - (cache_ptr->pel_size), \ - (entry_ptr->size), (new_size)); - - /* update the hash table */ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\ - (new_size)); - - /* if the entry is in the skip list, update that too */ - if ( entry_ptr->in_slist ) { - - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\ - (new_size)); - } - - /* update statistics just before changing the entry size */ - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE((cache_ptr), (entry_ptr), \ - (new_size)); - - /* finally, update the entry size proper */ - entry_ptr->size = new_size; - } - - if ( ! (entry_ptr->in_slist) ) { - - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - } - - H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_mark_pinned_entry_dirty() */ - - -/*------------------------------------------------------------------------- - * Function: H5C_mark_pinned_or_protected_entry_dirty + * Function: H5C_mark_entry_dirty * * Purpose: Mark a pinned or protected entry as dirty. The target entry * MUST be either pinned or protected, and MAY be both. * - * At present, this funtion does not support size change. - * * In the protected case, this call is the functional * equivalent of setting the H5C__DIRTIED_FLAG on an unprotect * call. @@ -2857,13 +2756,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_mark_pinned_or_protected_entry_dirty(void *thing) +H5C_mark_entry_dirty(void *thing) { H5C_t * cache_ptr; H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5C_mark_pinned_or_protected_entry_dirty, FAIL) + FUNC_ENTER_NOAPI(H5C_mark_entry_dirty, FAIL) /* Sanity checks */ HDassert(entry_ptr); @@ -2900,7 +2799,7 @@ H5C_mark_pinned_or_protected_entry_dirty(void *thing) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_mark_pinned_or_protected_entry_dirty() */ +} /* H5C_mark_entry_dirty() */ /*------------------------------------------------------------------------- diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index da22c8a..768a4f0 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1036,11 +1036,7 @@ H5_DLL herr_t H5C_mark_entries_as_clean(H5F_t * f, int32_t ce_array_len, haddr_t *ce_array_ptr); -H5_DLL herr_t H5C_mark_pinned_entry_dirty(void * thing, - hbool_t size_changed, - size_t new_size); - -H5_DLL herr_t H5C_mark_pinned_or_protected_entry_dirty(void *thing); +H5_DLL herr_t H5C_mark_entry_dirty(void *thing); H5_DLL herr_t H5C_rename_entry(H5C_t * cache_ptr, const H5C_class_t * type, diff --git a/src/H5FS.c b/src/H5FS.c index 517609a..c829aad 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -379,7 +379,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_c fspace->alloc_sect_size = fspace->sect_size = 0; /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") /* Evict the section info from the metadata cache */ diff --git a/src/H5FSsection.c b/src/H5FSsection.c index c918714..b107829 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -226,7 +226,7 @@ HDfprintf(stderr, "%s: New section info, addr = %a, size = %Hu\n", FUNC, fspace- HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space sections to cache") /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, NULL, "unable to mark free space header as dirty") } /* end if */ else { @@ -323,7 +323,7 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: @@ -386,7 +386,7 @@ HDfprintf(stderr, "%s: cls->serial_size = %Zu\n", FUNC, cls->serial_size); } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") done: @@ -591,7 +591,7 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); fspace->tot_space -= sect->size; /* Mark free space sections as changed */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) + if(H5AC_mark_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") done: @@ -1102,7 +1102,7 @@ HDfprintf(stderr, "%s: fspace->hdr->tot_space = %Hu\n", FUNC, fspace->tot_space) /* Mark free space sections as changed */ /* (if adding sections while deserializing sections, don't set the flag) */ if(!(flags & H5FS_ADD_DESERIALIZING)) { - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) + if(H5AC_mark_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") } /* end if */ @@ -1382,12 +1382,12 @@ HDfprintf(stderr, "%s: old_addr = %a, fspace->sect_addr = %a\n", FUNC, old_addr, } /* end if */ else { /* Mark free space section as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) + if(H5AC_mark_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space section info as dirty") } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ else { @@ -1447,12 +1447,12 @@ HDfprintf(stderr, "%s: Allocating space for smaller serialized sections, new_siz } /* end if */ else { /* Mark free space section as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) + if(H5AC_mark_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space section info as dirty") } /* end else */ /* Mark free space header as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace) < 0) + if(H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end else */ @@ -1791,7 +1791,7 @@ HDfprintf(stderr, "%s: removing object from merge list, sect->type = %u\n", FUNC HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") /* Mark free space sections as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(fspace->sinfo) < 0) + if(H5AC_mark_entry_dirty(fspace->sinfo) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space sections as dirty") done: diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 7bd0c7e..6b1f8bc 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -713,7 +713,7 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) } /* end if */ /* Mark header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(hdr) < 0) + if(H5AC_mark_entry_dirty(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty") /* Set the dirty flags for the heap header */ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 81889a7..917a450 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -335,7 +335,7 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock) HDassert(iblock); /* Mark indirect block as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(iblock) < 0) + if(H5AC_mark_entry_dirty(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap indirect block as dirty") done: diff --git a/src/H5HL.c b/src/H5HL.c index 050be1e..a360016 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -655,12 +655,12 @@ H5HL_dirty(H5HL_t *heap) /* Sanity check */ HDassert(heap->dblk); - if(H5AC_mark_pinned_or_protected_entry_dirty(heap->dblk) < 0) + if(H5AC_mark_entry_dirty(heap->dblk) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty") } /* end if */ /* Mark heap prefix as dirty */ - if(H5AC_mark_pinned_or_protected_entry_dirty(heap->prfx) < 0) + if(H5AC_mark_entry_dirty(heap->prfx) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap prefix as dirty") done: diff --git a/src/H5O.c b/src/H5O.c index 0794808..2c10627 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1445,7 +1445,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) oh->nlink += adjust; /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") /* Check if the object should be deleted */ @@ -1476,7 +1476,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) oh->nlink += adjust; /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ @@ -1687,7 +1687,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, H5AC_protect_t prot) /* (usually through updating the # of object header messages) */ if(oh->prefix_modified) { /* Mark the header as dirty now */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, NULL, "unable to mark object header as dirty") /* Reset flag */ @@ -1924,7 +1924,7 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) oh->atime = oh->ctime = now; /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end else */ } /* end if */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index a4619df..4540d35 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -618,7 +618,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, oh->flags |= new_size_flags; /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ @@ -1120,7 +1120,7 @@ H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type, HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't split null message") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, UFAIL, "unable to mark object header as dirty") /* Set return value */ diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index e42c940..76d988f 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -231,7 +231,7 @@ H5O_chunk_unprotect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_chunk_proxy_t *chk_p /* Check for dirtying the first chunk */ else if(chk_flags & H5AC__DIRTIED_FLAG) { /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end else/if */ else { diff --git a/src/H5Omessage.c b/src/H5Omessage.c index b3bda5f..39a5256 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -1368,7 +1368,7 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") /* Mark object header as dirty in cache */ - if(H5AC_mark_pinned_or_protected_entry_dirty(oh) < 0) + if(H5AC_mark_entry_dirty(oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") } /* end if */ diff --git a/test/cache.c b/test/cache.c index da9ba46..efaef83 100644 --- a/test/cache.c +++ b/test/cache.c @@ -10806,8 +10806,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) * * JRM -- 5/17/06 * Complete reqrite of pinned entry tests to accomodate - * the new H5C_mark_pinned_or_protected_entry_dirty() - * call. + * the new H5C_mark_entry_dirty() call. * *------------------------------------------------------------------------- */ @@ -12094,13 +12093,12 @@ check_flush_cache__single_entry(H5F_t * file_ptr) * * 2) Marked dirty by unprotect or not. * - * 3) Marked dirty by call to H5C_mark_pinned_entry_dirty() or not. + * 3) Marked dirty by call to H5C_mark_entry_dirty() or not. * - * 4) Marked dirty by call to H5C_mark_pinned_or_protected_entry_dirty() - * while protected or not. + * 4) Marked dirty by call to H5C_mark_entry_dirty() while protected + * or not. * - * 5) Marked dirty by call to H5C_mark_pinned_or_protected_entry_dirty() - * while pinned or not. + * 5) Marked dirty by call to H5C_mark_entry_dirty() while pinned or not. * * 6) Entry marked for flush or not. * @@ -12653,7 +12651,7 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, * JRM -- 5/17/06 * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned * flags and supporting code to allow us to test the - * H5C_mark_pinned_or_protected_entry_dirty() call. Use the + * H5C_mark_entry_dirty() call. Use the * call to mark the entry dirty while the entry is protected * if pop_mark_dirty_prot is TRUE, and to mark the entry * dirty while it is pinned if pop_mark_dirty_pinned is TRUE. @@ -12721,8 +12719,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, if ( pop_mark_dirty_prot ) { - mark_pinned_or_protected_entry_dirty(entry_type, - entry_idx); + mark_entry_dirty(entry_type, entry_idx); } unprotect_entry(file_ptr, entry_type, entry_idx, @@ -12730,13 +12727,12 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, if ( mark_dirty ) { - mark_pinned_entry_dirty(entry_type, entry_idx, FALSE, (size_t)0); + mark_entry_dirty(entry_type, entry_idx); } if ( pop_mark_dirty_pinned ) { - mark_pinned_or_protected_entry_dirty(entry_type, - entry_idx); + mark_entry_dirty(entry_type, entry_idx); } } @@ -12991,7 +12987,7 @@ check_get_entry_status(void) } } - mark_pinned_entry_dirty(0, 0, FALSE, (size_t)0); + mark_entry_dirty(0, 0); if ( pass ) { @@ -16644,13 +16640,7 @@ check_double_unprotect_err(void) * * Purpose: Verify that: * - * 1) a call to H5C_mark_pinned_entry_dirty with an upinned - * entry as the target will generate an error. - * - * 2) a call to H5C_mark_pinned_entry_dirty with a protected - * entry as the target will generate an error. - * - * 3) a call to H5C_mark_pinned_or_protected_entry_dirty with + * 1) a call to H5C_mark_entry_dirty with * and unpinned and unprotected entry will generate an * error. * @@ -16659,10 +16649,6 @@ check_double_unprotect_err(void) * Programmer: John Mainzer * 5/17/06 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -16678,14 +16664,8 @@ check_mark_entry_dirty_errs(void) pass = TRUE; - /* allocate a cache, protect an entry, and then attempt to mark it dirty - * with the H5C_mark_pinned_entry_dirty() call -- This should fail. - * - * Then unprotect the entry without pinning it, and try to mark it dirty - * again -- this should fail too. - * - * Try it again using H5C_mark_pinned_or_protected_entry_dirty -- this - * should fail as well. + /* allocate a cache, protect an entry, unprotect the entry without + * pinning it, and try to mark it dirty -- this should fail. * * Destroy the cache -- should succeed. */ @@ -16699,52 +16679,21 @@ check_mark_entry_dirty_errs(void) protect_entry(file_ptr, 0, 0); - unprotect_entry(file_ptr, 0, 0, FALSE, H5C__PIN_ENTRY_FLAG); - - protect_entry(file_ptr, 0, 0); + unprotect_entry(file_ptr, 0, 0, FALSE, H5C__NO_FLAGS_SET); entry_ptr = &((entries[0])[0]); } if ( pass ) { - result = H5C_mark_pinned_entry_dirty((void *)entry_ptr, FALSE, (size_t)0); - - if ( result > 0 ) { - - pass = FALSE; - failure_mssg = - "attempt dirty a pinned and protected entry succeeded.\n"; - - } else { - - unprotect_entry(file_ptr, 0, 0, FALSE, H5C__UNPIN_ENTRY_FLAG); - } - } - - if ( pass ) { - - result = H5C_mark_pinned_entry_dirty((void *)entry_ptr, FALSE, (size_t)0); - - - if ( result > 0 ) { - - pass = FALSE; - failure_mssg = - "attempt to dirty a unpinned and unprotected entry succeeded 1.\n"; - } - } - - if ( pass ) { - - result = H5C_mark_pinned_or_protected_entry_dirty((void *)entry_ptr); + result = H5C_mark_entry_dirty((void *)entry_ptr); if ( result > 0 ) { pass = FALSE; failure_mssg = - "attempt to dirty a unpinned and unprotected entry succeeded 2.\n"; + "attempt to dirty a unpinned and unprotected entry succeeded.\n"; } } diff --git a/test/cache_common.c b/test/cache_common.c index 5036b27..7effcc3 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1297,7 +1297,7 @@ create_pinned_entry_dependency(H5F_t * file_ptr, * If the dirty_pin parameter is true, verify that the * target entry is in the cache and is pinned. If it * isn't, scream and die. If it is, use the - * H5C_mark_pinned_entry_dirty() call to dirty it. + * H5C_mark_entry_dirty() call to dirty it. * * Do nothing if pass is false on entry. * @@ -1350,7 +1350,7 @@ dirty_entry(H5F_t * file_ptr, } else { - mark_pinned_entry_dirty(type, idx, FALSE, (size_t)0); + mark_entry_dirty(type, idx); } } @@ -1640,7 +1640,7 @@ reset_entries(void) * If the resize_pin parameter is true, verify that the * target entry is in the cache and is pinned. If it * isn't, scream and die. If it is, use the - * H5C_mark_pinned_entry_dirty() call to resize it. + * H5C_resize_pinned_entry() call to resize it. * * Do nothing if pass is false on entry. * @@ -1695,7 +1695,7 @@ resize_entry(H5F_t * file_ptr, } else { - mark_pinned_entry_dirty(type, idx, TRUE, new_size); + resize_pinned_entry(cache_ptr, type, idx, new_size); } } } else { @@ -2740,7 +2740,7 @@ insert_entry(H5F_t * file_ptr, /*------------------------------------------------------------------------- - * Function: mark_pinned_entry_dirty() + * Function: mark_entry_dirty() * * Purpose: Mark the specified entry as dirty. * @@ -2755,10 +2755,8 @@ insert_entry(H5F_t * file_ptr, */ void -mark_pinned_entry_dirty(int32_t type, - int32_t idx, - hbool_t size_changed, - size_t new_size) +mark_entry_dirty(int32_t type, + int32_t idx) { /* const char * fcn_name = "mark_pinned_entry_dirty()"; */ herr_t result; @@ -2776,127 +2774,23 @@ mark_pinned_entry_dirty(int32_t type, HDassert( entry_ptr->index == idx ); HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); - HDassert( ! (entry_ptr->header.is_protected) ); - HDassert( entry_ptr->header.is_pinned ); - HDassert( entry_ptr->is_pinned ); + HDassert( entry_ptr->header.is_protected || + entry_ptr->header.is_pinned ); entry_ptr->is_dirty = TRUE; - if ( size_changed ) { - - /* update entry size now to keep the sanity checks happy */ - entry_ptr->size = new_size; - } - - result = H5C_mark_pinned_entry_dirty((void *)entry_ptr, - size_changed, - new_size); + result = H5C_mark_entry_dirty((void *)entry_ptr); if ( ( result < 0 ) || - ( ! (entry_ptr->header.is_dirty) ) || - ( ! (entry_ptr->header.is_pinned) ) || + ( !entry_ptr->header.is_protected && !entry_ptr->header.is_pinned ) || + ( entry_ptr->header.is_protected && !entry_ptr->header.dirtied ) || + ( !entry_ptr->header.is_protected && !entry_ptr->header.is_dirty ) || ( entry_ptr->header.type != &(types[type]) ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { -#if 0 /* This is useful debugging code -- keep it around */ - HDfprintf(stdout, "result = %ld.\n", (long)result); - HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n", - (int)(entry_ptr->header.is_dirty)); - HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n", - (int)(entry_ptr->header.is_pinned)); - HDfprintf(stdout, - "(entry_ptr->header.type != &(types[type])) = %d.\n", - (int)(entry_ptr->header.type != &(types[type]))); - HDfprintf(stdout, - "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n", - (long)(entry_ptr->size), (long)(entry_ptr->header.size)); - HDfprintf(stdout, - "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n", - (long)(entry_ptr->addr), (long)(entry_ptr->header.addr)); -#endif - pass = FALSE; - failure_mssg = "error in H5C_mark_pinned_entry_dirty()."; - - } - - HDassert( ((entry_ptr->header).type)->id == type ); - - } - - return; - -} /* mark_pinned_entry_dirty() */ - - -/*------------------------------------------------------------------------- - * Function: mark_pinned_or_protected_entry_dirty() - * - * Purpose: Mark the specified entry as dirty. - * - * Do nothing if pass is FALSE on entry. - * - * Return: void - * - * Programmer: John Mainzer - * 5/17/06 - * - *------------------------------------------------------------------------- - */ - -void -mark_pinned_or_protected_entry_dirty(int32_t type, - int32_t idx) -{ - /* const char * fcn_name = "mark_pinned_or_protected_entry_dirty()"; */ - herr_t result; - test_entry_t * base_addr; - test_entry_t * entry_ptr; - - if ( pass ) { - - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); - HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); - - base_addr = entries[type]; - entry_ptr = &(base_addr[idx]); - - HDassert( entry_ptr->index == idx ); - HDassert( entry_ptr->type == type ); - HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->header.is_protected || - entry_ptr->header.is_pinned ); - - entry_ptr->is_dirty = TRUE; - - result = H5C_mark_pinned_or_protected_entry_dirty((void *)entry_ptr); - - if ( ( result < 0 ) - || - ( ( ! (entry_ptr->header.is_protected) ) - && - ( ! (entry_ptr->header.is_pinned) ) - ) - || - ( ( entry_ptr->header.is_protected ) - && - ( ! ( entry_ptr->header.dirtied ) ) - ) - || - ( ( ! ( entry_ptr->header.is_protected ) ) - && - ( ! ( entry_ptr->header.is_dirty ) ) - ) - || - ( entry_ptr->header.type != &(types[type]) ) - || - ( entry_ptr->size != entry_ptr->header.size ) - || - ( entry_ptr->addr != entry_ptr->header.addr ) ) { - pass = FALSE; - failure_mssg = - "error in H5C_mark_pinned_or_protected_entry_dirty()."; + failure_mssg = "error in H5C_mark_entry_dirty()."; } @@ -2906,7 +2800,7 @@ mark_pinned_or_protected_entry_dirty(int32_t type, return; -} /* mark_pinned_or_protected_entry_dirty() */ +} /* mark_entry_dirty() */ /*------------------------------------------------------------------------- diff --git a/test/cache_common.h b/test/cache_common.h index 07edd9b..057bb4e 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -168,13 +168,13 @@ typedef struct flush_op * FLUSH_OP__DIRTY: TRUE iff the * target is pinned, and is to * be dirtied via the - * H5C_mark_pinned_entry_dirty() + * H5C_mark_entry_dirty() * call. * * FLUSH_OP__RESIZE: TRUE iff the * target is pinned, and is to * be resized via the - * H5C_mark_pinned_entry_dirty() + * H5C_mark_entry_dirty() * call. * * FLUSH_OP__RENAME: TRUE iff the @@ -607,13 +607,8 @@ void insert_entry(H5F_t * file_ptr, hbool_t dirty, unsigned int flags); -void mark_pinned_entry_dirty(int32_t type, - int32_t idx, - hbool_t size_changed, - size_t new_size); - -void mark_pinned_or_protected_entry_dirty(int32_t type, - int32_t idx); +void mark_entry_dirty(int32_t type, + int32_t idx); void rename_entry(H5C_t * cache_ptr, int32_t type, diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 0e9da15..dc68d87 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -352,8 +352,8 @@ void lock_and_unlock_random_entries(H5C_t * cache_ptr, H5F_t * file_ptr, void lock_and_unlock_random_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int min_idx, int max_idx); void lock_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx); -void mark_pinned_entry_dirty(int32_t idx, hbool_t size_changed, size_t new_size); -void mark_pinned_or_protected_entry_dirty(int32_t idx); +void mark_entry_dirty(H5C_t * cache_ptr, H5F_t * file_ptr, + int32_t idx); void pin_entry(H5C_t * cache_ptr, H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); void pin_protected_entry(int32_t idx, hbool_t global); @@ -2731,7 +2731,7 @@ lock_entry(H5C_t * cache_ptr, /***************************************************************************** - * Function: mark_pinned_entry_dirty() + * Function: mark_entry_dirty() * * Purpose: Mark dirty the entry indicated by the index, * @@ -2742,21 +2742,21 @@ lock_entry(H5C_t * cache_ptr, * Programmer: John Mainzer * 4/14/06 * - * Modifications: - * *****************************************************************************/ void -mark_pinned_entry_dirty(int32_t idx, - hbool_t size_changed, - size_t new_size) +mark_entry_dirty(H5C_t * cache_ptr, + H5F_t * file_ptr, + int32_t idx) { - const char * fcn_name = "mark_pinned_entry_dirty()"; + const char * fcn_name = "mark_entry_dirty()"; herr_t result; struct datum * entry_ptr; if ( nerrors == 0 ) { + HDassert( file_ptr ); + HDassert( cache_ptr ); HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) ); HDassert( idx < virt_num_data_entries ); @@ -2768,16 +2768,14 @@ mark_pinned_entry_dirty(int32_t idx, (entry_ptr->ver)++; entry_ptr->dirty = TRUE; - result = H5AC_mark_pinned_entry_dirty((void *)entry_ptr, - size_changed, - new_size); + result = H5AC_mark_entry_dirty( (void *)entry_ptr); if ( result < 0 ) { nerrors++; if ( verbose ) { HDfprintf(stdout, - "%d:%s: error in H5AC_mark_pinned_entry_dirty().\n", + "%d:%s: error in H5AC_mark_entry_dirty().\n", world_mpi_rank, fcn_name); } } @@ -2789,65 +2787,7 @@ mark_pinned_entry_dirty(int32_t idx, return; -} /* mark_pinned_entry_dirty() */ - - -/***************************************************************************** - * Function: mark_pinned_or_protected_entry_dirty() - * - * Purpose: Use the H5AC_mark_pinned_or_protected_entry_dirty() call to - * mark dirty the entry indicated by the index, - * - * Do nothing if nerrors is non-zero on entry. - * - * Return: void - * - * Programmer: John Mainzer - * 5/18/06 - * - * Modifications: - * - *****************************************************************************/ - -void -mark_pinned_or_protected_entry_dirty(int32_t idx) -{ - const char * fcn_name = "mark_pinned_or_protected_entry_dirty()"; - herr_t result; - struct datum * entry_ptr; - - if ( nerrors == 0 ) { - - HDassert( ( 0 <= idx ) && ( idx < NUM_DATA_ENTRIES ) ); - HDassert( idx < virt_num_data_entries ); - - entry_ptr = &(data[idx]); - - HDassert ( entry_ptr->locked || entry_ptr->global_pinned ); - - (entry_ptr->ver)++; - entry_ptr->dirty = TRUE; - - result = H5AC_mark_pinned_or_protected_entry_dirty((void *)entry_ptr); - - if ( result < 0 ) { - - nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: error in %s.\n", - world_mpi_rank, fcn_name, - "H5AC_mark_pinned_or_protected_entry_dirty()"); - } - } - else if ( ! ( entry_ptr->locked ) ) - { - global_dirty_pins++; - } - } - - return; - -} /* mark_pinned_or_protected_entry_dirty() */ +} /* mark_entry_dirty() */ /***************************************************************************** @@ -3715,7 +3655,7 @@ unpin_entry(H5C_t * cache_ptr, if ( dirty ) { - mark_pinned_entry_dirty(idx, FALSE, (size_t)0); + mark_entry_dirty(cache_ptr, file_ptr, idx); } @@ -4997,8 +4937,7 @@ smoke_check_4(void) * Function: smoke_check_5() * * Purpose: Similar to smoke check 1, but modified to verify that - * H5AC_mark_pinned_or_protected_entry_dirty() works in - * the parallel case. + * H5AC_mark_entry_dirty() works in the parallel case. * * Return: Success: TRUE * @@ -5080,7 +5019,7 @@ smoke_check_5(void) if ( i % 2 == 0 ) { - mark_pinned_or_protected_entry_dirty(i); + mark_entry_dirty(cache_ptr, file_ptr, i); } unlock_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET); @@ -5111,13 +5050,9 @@ smoke_check_5(void) } if ( i % 4 == 0 ) - { - mark_pinned_or_protected_entry_dirty(i); - } + mark_entry_dirty(cache_ptr, file_ptr, i); else - { - mark_pinned_entry_dirty(i, FALSE, (size_t)0); - } + mark_entry_dirty(cache_ptr, file_ptr, i); if ( i % 8 <= 4 ) { @@ -5217,8 +5152,7 @@ smoke_check_5(void) * * - H5AC_flush() * - H5AC_set() - * - H5AC_mark_pinned_entry_dirty() - * - H5AC_mark_pinned_or_protected_entry_dirty() + * - H5AC_mark_entry_dirty() * H5AC_rename() * - H5AC_pin_protected_entry() * - H5AC_protect() @@ -5261,7 +5195,7 @@ trace_file_check(void) "H5AC_set 0x4 15 0x0 4 0\n", "H5AC_set 0x8 15 0x0 6 0\n", "H5AC_protect 0 15 H5AC_WRITE 2 1\n", - "H5AC_mark_pinned_or_protected_entry_dirty 0 0\n", + "H5AC_mark_entry_dirty 0 0\n", "H5AC_unprotect 0 15 0 0 0\n", "H5AC_protect 2 15 H5AC_WRITE 2 1\n", "H5AC_pin_protected_entry 2 0\n", @@ -5271,7 +5205,7 @@ trace_file_check(void) "H5AC_protect 4 15 H5AC_WRITE 4 1\n", "H5AC_pin_protected_entry 4 0\n", "H5AC_unprotect 4 15 0 0 0\n", - "H5AC_mark_pinned_entry_dirty 0x4 0 0 0\n", + "H5AC_mark_entry_dirty 0x4 0 0 0\n", "H5AC_resize_pinned_entry 0x4 2 0\n", "H5AC_resize_pinned_entry 0x4 4 0\n", "H5AC_unpin_entry 4 0\n", @@ -5367,7 +5301,7 @@ trace_file_check(void) insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET); lock_entry(cache_ptr, file_ptr, 0); - mark_pinned_or_protected_entry_dirty(0); + mark_entry_dirty(cache_ptr, file_ptr, 0); unlock_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET); lock_entry(cache_ptr, file_ptr, 1); @@ -5380,7 +5314,7 @@ trace_file_check(void) lock_entry(cache_ptr, file_ptr, 2); pin_protected_entry(2, TRUE); unlock_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET); - mark_pinned_entry_dirty(2, FALSE, 0); + mark_entry_dirty(cache_ptr, file_ptr, 2); resize_entry(2, data[2].len / 2); resize_entry(2, data[2].len); unpin_entry(cache_ptr, file_ptr, 2, TRUE, FALSE, FALSE); -- cgit v0.12