diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-04-14 04:21:18 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-04-14 04:21:18 (GMT) |
commit | c54ea2b9783c89554ab84cd48b5a6c689afe5e33 (patch) | |
tree | 47e6bc8d3f6b44e114654b3fb344907b5cd194b0 /src/H5ACprivate.h | |
parent | c2c94ab707c9f06120670266d7d2f4609e210f0d (diff) | |
download | hdf5-c54ea2b9783c89554ab84cd48b5a6c689afe5e33.zip hdf5-c54ea2b9783c89554ab84cd48b5a6c689afe5e33.tar.gz hdf5-c54ea2b9783c89554ab84cd48b5a6c689afe5e33.tar.bz2 |
[svn-r6646] Purpose:
Code cleanup, bug fix & new feature.
Description:
Moved some "package-scope" information out of the private header file and
into the code module. (code cleanup).
Fixed a few places where the "destroy but don't flush" code wasn't working
correctly, which mostly affects the FPH5 effort. (bug fix).
Added the ability to "unprotect" a metadata object and delete it at the
same time. (new feature).
Platforms tested:
FreeBSD 4.8 (sleipnir) w/C++
Linux 2.4 (burrwhite) w/FORTRAN
Solaris 2.7 (arabica) w/FORTRAN
IRIX64 6.5 (modi4) w/parallel & FORTRAN
(h5committest not run due to my ongoing difficulties with C++ on burrwhite).
Diffstat (limited to 'src/H5ACprivate.h')
-rw-r--r-- | src/H5ACprivate.h | 73 |
1 files changed, 25 insertions, 48 deletions
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index d1edf7c..06e3a27 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -45,16 +45,6 @@ # undef H5AC_DEBUG #endif -/* 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) */ -extern hid_t H5AC_dxpl_id; - -/* Dataset transfer property list for independent metadata I/O calls */ -/* (just "library internal" set - i.e. independent transfer mode) */ -/* (Global variable declaration, definition is in H5AC.c) */ -extern hid_t H5AC_ind_dxpl_id; - /* * Class methods pertaining to caching. Each type of cached object will * have a constant variable with permanent life-span that describes how @@ -68,7 +58,12 @@ extern hid_t H5AC_ind_dxpl_id; * wise for the data structure to include dirty flags to * indicate whether it really needs to be written. This * function is also responsible for freeing memory allocated - * by the LOAD method if the DEST argument is non-zero. + * by the LOAD method if the DEST argument is non-zero (by + * calling the DEST method). + * + * DEST: Just frees memory allocated by the LOAD method. + * + * CLEAR: Just marks object as non-dirty. */ typedef enum H5AC_subid_t { H5AC_BT_ID = 0, /*B-tree nodes */ @@ -82,12 +77,14 @@ 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); typedef struct H5AC_class_t { H5AC_subid_t id; - H5AC_load_func_t load; - H5AC_flush_func_t flush; + H5AC_load_func_t load; + H5AC_flush_func_t flush; H5AC_dest_func_t dest; + H5AC_clear_func_t clear; } H5AC_class_t; /* @@ -96,10 +93,6 @@ typedef struct H5AC_class_t { * own cache, an array of slots. */ #define H5AC_NSLOTS 10330 /* The library "likes" this number... */ -#define H5AC_HASH_DIVISOR 8 /* Attempt to spread out the hashing */ - /* This should be the same size as the alignment of */ - /* of the smallest file format object written to the file. */ -#define H5AC_HASH(F,ADDR) H5F_addr_hash((ADDR/H5AC_HASH_DIVISOR),(F)->shared->cache->nslots) typedef struct H5AC_info_t { const H5AC_class_t *type; /*type of object stored here */ @@ -108,37 +101,11 @@ typedef struct H5AC_info_t { } H5AC_info_t; typedef H5AC_info_t *H5AC_info_ptr_t; /* Typedef for free lists */ -#ifdef H5AC_DEBUG -typedef struct H5AC_prot_t { - int nprots; /*number of things protected */ - int aprots; /*nelmts of `prot' array */ - H5AC_info_t **slot; /*array of pointers to protected things */ -} H5AC_prot_t; -#endif /* H5AC_DEBUG */ - -typedef struct H5AC_t { - unsigned nslots; /*number of cache slots */ - H5AC_info_t **slot; /*the cache slots, an array of pointers to the cached objects */ - H5AC_info_t **dslot; /*"held object" cache slots, an array of pointers to dirty cached objects */ -#ifdef H5AC_DEBUG - H5AC_prot_t *prot; /*the protected slots */ -#endif /* H5AC_DEBUG */ - int nprots; /*number of protected objects */ -#ifdef H5AC_DEBUG - struct { - unsigned nhits; /*number of cache hits */ - unsigned nmisses; /*number of cache misses */ - unsigned ninits; /*number of cache inits */ - unsigned nflushes; /*number of flushes to disk */ -#ifdef H5_HAVE_PARALLEL - unsigned ndestroys; /*number of cache destroys */ - unsigned nholds; /*number of cache holds */ - unsigned nrestores; /*number of cache restores */ -#endif /* H5_HAVE_PARALLEL */ - } diagnostics[H5AC_NTYPES]; /*diagnostics for each type of object*/ -#endif /* H5AC_DEBUG */ -} H5AC_t; +/* Typedef for metadata cache (defined in H5AC.c) */ +typedef struct H5AC_t H5AC_t; +/* Metadata specific properties for FAPL */ +/* (Only used for parallel I/O) */ #ifdef H5_HAVE_PARALLEL /* Definitions for "block before metadata write" property */ #define H5AC_BLOCK_BEFORE_META_WRITE_NAME "H5AC_block_before_meta_write" @@ -151,6 +118,16 @@ typedef struct H5AC_t { #define H5AC_LIBRARY_INTERNAL_DEF 0 #endif /* H5_HAVE_PARALLEL */ +/* 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) */ +extern hid_t H5AC_dxpl_id; + +/* Dataset transfer property list for independent metadata I/O calls */ +/* (just "library internal" set - i.e. independent transfer mode) */ +/* (Global variable declaration, definition is in H5AC.c) */ +extern hid_t H5AC_ind_dxpl_id; + /* * Library prototypes. */ @@ -161,7 +138,7 @@ H5_DLL herr_t H5AC_set(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_ H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2); H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, - void *thing); + void *thing, hbool_t deleted); H5_DLL void *H5AC_find(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, const void *udata1, void *udata2); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, |