diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-15 14:45:02 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-15 14:45:02 (GMT) |
commit | da1e2ca0893d82ae3faa42acebae48b428185d02 (patch) | |
tree | 36c68d4abedf388765f7cea36e758291ab18cd85 /src | |
parent | 7f4843c06bfdf62da93f4e7a68fda17a3b3e3070 (diff) | |
download | hdf5-da1e2ca0893d82ae3faa42acebae48b428185d02.zip hdf5-da1e2ca0893d82ae3faa42acebae48b428185d02.tar.gz hdf5-da1e2ca0893d82ae3faa42acebae48b428185d02.tar.bz2 |
[svn-r7369] Purpose:
Bug fix
Description:
The metadata cache 'destroy' callback routines need the file handle in
order for certain callback routines (currently just the H5HG one) to perform
extra cleanups. The recent change to call the 'destroy' callback from the
'clear' callback omitted this parameter.
Solution:
Add the file handle to the metadata cache 'clear' callbacks.
Platforms tested:
FreeBSD 4.8 (sleipnir)
too small to need h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC.c | 10 | ||||
-rw-r--r-- | src/H5ACprivate.h | 2 | ||||
-rw-r--r-- | src/H5B.c | 6 | ||||
-rw-r--r-- | src/H5Gnode.c | 6 | ||||
-rw-r--r-- | src/H5HG.c | 17 | ||||
-rw-r--r-- | src/H5HL.c | 6 | ||||
-rw-r--r-- | src/H5O.c | 30 |
7 files changed, 38 insertions, 39 deletions
@@ -879,7 +879,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, unsi /* Clear the dirty flag only, if requested */ if(clear_only) { /* Call the callback routine to clear all dirty flags for object */ - if(((*info)->type->clear)(*info, destroy)<0) + if(((*info)->type->clear)(f, *info, destroy)<0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to clear cache"); } /* end if */ else { @@ -982,7 +982,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, unsi /* Clear the dirty flag only, if requested */ if(clear_only) { /* Call the callback routine to clear all dirty flags for object */ - if(((*info)->type->clear)(*info, destroy)<0) + if(((*info)->type->clear)(f, *info, destroy)<0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to clear cache"); } /* end if */ else { @@ -1770,12 +1770,8 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, (*info)->addr = addr; } /* end if */ else { - /* Mark the thing as clean (prerequite for destroy routine) */ - if((type->clear)(thing, FALSE)<0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to clear object"); - /* Destroy previously cached thing */ - if ((type->dest)(f, thing)<0) + if ((type->clear)(f, thing, TRUE)<0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free object") } /* end else */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 616ed91..632de1f 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -77,7 +77,7 @@ typedef enum H5AC_subid_t { typedef void *(*H5AC_load_func_t)(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); typedef herr_t (*H5AC_flush_func_t)(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing); typedef herr_t (*H5AC_dest_func_t)(H5F_t *f, void *thing); -typedef herr_t (*H5AC_clear_func_t)(void *thing, hbool_t dest); +typedef herr_t (*H5AC_clear_func_t)(H5F_t *f, void *thing, hbool_t dest); typedef struct H5AC_class_t { H5AC_subid_t id; @@ -154,7 +154,7 @@ static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_ static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b); static herr_t H5B_dest(H5F_t *f, H5B_t *b); -static herr_t H5B_clear(H5B_t *b, hbool_t destroy); +static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy); /* H5B inherits cache-like properties from H5AC */ static const H5AC_class_t H5AC_BT[1] = {{ @@ -560,7 +560,7 @@ H5B_dest(H5F_t UNUSED *f, H5B_t *bt) *------------------------------------------------------------------------- */ static herr_t -H5B_clear(H5B_t *bt, hbool_t destroy) +H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; @@ -578,7 +578,7 @@ H5B_clear(H5B_t *bt, hbool_t destroy) bt->cache_info.dirty = FALSE; if (destroy) - if (H5B_dest(NULL, bt) < 0) + if (H5B_dest(f, bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node"); done: diff --git a/src/H5Gnode.c b/src/H5Gnode.c index a7880b4..65c463e 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -70,7 +70,7 @@ static H5G_node_t *H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const vo static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_t *sym); static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym); -static herr_t H5G_node_clear(H5G_node_t *sym, hbool_t destroy); +static herr_t H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy); /* B-tree callbacks */ static size_t H5G_node_sizeof_rkey(H5F_t *f, const void *_udata); @@ -550,7 +550,7 @@ H5G_node_dest(H5F_t UNUSED *f, H5G_node_t *sym) *------------------------------------------------------------------------- */ static herr_t -H5G_node_clear(H5G_node_t *sym, hbool_t destroy) +H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy) { int i; /* Local index variable */ herr_t ret_value = SUCCEED; @@ -573,7 +573,7 @@ H5G_node_clear(H5G_node_t *sym, hbool_t destroy) * preempted from the cache. */ if (destroy) - if (H5G_node_dest(NULL, sym) < 0) + if (H5G_node_dest(f, sym) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node"); done: @@ -119,7 +119,7 @@ static H5HG_heap_t *H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void static herr_t H5HG_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HG_heap_t *heap); static herr_t H5HG_dest(H5F_t *f, H5HG_heap_t *heap); -static herr_t H5HG_clear(H5HG_heap_t *heap, hbool_t destroy); +static herr_t H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy); /* * H5HG inherits cache-like properties from H5AC @@ -519,8 +519,10 @@ H5HG_dest (H5F_t *f, H5HG_heap_t *heap) *------------------------------------------------------------------------- */ static herr_t -H5HG_clear(H5HG_heap_t *heap, hbool_t destroy) +H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy) { + herr_t ret_value = SUCCEED; + FUNC_ENTER_NOINIT(H5HG_clear); /* Check arguments */ @@ -529,13 +531,12 @@ H5HG_clear(H5HG_heap_t *heap, hbool_t destroy) /* Mark heap as clean */ heap->cache_info.dirty = 0; - if (destroy) { - heap->chunk = H5FL_BLK_FREE(heap_chunk,heap->chunk); - heap->obj = H5FL_ARR_FREE(H5HG_obj_t,heap->obj); - H5FL_FREE(H5HG_heap_t, heap); - } + if (destroy) + if (H5HG_dest(f, heap) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection"); - FUNC_LEAVE_NOAPI(SUCCEED); +done: + FUNC_LEAVE_NOAPI(ret_value); } /* H5HG_clear() */ @@ -68,7 +68,7 @@ static H5HL_t *H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udat void *udata2); static herr_t H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HL_t *heap); static herr_t H5HL_dest(H5F_t *f, H5HL_t *heap); -static herr_t H5HL_clear(H5HL_t *heap, hbool_t destroy); +static herr_t H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy); /* * H5HL inherits cache-like properties from H5AC @@ -568,7 +568,7 @@ H5HL_dest(H5F_t UNUSED *f, H5HL_t *heap) *------------------------------------------------------------------------- */ static herr_t -H5HL_clear(H5HL_t *heap, hbool_t destroy) +H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy) { herr_t ret_value = SUCCEED; @@ -581,7 +581,7 @@ H5HL_clear(H5HL_t *heap, hbool_t destroy) heap->cache_info.dirty = 0; if (destroy) - if (H5HL_dest(NULL, heap) < 0) + if (H5HL_dest(f, heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection"); done: @@ -28,17 +28,16 @@ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ #define H5O_PACKAGE /*suppress error about including H5Opkg */ -#include "H5private.h" -#include "H5ACprivate.h" -#include "H5Eprivate.h" -#include "H5Fpkg.h" -#include "H5FLprivate.h" /*Free Lists */ -#include "H5FSprivate.h" /* Function Stack */ -#include "H5Iprivate.h" -#include "H5MFprivate.h" -#include "H5MMprivate.h" -#include "H5Opkg.h" /* Object header functions */ -#include "H5Pprivate.h" +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_FPHDF5 #include "H5FDfphdf5.h" /* FPHDF5 File Descriptor */ @@ -87,7 +86,7 @@ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata void *_udata2); static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh); static herr_t H5O_dest(H5F_t *f, H5O_t *oh); -static herr_t H5O_clear(H5O_t *oh, hbool_t destroy); +static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy); /* H5O inherits cache-like properties from H5AC */ static const H5AC_class_t H5AC_OHDR[1] = {{ @@ -336,6 +335,9 @@ H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint, H5G_entry_t *ent/*out*/, had * FPHDF5 driver or it is, but the captain only flag is set or if the * captain only flag just isn't set. */ + /* XXX: These conditions cover all possible boolean combinations and + * probably aren't what was meant... - QAK + */ if (!H5FD_is_fphdf5_driver(f->shared->lf) || !capt_only || (H5FD_fphdf5_is_captain(f->shared->lf) && capt_only)) ; #endif /* H5_HAVE_FPHDF5 */ @@ -895,7 +897,7 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) *------------------------------------------------------------------------- */ static herr_t -H5O_clear(H5O_t *oh, hbool_t destroy) +H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; @@ -917,7 +919,7 @@ H5O_clear(H5O_t *oh, hbool_t destroy) oh->cache_info.dirty=FALSE; if (destroy) - if (H5O_dest(NULL, oh) < 0) + if (H5O_dest(f, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data"); done: |