summaryrefslogtreecommitdiffstats
path: root/src/H5AC.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-03-19 18:58:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-03-19 18:58:54 (GMT)
commita52914987ebff61d0347172e11520af02a5a6b4f (patch)
tree2bfce5cf8f4a54dfb07b5e1a6a13c3404237722f /src/H5AC.c
parentd317b8b404bea67439bf9dbb8565f5532d69aa1a (diff)
downloadhdf5-a52914987ebff61d0347172e11520af02a5a6b4f.zip
hdf5-a52914987ebff61d0347172e11520af02a5a6b4f.tar.gz
hdf5-a52914987ebff61d0347172e11520af02a5a6b4f.tar.bz2
[svn-r6497] Purpose:
Finish code cleanup Description: Wrap up the conversion of H5F_flush's multiple boolean flags into a single bitfield of flags by pushing the flags down into the H5AC_flush and H5F_istore_flush routines. Also, changed the flags from H5_FLUSH_<foo> to H5F_FLUSH_<foo> to be more consistent with rest of library. And reverted the changes to H5FDflush and H5FD_flush routines. Platforms tested: FreeBSD 4.7 (sleipnir) Solaris 5.8 (sol) IRIX64 6.5 (modi4) w/parallel Misc. update:
Diffstat (limited to 'src/H5AC.c')
-rw-r--r--src/H5AC.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 9c007ce..1ab8ba6 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -385,7 +385,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
assert(f->shared->cache);
cache = f->shared->cache;
- if (H5AC_flush(f, dxpl_id, NULL, HADDR_UNDEF, TRUE) < 0)
+ if (H5AC_flush(f, dxpl_id, NULL, HADDR_UNDEF, H5F_FLUSH_INVALIDATE) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache");
#ifdef H5AC_DEBUG
@@ -713,13 +713,15 @@ H5AC_compare(const void *_a, const void *_b)
*-------------------------------------------------------------------------
*/
herr_t
-H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, hbool_t destroy)
+H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, unsigned flags)
{
unsigned i;
herr_t status;
H5AC_flush_func_t flush=NULL;
H5AC_info_t **info;
int *map = NULL;
+ hbool_t destroy=(flags&H5F_FLUSH_INVALIDATE)>0;
+ hbool_t clear_only=(flags&H5F_FLUSH_CLEAR_ONLY)>0;
unsigned nslots;
H5AC_t *cache;
herr_t ret_value=SUCCEED; /* Return value */
@@ -828,19 +830,25 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, hboo
flush = (*info)->type->flush;
- /* Only block for all the processes on the first piece of metadata */
- if(first_flush && (*info)->dirty) {
- status = (flush)(f, dxpl_id, destroy, (*info)->addr, (*info));
- first_flush=0;
- } /* end if */
- else
- status = (flush)(f, H5AC_noblock_dxpl_id, destroy, (*info)->addr, (*info));
- if (status < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache");
-
+ /* Clear the dirty flag only, if requested */
+ if(clear_only)
+ (*info)->dirty=0;
+ else {
+ /* Only block for all the processes on the first piece of metadata */
+ if(first_flush && (*info)->dirty) {
+ status = (flush)(f, dxpl_id, destroy, (*info)->addr, (*info));
+ first_flush=0;
+ } /* end if */
+ else
+ status = (flush)(f, H5AC_noblock_dxpl_id, destroy, (*info)->addr, (*info));
+ if (status < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache");
#ifdef H5AC_DEBUG
cache->diagnostics[type_id].nflushes++;
#endif /* H5AC_DEBUG */
+ } /* end else */
+
+ /* Destroy entry also, if asked */
if (destroy)
(*info)= NULL;
}
@@ -915,12 +923,20 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, hboo
/*
* Flush just this entry.
*/
- flush = (*info)->type->flush;
- if((flush)(f, dxpl_id, destroy, (*info)->addr, (*info)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object");
+
+ /* Clear the dirty flag only, if requested */
+ if(clear_only)
+ (*info)->dirty=0;
+ else {
+ flush = (*info)->type->flush;
+ if((flush)(f, dxpl_id, destroy, (*info)->addr, (*info)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush object");
#ifdef H5AC_DEBUG
- cache->diagnostics[type_id].nflushes++;
+ cache->diagnostics[type_id].nflushes++;
#endif /* H5AC_DEBUG */
+ } /* end else */
+
+ /* Destroy entry also, if asked */
if (destroy)
(*info)= NULL;
} /* end if */