From 791ab755ac81dc50adabdfe269107722da90f659 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 6 Jun 2008 15:25:35 -0500 Subject: [svn-r15171] Description: Convert the symbol table node metadata cache client to use the new journaling cache callbacks. Also added a 'H5F_t *' parameter to the 'serialize' callback for the journaling cache, which makes the client's job much easier. Various minor coding cleanups, etc. also. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.5.3 (amazon) in debug mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode --- src/H5AC2.c | 2 +- src/H5AC2private.h | 2 +- src/H5Bcache.c | 17 +- src/H5C2.c | 21 ++- src/H5C2journal.c | 56 +----- src/H5C2pkg.h | 2 +- src/H5C2private.h | 16 +- src/H5F.c | 39 +--- src/H5Fdbg.c | 1 - src/H5Fprivate.h | 2 - src/H5Gent.c | 24 ++- src/H5Gnode.c | 478 ++++++++++++++++++-------------------------------- src/H5Gpkg.h | 9 +- src/H5MF.c | 6 +- src/H5MFprivate.h | 6 +- src/H5private.h | 16 +- test/cache2_api.c | 414 ++++++++++++++++++++++++++++++++++++++----- test/cache2_common.c | 30 ++-- test/cache2_common.h | 20 +-- test/cache2_journal.c | 26 +-- 20 files changed, 650 insertions(+), 537 deletions(-) diff --git a/src/H5AC2.c b/src/H5AC2.c index 12d63d3..5967497 100644 --- a/src/H5AC2.c +++ b/src/H5AC2.c @@ -3205,7 +3205,7 @@ done: */ herr_t -H5AC2_set_cache_auto_resize_config(const H5F_t * f, +H5AC2_set_cache_auto_resize_config(H5F_t * f, hid_t dxpl_id, H5AC2_cache_config_t *config_ptr) { diff --git a/src/H5AC2private.h b/src/H5AC2private.h index 520900b..4113842 100644 --- a/src/H5AC2private.h +++ b/src/H5AC2private.h @@ -338,7 +338,7 @@ H5_DLL herr_t H5AC2_get_cache_hit_rate(H5AC2_t * cache_ptr, H5_DLL herr_t H5AC2_reset_cache_hit_rate_stats(H5AC2_t * cache_ptr); -H5_DLL herr_t H5AC2_set_cache_auto_resize_config(const H5F_t * f, +H5_DLL herr_t H5AC2_set_cache_auto_resize_config(H5F_t * f, hid_t dxpl_id, H5AC2_cache_config_t *config_ptr); diff --git a/src/H5Bcache.c b/src/H5Bcache.c index f18dee2..2ecfcf3 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -56,9 +56,8 @@ /* Metadata cache callbacks */ static void *H5B_deserialize(haddr_t addr, size_t len, const void *image, const void *udata, hbool_t *dirty); -static herr_t H5B_serialize(haddr_t addr, size_t len, void *image, - void *thing, unsigned *flags, haddr_t *new_addr, - size_t *new_len, void **new_image); +static herr_t H5B_serialize(const H5F_t *f, haddr_t addr, size_t len, void *image, + void *thing, unsigned *flags, haddr_t *new_addr, size_t *new_len, void **new_image); static herr_t H5B_free_icr(haddr_t addr, size_t len, void *thing); @@ -66,7 +65,7 @@ static herr_t H5B_free_icr(haddr_t addr, size_t len, void *thing); /* Package Variables */ /*********************/ -/* H5B inherits cache-like properties from H5AC */ +/* H5B inherits cache-like properties from H5AC2 */ const H5AC2_class_t H5AC2_BT[1] = {{ H5AC2_BT_ID, "v1 B-tree", @@ -203,8 +202,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_serialize(haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, - unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, +H5B_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, void *image, + void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, size_t UNUSED *new_len, void UNUSED **new_image) { H5B_t *bt = (H5B_t *)_thing; /* Pointer to the B-tree node */ @@ -240,8 +239,8 @@ H5B_serialize(haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, UINT16ENCODE(p, bt->nchildren); /* sibling pointers */ - H5F_addr_encode_len(&p, bt->left, shared->sizeof_addr); - H5F_addr_encode_len(&p, bt->right, shared->sizeof_addr); + H5F_addr_encode(f, &p, bt->left); + H5F_addr_encode(f, &p, bt->right); /* child keys and pointers */ native = bt->native; @@ -253,7 +252,7 @@ H5B_serialize(haddr_t UNUSED addr, size_t UNUSED len, void *image, void *_thing, native += shared->type->sizeof_nkey; /* encode the child address */ - H5F_addr_encode_len(&p, bt->child[u], shared->sizeof_addr); + H5F_addr_encode(f, &p, bt->child[u]); } /* end for */ if(bt->nchildren > 0) { /* Encode the final key */ diff --git a/src/H5C2.c b/src/H5C2.c index 4ea6158..a85a78c 100644 --- a/src/H5C2.c +++ b/src/H5C2.c @@ -154,7 +154,7 @@ static herr_t H5C2__flash_increase_cache_size(H5C2_t * cache_ptr, size_t old_entry_size, size_t new_entry_size); -static herr_t H5C2_flush_single_entry(H5F_t * f, +static herr_t H5C2_flush_single_entry(const H5F_t * f, hid_t dxpl_id, H5C2_t * cache_ptr, const H5C2_class_t * type_ptr, @@ -162,7 +162,7 @@ static herr_t H5C2_flush_single_entry(H5F_t * f, unsigned flags, hbool_t del_entry_from_slist_on_destroy); -static herr_t H5C2_flush_invalidate_cache(H5F_t * f, +static herr_t H5C2_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, H5C2_t * cache_ptr, unsigned flags); @@ -212,7 +212,8 @@ static void * H5C2_epoch_marker_deserialize(haddr_t addr, hbool_t * dirty_ptr); static herr_t H5C2_epoch_marker_image_len(void * thing, size_t *image_len_ptr); -static herr_t H5C2_epoch_marker_serialize(haddr_t addr, +static herr_t H5C2_epoch_marker_serialize(const H5F_t *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -258,7 +259,7 @@ H5C2_epoch_marker_deserialize(haddr_t UNUSED addr, { void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(H5C2_epoch_marker_serialize, NULL) + FUNC_ENTER_NOAPI(H5C2_epoch_marker_deserialize, NULL) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "called unreachable fcn.") @@ -283,7 +284,8 @@ done: } static herr_t -H5C2_epoch_marker_serialize(haddr_t UNUSED addr, +H5C2_epoch_marker_serialize(const H5F_t UNUSED *f, + haddr_t UNUSED addr, size_t UNUSED len, void UNUSED * image_ptr, void UNUSED * thing, @@ -1291,7 +1293,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C2_flush_cache(H5F_t *f, +H5C2_flush_cache(const H5F_t *f, hid_t dxpl_id, unsigned flags) { @@ -7453,7 +7455,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5C2_flush_invalidate_cache(H5F_t * f, +H5C2_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, H5C2_t * cache_ptr, unsigned flags) @@ -8067,7 +8069,7 @@ done: */ static herr_t -H5C2_flush_single_entry(H5F_t * f, +H5C2_flush_single_entry(const H5F_t * f, hid_t dxpl_id, H5C2_t * cache_ptr, const H5C2_class_t * type_ptr, @@ -8460,7 +8462,8 @@ H5C2_flush_single_entry(H5F_t * f, if ( ! ( entry_ptr->image_up_to_date ) ) { - if ( entry_ptr->type->serialize(entry_ptr->addr, + if ( entry_ptr->type->serialize(f, + entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr, (void *)entry_ptr, diff --git a/src/H5C2journal.c b/src/H5C2journal.c index 3e6655e..e43e2bb 100644 --- a/src/H5C2journal.c +++ b/src/H5C2journal.c @@ -951,7 +951,8 @@ H5C2_journal_transaction(H5F_t * f, */ if ( ! ( entry_ptr->image_up_to_date ) ) { - result = entry_ptr->type->serialize(entry_ptr->addr, + result = entry_ptr->type->serialize(f, + entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr, (void *)entry_ptr, @@ -1401,7 +1402,7 @@ done: */ herr_t -H5C2_create_journal_config_block(H5F_t * f, +H5C2_create_journal_config_block(const H5F_t * f, hid_t dxpl_id, const char * journal_file_name_ptr) { @@ -1544,7 +1545,7 @@ done: */ herr_t -H5C2_discard_journal_config_block(H5F_t * f, +H5C2_discard_journal_config_block(const H5F_t * f, hid_t dxpl_id) { H5C2_t * cache_ptr; @@ -2645,15 +2646,10 @@ H5C2_jb__init(H5C2_jbrb_t * struct_ptr, } /* end if */ /* Initialize Fields of H5C2_jbrb_t structure */ -#if 0 /* JRM */ /* initial version */ - struct_ptr->jname = journal_file_name; -#else /* JRM */ /* revised version */ /* this should be modified to check error returns, etc. Also, should * probably do the same with the HDF5 file name. */ - struct_ptr->jname = (char *)H5MM_malloc(strlen(journal_file_name) + 1); - HDstrcpy(struct_ptr->jname, journal_file_name); -#endif /* JRM */ + struct_ptr->jname = HDstrdup(journal_file_name); struct_ptr->hdf5_file_name = HDF5_file_name; struct_ptr->buf_size = buf_size; struct_ptr->num_bufs = num_bufs; @@ -2736,7 +2732,7 @@ H5C2_jb__init(H5C2_jbrb_t * struct_ptr, /* Format the header message into a temporary buffer */ HDsnprintf(temp, (size_t)150, - "0 ver_num %ld target_file_name %s creation_date %010.10s human_readable %d\n", + "0 ver_num %ld target_file_name %s creation_date %10.10s human_readable %d\n", struct_ptr->jvers, struct_ptr->hdf5_file_name, ctime(¤t_date), @@ -2829,7 +2825,7 @@ H5C2_jb__start_transaction(H5C2_jbrb_t * struct_ptr, HDsnprintf(temp, (size_t)150, - "0 ver_num %ld target_file_name %s creation_date %010.10s human_readable %d\n", + "0 ver_num %ld target_file_name %s creation_date %10.10s human_readable %d\n", struct_ptr->jvers, struct_ptr->hdf5_file_name, ctime(¤t_date), @@ -3411,44 +3407,6 @@ done: /****************************************************************************** * - * Function: H5C2_jb__reconfigure - * - * Programmer: Mike McGreevy - * Wednesday, February 6, 2008 - * - * Purpose: Re-configure the specified journal buffer ring buffer - * to use the supplied parameters. - * - * Returns: SUCCEED on success. - * - ******************************************************************************/ - -herr_t -H5C2_jb__reconfigure(H5C2_jbrb_t * struct_ptr, - size_t new_buf_size, - int new_num_bufs, - hbool_t new_use_aio) -{ -#if 0 /* body commented out pending implementation */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5C2_jb__reconfigure, FAIL) - - /* code */ - /* code */ - /* code */ - -done: - - FUNC_LEAVE_NOAPI(ret_value) -#else - return FAIL; -#endif -} /* end H5C2_jb__reconfigure */ - - -/****************************************************************************** - * * Function: H5C2_jb__bin2hex * * Programmer: Mike McGreevy diff --git a/src/H5C2pkg.h b/src/H5C2pkg.h index 5245ce6..588b7ab 100644 --- a/src/H5C2pkg.h +++ b/src/H5C2pkg.h @@ -1240,7 +1240,7 @@ struct H5C2_t H5C2_cache_entry_t * jwipl_tail_ptr; hbool_t mdj_startup_pending; - H5F_t * mdj_startup_f; + H5F_t * mdj_startup_f; hid_t mdj_startup_dxpl_id; char * mdj_startup_jrnl_file_name; size_t mdj_startup_buf_size; diff --git a/src/H5C2private.h b/src/H5C2private.h index 8ac8d67..a7b421c 100644 --- a/src/H5C2private.h +++ b/src/H5C2private.h @@ -118,7 +118,7 @@ typedef struct H5C2_t H5C2_t; * * The typedef for the deserialize callback is as follows: * - * typedef void *(*H5C_deserialize_func_t)(haddr_t addr, + * typedef void *(*H5C2_deserialize_func_t)(haddr_t addr, * size_t len, * const void * image_ptr, * void * udata_ptr, @@ -450,7 +450,8 @@ typedef herr_t (*H5C2_image_len_func_t)(void *thing, #define H5C2__SERIALIZE_RESIZED_FLAG 0x1 #define H5C2__SERIALIZE_RENAMED_FLAG 0x2 -typedef herr_t (*H5C2_serialize_func_t)(haddr_t addr, +typedef herr_t (*H5C2_serialize_func_t)(const H5F_t *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1341,7 +1342,7 @@ H5_DLL herr_t H5C2_expunge_entry(H5F_t * f, const H5C2_class_t * type, haddr_t addr); -H5_DLL herr_t H5C2_flush_cache(H5F_t *f, +H5_DLL herr_t H5C2_flush_cache(const H5F_t *f, hid_t dxpl_id, unsigned flags); @@ -1555,11 +1556,6 @@ H5_DLL herr_t H5C2_jb__trunc(H5C2_jbrb_t * struct_ptr); H5_DLL herr_t H5C2_jb__takedown(H5C2_jbrb_t * struct_ptr); -H5_DLL herr_t H5C2_jb__reconfigure(H5C2_jbrb_t * struct_ptr, - size_t new_buf_size, - int new_num_bufs, - hbool_t new_use_aio); - H5_DLL herr_t H5C2_jb__bin2hex(const uint8_t * buf, char * hexdata, size_t * hexlength, @@ -1574,11 +1570,11 @@ H5_DLL herr_t H5C2_check_for_journaling(H5F_t * f, H5C2_t * cache_ptr, hbool_t journal_recovered); -H5_DLL herr_t H5C2_create_journal_config_block(H5F_t *f, +H5_DLL herr_t H5C2_create_journal_config_block(const H5F_t *f, hid_t dxpl_id, const char * journal_file_name_ptr); -H5_DLL herr_t H5C2_discard_journal_config_block(H5F_t * f, +H5_DLL herr_t H5C2_discard_journal_config_block(const H5F_t * f, hid_t dxpl_id); H5_DLL herr_t H5C2_get_journaling_in_progress(const H5F_t * f, diff --git a/src/H5F.c b/src/H5F.c index 21991cb..8a4b019 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -3088,7 +3088,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_addr_encode_len + * Function: H5F_addr_encode * * Purpose: Encodes an address into the buffer pointed to by *PP and * then increments the pointer to the first byte after the @@ -3099,53 +3099,30 @@ done: * Programmer: Robb Matzke * Friday, November 7, 1997 * + * Modifications: + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ void -H5F_addr_encode_len(uint8_t **pp/*in,out*/, haddr_t addr, unsigned addr_len) +H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) { unsigned u; /* Local index variable */ + HDassert(f); HDassert(pp && *pp); if(H5F_addr_defined(addr)) { - for(u = 0; u < addr_len; u++) { + for(u = 0; u < H5F_SIZEOF_ADDR(f); u++) { *(*pp)++ = (uint8_t)(addr & 0xff); addr >>= 8; } /* end for */ assert("overflow" && 0 == addr); } /* end if */ else { - for(u = 0; u < addr_len; u++) + for(u = 0; u < H5F_SIZEOF_ADDR(f); u++) *(*pp)++ = 0xff; } /* end else */ -} /* end H5F_addr_encode_len() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_addr_encode - * - * Purpose: Encodes an address into the buffer pointed to by *PP and - * then increments the pointer to the first byte after the - * address. An undefined value is stored as all 1's. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 7, 1997 - * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - *------------------------------------------------------------------------- - */ -void -H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) -{ - HDassert(f); - HDassert(pp && *pp); - - H5F_addr_encode_len(pp, addr, H5F_SIZEOF_ADDR(f)); } /* end H5F_addr_encode() */ diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 15ca0d9..d0fe402 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -136,7 +136,6 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) HDassert(root_oloc); root_ent.type = H5G_NOTHING_CACHED; root_ent.header = root_oloc->addr; - root_ent.file = f; /* Display root group symbol table entry info */ H5G_ent_debug(f, &root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 7b38d7b..903f56d 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -463,8 +463,6 @@ H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, const void *buf); /* Address-related functions */ -H5_DLL void H5F_addr_encode_len(uint8_t **pp/*in,out*/, haddr_t addr, - unsigned addr_len); H5_DLL void H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr); H5_DLL void H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, diff --git a/src/H5Gent.c b/src/H5Gent.c index e7be62f..7c0a2f6 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -34,8 +34,8 @@ /* Private macros */ /* Private prototypes */ -static herr_t H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); -static herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, +static herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); +static herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent/*out*/); /* Declare extern the PQ free list for the wrapped strings */ @@ -65,7 +65,7 @@ H5FL_BLK_EXTERN(str_buf); *------------------------------------------------------------------------- */ herr_t -H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) +H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) { unsigned u; herr_t ret_value=SUCCEED; /* Return value */ @@ -110,7 +110,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) +H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) { const uint8_t *p_ret = *pp; uint32_t tmp; @@ -122,8 +122,6 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) HDassert(pp); HDassert(ent); - ent->file = f; - /* decode header */ H5F_DECODE_LENGTH(f, *pp, ent->name_off); H5F_addr_decode(f, pp, &(ent->header)); @@ -180,7 +178,7 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) *------------------------------------------------------------------------- */ herr_t -H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) +H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) { unsigned u; herr_t ret_value=SUCCEED; /* Return value */ @@ -228,7 +226,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) +H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) { uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f); @@ -272,7 +270,8 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) } /* fill with zero */ - while (*pp < p_ret) *(*pp)++ = 0; + while(*pp < p_ret) + *(*pp)++ = 0; *pp = p_ret; FUNC_LEAVE_NOAPI(SUCCEED); @@ -423,9 +422,6 @@ H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type") } /* end switch */ - /* Set the file for the entry */ - ent->file = f; - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_ent_convert() */ @@ -445,7 +441,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream, +H5G_ent_debug(H5F_t *f, const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, H5HL_t *heap) { const char *lval = NULL; @@ -494,7 +490,7 @@ H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream, "Link value offset:", (unsigned long)(ent->cache.slink.lval_offset)); if(heap) { - lval = H5HL_offset_into(ent->file, heap, ent->cache.slink.lval_offset); + lval = H5HL_offset_into(f, heap, ent->cache.slink.lval_offset); HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, "Link value:", lval); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index e7a2d30..442cbf2 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -32,6 +32,7 @@ /* Packages needed by this file... */ #include "H5private.h" /* Generic Functions */ +#include "H5AC2private.h" /* Metadata cache #2 */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FLprivate.h" /* Free Lists */ @@ -58,10 +59,10 @@ typedef struct H5G_node_key_t { * table or group. */ typedef struct H5G_node_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - unsigned nsyms; /*number of symbols */ - H5G_entry_t *entry; /*array of symbol table entries */ + H5AC2_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + unsigned nsyms; /*number of symbols */ + H5G_entry_t *entry; /*array of symbol table entries */ } H5G_node_t; /* Private macros */ @@ -72,18 +73,17 @@ typedef struct H5G_node_t { #define H5G_NODE_BUF_SIZE 512 /* PRIVATE PROTOTYPES */ -static herr_t H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf); static size_t H5G_node_size_real(const H5F_t *f); static herr_t H5G_node_shared_free(void *shared); /* Metadata cache callbacks */ -static H5G_node_t *H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1, - void *_udata2); -static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, - H5G_node_t *sym, unsigned UNUSED * flags_ptr); -static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym); -static herr_t H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy); -static herr_t H5G_node_size(const H5F_t *f, const H5G_node_t *sym, size_t *size_ptr); +static void *H5G_node_deserialize(haddr_t addr, size_t len, const void *image, + const void *udata, hbool_t *dirty); +static herr_t H5G_node_serialize(const H5F_t *f, haddr_t addr, size_t len, + void *image, void *thing, unsigned *flags, haddr_t *new_addr, + size_t *new_len, void **new_image); +static herr_t H5G_node_free_icr(haddr_t addr, size_t len, void *thing); +static herr_t H5G_node_clear(haddr_t addr, size_t len, void *sym); /* B-tree callbacks */ static H5RC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata); @@ -110,14 +110,16 @@ static herr_t H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *key, const void *udata); -/* H5G inherits cache-like properties from H5AC */ -const H5AC_class_t H5AC_SNODE[1] = {{ - H5AC_SNODE_ID, - (H5AC_load_func_t)H5G_node_load, - (H5AC_flush_func_t)H5G_node_flush, - (H5AC_dest_func_t)H5G_node_dest, - (H5AC_clear_func_t)H5G_node_clear, - (H5AC_size_func_t)H5G_node_size, +/* H5G symbol table node inherits cache-like properties from H5AC2 */ +const H5AC2_class_t H5AC2_SNODE[1] = {{ + H5AC2_SNODE_ID, + "symbol table node", + H5FD_MEM_BTREE, + H5G_node_deserialize, + NULL, + H5G_node_serialize, + H5G_node_free_icr, + H5G_node_clear, }}; /* H5G inherits B-tree like properties from H5B */ @@ -309,70 +311,70 @@ H5G_node_size_real(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5G_node_load - * - * Purpose: Loads a symbol table node from the file. - * - * Return: Success: Ptr to the new table. + * Function: H5G_node_dest * - * Failure: NULL + * Purpose: Destroy a symbol table node in memory. * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 + * Return: Non-negative on success/Negative on failure * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jan 15 2003 * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. *------------------------------------------------------------------------- */ -static H5G_node_t * -H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1, - void UNUSED * _udata2) +static herr_t +H5G_node_dest(H5G_node_t *sym) { - H5G_node_t *sym = NULL; - size_t size; - H5WB_t *wb = NULL; /* Wrapped buffer for node data */ - uint8_t node_buf[H5G_NODE_BUF_SIZE]; /* Buffer for node */ - uint8_t *node; /* Pointer to node buffer */ - const uint8_t *p; - H5G_node_t *ret_value; /*for error handling */ - - FUNC_ENTER_NOAPI_NOINIT(H5G_node_load) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_dest); /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(!_udata1); - HDassert(NULL == _udata2); + HDassert(sym); - /* - * Initialize variables. - */ + /* Verify that node is clean */ + HDassert(sym->cache_info.is_dirty == FALSE); - /* Wrap the local buffer for serialized node info */ - if(NULL == (wb = H5WB_wrap(node_buf, sizeof(node_buf)))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't wrap buffer") + if(sym->entry) + sym->entry = H5FL_SEQ_FREE(H5G_entry_t, sym->entry); + H5FL_FREE(H5G_node_t,sym); - /* Compute the size of the serialized symbol table node on disk */ - size = H5G_node_size_real(f); + FUNC_LEAVE_NOAPI(SUCCEED); +} /* end H5G_node_dest() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_node_deserialize + * + * Purpose: Deserialize the data structure from disk. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Apr 14, 2008 + * + *------------------------------------------------------------------------- + */ +static void * +H5G_node_deserialize(haddr_t UNUSED addr, size_t UNUSED len, const void *image, + const void *udata, hbool_t UNUSED *dirty) +{ + H5G_node_t *sym = NULL; /* Pointer to the deserialized symbol table node */ + const H5F_t *f = (const H5F_t *)udata; /* Get file pointer from user data */ + const uint8_t *p; /* Pointer into image buffer */ + H5G_node_t *ret_value; /* Return value */ - /* Get a pointer to a buffer that's large enough for node */ - if(NULL == (node = H5WB_actual(wb, size))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't get actual buffer") + FUNC_ENTER_NOAPI_NOINIT(H5G_node_deserialize) - /* Read the serialized symbol table node. */ - if(H5F_block_read(f, H5FD_MEM_BTREE, addr, size, dxpl_id, node) < 0) - HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read symbol table node") + /* check arguments */ + HDassert(image); + HDassert(f); - /* Get temporary pointer to serialized node */ - p = node; + /* Get temporary pointer to serialized symbol table node */ + p = image; /* magic */ if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC)) @@ -399,159 +401,54 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1 if(H5G_ent_decode_vec(f, &p, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries") + /* Sanity check */ + HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); + /* Set return value */ ret_value = sym; done: - /* Release resources */ - if(wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") if(!ret_value) - if(sym && H5G_node_dest(f, sym) < 0) + if(sym && H5G_node_dest(sym) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_load() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_node_flush - * - * Purpose: Flush a symbol table node to disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 - * - * Modifications: - * rky, 1998-08-28 - * Only p0 writes metadata to disk. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. - * - * Pedro Vicente, 18 Sep 2002 - * Added `id to name' support. - * - * JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_t *sym, unsigned UNUSED * flags_ptr) -{ - H5WB_t *wb = NULL; /* Wrapped buffer for node data */ - uint8_t node_buf[H5G_NODE_BUF_SIZE]; /* Buffer for node */ - unsigned u; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5G_node_flush) - - /* - * Check arguments. - */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(sym); - - /* - * Look for dirty entries and set the node dirty flag. - */ - for(u = 0; u < sym->nsyms; u++) - if(sym->entry[u].dirty) { - /* Set the node's dirty flag */ - sym->cache_info.is_dirty = TRUE; - - /* Reset the entry's dirty flag */ - sym->entry[u].dirty = FALSE; - } /* end if */ - - /* - * Write the symbol node to disk. - */ - if(sym->cache_info.is_dirty) { - uint8_t *node; /* Pointer to node buffer */ - size_t size; - - /* Wrap the local buffer for serialized node info */ - if(NULL == (wb = H5WB_wrap(node_buf, sizeof(node_buf)))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer") - - /* Compute the size of the serialized symbol table node on disk */ - size = H5G_node_size_real(f); - - /* Get a pointer to a buffer that's large enough for node */ - if(NULL == (node = H5WB_actual(wb, size))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") - - /* Serialize symbol table node into buffer */ - if(H5G_node_serialize(f, sym, size, node) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSERIALIZE, FAIL, "node serialization failed") - - /* Write the serialized symbol table node. */ - if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, node) < 0) - HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "unable to write symbol table node to the file") - - /* Reset the node's dirty flag */ - sym->cache_info.is_dirty = FALSE; - } /* end if */ - - /* - * Destroy the symbol node? This might happen if the node is being - * preempted from the cache. - */ - if(destroy) - if(H5G_node_dest(f, sym) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node") - -done: - /* Release resources */ - if(wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_node_flush() */ +} /* end H5G_node_deserialize() */ /*------------------------------------------------------------------------- * Function: H5G_node_serialize * - * Purpose: Serialize the symbol table node - * - * Return: Non-negative on success/Negative on failure + * Purpose: Serialize the data structure for writing to disk. * - * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu - * Sept. 16, 2003 + * Return: Success: SUCCEED + * Failure: FAIL * - * Modifications: + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Mar 24, 2008 * *------------------------------------------------------------------------- */ static herr_t -H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf) +H5G_node_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, + void *image, void *_thing, unsigned *flags, haddr_t UNUSED *new_addr, + size_t UNUSED *new_len, void UNUSED **new_image) { - uint8_t *p; - herr_t ret_value = SUCCEED; + H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to the Symbol Table node */ + size_t size; /* Size of symbol table node in file */ + uint8_t *p; /* Pointer into image buffer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_node_serialize); + FUNC_ENTER_NOAPI_NOINIT(H5G_node_serialize) - /* check args */ - assert(f); - assert(sym); - assert(buf); + /* check arguments */ + HDassert(image); + HDassert(sym); + HDassert(flags); - p = buf; + /* Set the local pointer into the serialized image */ + p = image; /* magic number */ HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC); @@ -566,50 +463,53 @@ H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf) /* number of symbols */ UINT16ENCODE(p, sym->nsyms); + /* Compute the size of the serialized symbol table node on disk */ + size = H5G_node_size_real(f); + HDassert(size); + /* entries */ - if (H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0) + if(H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") - HDmemset(p, 0, size - (p - buf)); + HDmemset(p, 0, size - (size_t)((const uint8_t *)p - (const uint8_t *)image)); + + /* Reset the cache flags for this operation (metadata not resized or renamed) */ + *flags = 0; + + /* Sanity check */ + HDassert((size_t)((const uint8_t *)p - (const uint8_t *)image) <= len); done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_node_serialize() */ /*------------------------------------------------------------------------- - * Function: H5G_node_dest - * - * Purpose: Destroy a symbol table node in memory. + * Function: H5G_node_free_icr * - * Return: Non-negative on success/Negative on failure + * Purpose: Destroy/release an "in core representation" of a data structure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 15 2003 + * Return: Success: SUCCEED + * Failure: FAIL * - * Modifications: + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * May 30, 2008 * *------------------------------------------------------------------------- */ static herr_t -H5G_node_dest(H5F_t UNUSED *f, H5G_node_t *sym) +H5G_node_free_icr(haddr_t UNUSED addr, size_t UNUSED len, void *thing) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_dest); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_free_icr) - /* - * Check arguments. - */ - assert(sym); - - /* Verify that node is clean */ - assert (sym->cache_info.is_dirty==FALSE); + /* Check arguments */ + HDassert(thing); - if(sym->entry) - sym->entry = H5FL_SEQ_FREE(H5G_entry_t,sym->entry); - H5FL_FREE(H5G_node_t,sym); + /* Destroy B-tree node */ + H5G_node_dest(thing); - FUNC_LEAVE_NOAPI(SUCCEED); -} /* end H5G_node_dest() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_node_free_icr() */ /*------------------------------------------------------------------------- @@ -623,75 +523,30 @@ H5G_node_dest(H5F_t UNUSED *f, H5G_node_t *sym) * koziol@ncsa.uiuc.edu * Mar 20 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy) +H5G_node_clear(haddr_t UNUSED addr, size_t UNUSED len, void *_sym) { + H5G_node_t *sym = (H5G_node_t *)_sym; unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_clear) /* * Check arguments. */ - assert(sym); + HDassert(sym); /* Look for dirty entries and reset their dirty flag. */ for(u = 0; u < sym->nsyms; u++) - sym->entry[u].dirty=FALSE; - sym->cache_info.is_dirty = FALSE; - - /* - * Destroy the symbol node? This might happen if the node is being - * preempted from the cache. - */ - if (destroy) - if (H5G_node_dest(f, sym) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node"); + sym->entry[u].dirty = FALSE; -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_node_clear() */ /*------------------------------------------------------------------------- - * Function: H5G_node_size - * - * Purpose: Compute the size in bytes of the specified instance of - * H5G_node_t on disk, and return it in *size_ptr. On failure - * the value of size_ptr is undefined. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 5/13/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size); - - /* - * Check arguments. - */ - HDassert(f); - HDassert(size_ptr); - - *size_ptr = H5G_node_size_real(f); - - FUNC_LEAVE_NOAPI(SUCCEED); -} /* H5G_node_size() */ - - -/*------------------------------------------------------------------------- * Function: H5G_node_create * * Purpose: Creates a new empty symbol table node. This function is @@ -729,16 +584,17 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, assert(H5B_INS_FIRST == op); if(NULL == (sym = H5FL_CALLOC(H5G_node_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") size = H5G_node_size_real(f); + HDassert(size); if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space"); + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space") - sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))); - if(NULL==sym->entry) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); - if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node"); + if(NULL == ( sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + H5_CHECK_OVERFLOW(size, /* vartype */hsize_t, /* casttype */size_t); + if(H5AC2_set(f, dxpl_id, H5AC2_SNODE, *addr_p, (size_t)size, sym, H5AC2__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node") /* * The left and right symbols in an empty tree are both the * empty string stored at offset zero by the H5G functions. This @@ -933,7 +789,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key /* * Load the symbol table node for exclusive access. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node") /* Get base address of heap */ @@ -963,7 +819,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "iterator callback failed") done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") FUNC_LEAVE_NOAPI(ret_value) @@ -1015,7 +871,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; H5G_bt_ins_t *udata = (H5G_bt_ins_t *) _udata; H5G_node_t *sn = NULL, *snrt = NULL; - unsigned sn_flags = H5AC__NO_FLAGS_SET, snrt_flags = H5AC__NO_FLAGS_SET; + unsigned sn_flags = H5AC2__NO_FLAGS_SET, snrt_flags = H5AC2__NO_FLAGS_SET; const char *s; const char *base; /* Base of heap */ unsigned lt = 0, rt; /* Binary search cntrs */ @@ -1039,7 +895,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, /* * Load the symbol node. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_WRITE))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node") /* Get base address of heap */ @@ -1082,19 +938,19 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, if(H5G_node_create(f, dxpl_id, H5B_INS_FIRST, NULL, NULL, NULL, new_node_p/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node") - if(NULL == (snrt = H5AC_protect(f, dxpl_id, H5AC_SNODE, *new_node_p, NULL, NULL, H5AC_WRITE))) + if(NULL == (snrt = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, *new_node_p, H5G_node_size_real(f), (void *)f, H5AC2_WRITE))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node") HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); snrt->nsyms = H5F_SYM_LEAF_K(f); - snrt_flags |= H5AC__DIRTIED_FLAG; + snrt_flags |= H5AC2__DIRTIED_FLAG; /* The left node */ HDmemset(sn->entry + H5F_SYM_LEAF_K(f), 0, H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); sn->nsyms = H5F_SYM_LEAF_K(f); - sn_flags |= H5AC__DIRTIED_FLAG; + sn_flags |= H5AC2__DIRTIED_FLAG; /* The middle key */ md_key->offset = sn->entry[sn->nsyms - 1].name_off; @@ -1115,7 +971,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, } else { /* Where to insert the new entry? */ ret_value = H5B_INS_NOOP; - sn_flags |= H5AC__DIRTIED_FLAG; + sn_flags |= H5AC2__DIRTIED_FLAG; insert_into = sn; if(idx == (int)sn->nsyms) { rt_key->offset = ent.name_off; @@ -1137,9 +993,9 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, insert_into->nsyms += 1; done: - if(snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt, snrt_flags) < 0) + if(snrt && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, *new_node_p, (size_t)0, snrt, snrt_flags) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node") - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_flags) < 0) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, sn_flags) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node") FUNC_LEAVE_NOAPI(ret_value) @@ -1184,7 +1040,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key; H5G_bt_rm_t *udata = (H5G_bt_rm_t *)_udata; H5G_node_t *sn = NULL; - unsigned sn_flags = H5AC__NO_FLAGS_SET; + unsigned sn_flags = H5AC2__NO_FLAGS_SET; unsigned lt = 0, rt, idx = 0; int cmp = 1; H5B_ins_t ret_value = H5B_INS_ERROR; @@ -1199,7 +1055,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, HDassert(udata && udata->common.heap); /* Load the symbol table */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_WRITE))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_WRITE))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node") /* "Normal" removal of a single entry from the symbol table node */ @@ -1288,7 +1144,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, *rt_key_changed = TRUE; sn->nsyms = 0; if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size_real(f)) < 0 - || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG) < 0) { + || H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__DIRTIED_FLAG | H5AC2__DELETED_FLAG) < 0) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node") } /* end if */ @@ -1302,7 +1158,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * change. */ sn->nsyms -= 1; - sn_flags |= H5AC__DIRTIED_FLAG; + sn_flags |= H5AC2__DIRTIED_FLAG; HDmemmove(sn->entry + idx, sn->entry + idx + 1, (sn->nsyms-idx) * sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; @@ -1314,7 +1170,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * should be changed to reflect the new right-most entry. */ sn->nsyms -= 1; - sn_flags |= H5AC__DIRTIED_FLAG; + sn_flags |= H5AC2__DIRTIED_FLAG; rt_key->offset = sn->entry[sn->nsyms - 1].name_off; *rt_key_changed = TRUE; ret_value = H5B_INS_NOOP; @@ -1325,7 +1181,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, * node. */ sn->nsyms -= 1; - sn_flags |= H5AC__DIRTIED_FLAG; + sn_flags |= H5AC2__DIRTIED_FLAG; HDmemmove(sn->entry + idx, sn->entry + idx + 1, (sn->nsyms - idx) * sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; @@ -1360,7 +1216,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, *rt_key_changed = TRUE; sn->nsyms = 0; if(H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size_real(f)) < 0 - || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG) < 0) { + || H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__DIRTIED_FLAG | H5AC2__DELETED_FLAG) < 0) { sn = NULL; HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node") } /* end if */ @@ -1369,7 +1225,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/, } /* end else */ done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_flags) < 0) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, sn_flags) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release symbol table node") FUNC_LEAVE_NOAPI(ret_value) @@ -1409,7 +1265,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad HDassert(udata && udata->heap); /* Protect the symbol table node & local heap while we iterate over entries */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") /* @@ -1476,7 +1332,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad done: /* Release resources */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1514,13 +1370,13 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr HDassert(num_objs); /* Find the object node and add the number of symbol entries. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") *num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1559,7 +1415,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add HDassert(udata); /* Get a pointer to the symbol table node */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node"); /* Find the node, locate the object symbol table entry and retrieve the name */ @@ -1581,7 +1437,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add udata->num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value); @@ -1748,7 +1604,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, HDassert(udata); /* load the symbol table into memory from the source file */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") /* get the base address of the heap */ @@ -1841,7 +1697,7 @@ done: if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->src_heap_addr) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name") - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if (sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1883,7 +1739,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ * Save information about the symbol table node since we can't lock it * because we're about to call an application function. */ - if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) + if(NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") /* Check if the link table needs to be extended */ @@ -1916,7 +1772,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ done: /* Release the locked items */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1997,7 +1853,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, * If we couldn't load the symbol table node, then try loading the * B-tree node. */ - if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) { + if (NULL == (sn = H5AC2_protect(f, dxpl_id, H5AC2_SNODE, addr, H5G_node_size_real(f), (void *)f, H5AC2_READ))) { H5G_bt_common_t udata; /*data to pass through B-tree */ H5E_clear_stack(NULL); /* discard that error */ @@ -2035,7 +1891,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, } /* end if */ done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) + if(sn && H5AC2_unprotect(f, dxpl_id, H5AC2_SNODE, addr, (size_t)0, sn, H5AC2__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") if(heap && H5HL_unprotect(f, dxpl_id, heap, heap_addr) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index f5b2582..cc017b9 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -32,7 +32,6 @@ #include "H5Gprivate.h" /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ #include "H5B2private.h" /* v2 B-trees */ #include "H5HFprivate.h" /* Fractal heaps */ #include "H5HLprivate.h" /* Local Heaps */ @@ -106,7 +105,6 @@ typedef struct H5G_entry_t { H5G_cache_t cache; /*cached data from object header */ size_t name_off; /*offset of name within name heap */ haddr_t header; /*file address of object header */ - H5F_t *file; /*file to which this obj hdr belongs */ } H5G_entry_t; /* @@ -321,9 +319,6 @@ typedef struct { */ H5_DLLVAR H5B_class_t H5B_SNODE[1]; -/* The cache subclass */ -H5_DLLVAR const H5AC_class_t H5AC_SNODE[1]; - /* The v2 B-tree class for indexing 'name' field on links */ H5_DLLVAR const H5B2_class_t H5G_BT2_NAME[1]; @@ -402,9 +397,9 @@ H5_DLL H5G_obj_t H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_ent_reset(H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, +H5_DLL herr_t H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n); -H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, +H5_DLL herr_t H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n); H5_DLL herr_t H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, const H5O_link_t *lnk, H5G_entry_t *ent); diff --git a/src/H5MF.c b/src/H5MF.c index 6d44c69..ab62038 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -64,7 +64,7 @@ *------------------------------------------------------------------------- */ haddr_t -H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) +H5MF_alloc(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) { haddr_t ret_value; @@ -118,7 +118,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) +H5MF_xfree(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size) { herr_t ret_value=SUCCEED; /* Return value */ @@ -234,7 +234,7 @@ done: *------------------------------------------------------------------------- */ hbool_t -H5MF_alloc_overflow(H5F_t *f, hsize_t size) +H5MF_alloc_overflow(const H5F_t *f, hsize_t size) { hsize_t space_needed = 0; /* Accumulator variable */ size_t c; /* Local index variable */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 09ed582..b3f0d17 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -44,12 +44,12 @@ /* * Library prototypes... */ -H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, +H5_DLL haddr_t H5MF_alloc(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +H5_DLL herr_t H5MF_xfree(const H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); H5_DLL haddr_t H5MF_realloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size); -H5_DLL hbool_t H5MF_alloc_overflow(H5F_t *f, hsize_t size); +H5_DLL hbool_t H5MF_alloc_overflow(const H5F_t *f, hsize_t size); H5_DLL htri_t H5MF_can_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested); H5_DLL herr_t H5MF_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, diff --git a/src/H5private.h b/src/H5private.h index 48fbd01..ebbad21 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1235,18 +1235,22 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Use this macro for API functions that [could] modify metadata */ #define FUNC_ENTER_API_META(func_name, id, err) {{ \ - FUNC_ENTER_API_VARS(func_name) \ - FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ - FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_API_COMMON(func_name,err); \ - /* Clear thread error stack entering public functions */ \ - H5E_clear_stack(NULL); \ { \ + /* Metadata journaling variables */ \ uint64_t trans_num = 0; \ H5O_loc_t id_oloc; \ hbool_t do_transaction = FALSE; \ hbool_t id_oloc_open = FALSE; \ hbool_t transaction_begun = FALSE; \ + /* end - Metadata journaling variables */ \ + \ + FUNC_ENTER_API_VARS(func_name) \ + FUNC_ENTER_COMMON(func_name,H5_IS_API(#func_name)); \ + FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_API_COMMON(func_name,err); \ + /* Clear thread error stack entering public functions */ \ + H5E_clear_stack(NULL); \ + \ if (H5AC2_begin_transaction(id, &do_transaction, &id_oloc, \ &id_oloc_open, &transaction_begun, \ &trans_num, FUNC) < 0) { \ diff --git a/test/cache2_api.c b/test/cache2_api.c index 5264753..45f2672 100644 --- a/test/cache2_api.c +++ b/test/cache2_api.c @@ -235,7 +235,14 @@ check_fapl_mdc_api_calls(void) /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }; H5AC2_cache_config_t scratch; H5C2_auto_size_ctl_t default_auto_size_ctl; @@ -837,7 +844,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }; H5AC2_cache_config_t mod_config_2 = { @@ -870,7 +884,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 4, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }; H5AC2_cache_config_t mod_config_3 = { @@ -903,7 +924,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ FALSE, /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }; H5AC2_cache_config_t mod_config_4 = { @@ -937,7 +965,14 @@ check_file_mdc_api_calls(void) /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }; TESTING("MDC/FILE related API calls"); @@ -2235,7 +2270,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 1 -- bad rpt_fcn_enabled */ @@ -2268,7 +2310,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 2 -- bad open_trace_file */ @@ -2301,7 +2350,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 3 -- bad close_trace_file */ @@ -2334,7 +2390,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 4 -- open_trace_file == TRUE and empty trace_file_name */ @@ -2367,7 +2430,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 5 -- bad set_initial_size */ @@ -2400,7 +2470,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 6 -- max_size too big */ @@ -2433,7 +2510,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 7 -- min_size too small */ @@ -2466,7 +2550,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 8 -- min_size > max_size */ @@ -2499,7 +2590,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 9 -- initial size out of range (too big) */ @@ -2532,7 +2630,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 10 -- initial_size out of range (too small) */ @@ -2565,7 +2670,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 11 -- min_clean_fraction too big */ @@ -2598,7 +2710,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 12 -- min_clean_fraction too small */ @@ -2631,7 +2750,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 13 -- epoch_length too small */ @@ -2664,7 +2790,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 14 -- epoch_length too big */ @@ -2697,7 +2830,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 15 -- invalid incr_mode */ @@ -2730,7 +2870,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 16 -- lower_hr_threshold too small */ @@ -2763,7 +2910,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 17 -- lower_hr_threshold too big */ @@ -2796,7 +2950,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 18 -- increment too small */ @@ -2829,7 +2990,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 19 -- bad apply_max_increment */ @@ -2862,7 +3030,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 20 -- invalid flash_incr_mode */ @@ -2895,7 +3070,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 21 -- flash_multiple too small */ @@ -2928,7 +3110,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 22 -- flash_multiple too big */ @@ -2961,7 +3150,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 23 -- flash_threshold too small */ @@ -2994,7 +3190,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 24 -- flash_threshold too big */ @@ -3027,7 +3230,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 25 -- bad decr_mode */ @@ -3060,7 +3270,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 26 -- upper_hr_threshold too big */ @@ -3093,7 +3310,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 27 -- decrement too small */ @@ -3126,7 +3350,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 28 -- decrement too big */ @@ -3159,7 +3390,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 29 -- epochs_before_eviction too small */ @@ -3192,7 +3430,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 0, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 30 -- epochs_before_eviction too big */ @@ -3225,7 +3470,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ H5C2__MAX_EPOCH_MARKERS + 1, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 31 -- invalid apply_empty_reserve */ @@ -3258,7 +3510,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ 2, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 32 -- empty_reserve too small */ @@ -3291,7 +3550,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ -0.0000000001, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 33 -- empty_reserve too big */ @@ -3324,7 +3590,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 1.00000000001, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 34 -- upper_hr_threshold too small */ @@ -3357,7 +3630,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 35 -- upper_hr_threshold too big */ @@ -3390,7 +3670,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 36 -- upper_hr_threshold <= lower_hr_threshold */ @@ -3423,7 +3710,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 37 -- dirty_bytes_threshold too small */ @@ -3456,7 +3750,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (H5C2__MIN_MAX_CACHE_SIZE / 2) - 1 + /* int dirty_bytes_threshold = */ (H5C2__MIN_MAX_CACHE_SIZE / 2) - 1, + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 38 -- dirty_bytes_threshold too big */ @@ -3489,7 +3790,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (H5C2__MAX_MAX_CACHE_SIZE / 4) + 1 + /* int dirty_bytes_threshold = */ (H5C2__MAX_MAX_CACHE_SIZE / 4) + 1, + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 39 -- attempt to disable evictions when auto incr enabled */ @@ -3522,7 +3830,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE }, { /* 40 -- attempt to disable evictions when auto decr enabled */ @@ -3555,7 +3870,14 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int epochs_before_eviction = */ 3, /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* int dirty_bytes_threshold = */ (256 * 1024), + /* hbool_t enable_journaling = */ FALSE, + /* char journal_file_path[] = */ "", + /* hbool_t journal_recovered = */ FALSE, + /* size_t jbrb_buf_size = */ (64 * 1024), + /* int jbrb_num_bufs = */ 4, + /* hbool_t jbrb_use_aio = */ FALSE, + /* hbool_t jbrb_human_readable = */ FALSE } }; diff --git a/test/cache2_common.c b/test/cache2_common.c index b8716f1..0537cf2 100644 --- a/test/cache2_common.c +++ b/test/cache2_common.c @@ -1151,7 +1151,8 @@ serialize(haddr_t addr, } /* serialize() */ herr_t -pico_serialize(haddr_t addr, +pico_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1166,7 +1167,8 @@ pico_serialize(haddr_t addr, } herr_t -nano_serialize(haddr_t addr, +nano_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1181,7 +1183,8 @@ nano_serialize(haddr_t addr, } herr_t -micro_serialize(haddr_t addr, +micro_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1196,7 +1199,8 @@ micro_serialize(haddr_t addr, } herr_t -tiny_serialize(haddr_t addr, +tiny_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1211,7 +1215,8 @@ tiny_serialize(haddr_t addr, } herr_t -small_serialize(haddr_t addr, +small_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1226,7 +1231,8 @@ small_serialize(haddr_t addr, } herr_t -medium_serialize(haddr_t addr, +medium_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1241,7 +1247,8 @@ medium_serialize(haddr_t addr, } herr_t -large_serialize(haddr_t addr, +large_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1256,7 +1263,8 @@ large_serialize(haddr_t addr, } herr_t -huge_serialize(haddr_t addr, +huge_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1271,7 +1279,8 @@ huge_serialize(haddr_t addr, } herr_t -monster_serialize(haddr_t addr, +monster_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, @@ -1286,7 +1295,8 @@ monster_serialize(haddr_t addr, } herr_t -variable_serialize(haddr_t addr, +variable_serialize(const H5F_t UNUSED *f, + haddr_t addr, size_t len, void * image_ptr, void * thing, diff --git a/test/cache2_common.h b/test/cache2_common.h index 60cf697..6286de1 100644 --- a/test/cache2_common.h +++ b/test/cache2_common.h @@ -566,43 +566,43 @@ herr_t huge_image_len(void *thing, size_t *image_len_ptr); herr_t monster_image_len(void *thing, size_t *image_len_ptr); herr_t variable_image_len(void *thing, size_t *image_len_ptr); -herr_t pico_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t pico_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t nano_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t nano_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t micro_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t micro_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t tiny_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t tiny_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t small_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t small_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t medium_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t medium_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t large_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t large_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t huge_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t huge_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t monster_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t monster_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); -herr_t variable_serialize(haddr_t addr, size_t len, void * image_ptr, +herr_t variable_serialize(const H5F_t *f, haddr_t addr, size_t len, void * image_ptr, void * thing, unsigned * flags_ptr, haddr_t * new_addr_ptr, size_t * new_len_ptr, void ** new_image_ptr_ptr); diff --git a/test/cache2_journal.c b/test/cache2_journal.c index b4a651b..267c07d 100644 --- a/test/cache2_journal.c +++ b/test/cache2_journal.c @@ -286,7 +286,7 @@ copy_file(const char * input_file, size_t cur_buf_len; const size_t max_buf_len = (8 * 1024); size_t input_len; - size_t input_remainder; + size_t input_remainder = 0; ssize_t result; int input_file_fd = -1; int output_file_fd = -1; @@ -1595,9 +1595,9 @@ open_exiting_file_for_journaling(const char * hdf_file_name, herr_t result; H5AC2_cache_config_t mdj_config; hid_t fapl_id = -1; - hid_t file_id; - H5F_t * file_ptr; - H5C2_t * cache_ptr; + hid_t file_id = -1; + H5F_t * file_ptr = NULL; + H5C2_t * cache_ptr = NULL; if ( pass2 ) { @@ -1861,10 +1861,10 @@ setup_cache_for_journaling(const char * hdf_file_name, /* hbool_t jbrb_human_readable = */ TRUE }; hid_t fapl_id = -1; - hid_t file_id; + hid_t file_id = -1; haddr_t actual_base_addr; - H5F_t * file_ptr; - H5C2_t * cache_ptr; + H5F_t * file_ptr = NULL; + H5C2_t * cache_ptr = NULL; if ( pass2 ) { @@ -2143,11 +2143,11 @@ verify_journal_contents(const char * journal_file_path_ptr, hbool_t verbose = FALSE; size_t cur_buf_len; const size_t max_buf_len = (8 * 1024); - size_t journal_len; - size_t expected_len; + size_t journal_len = 0; + size_t expected_len = 0; size_t first_line_len; - size_t journal_remainder_len; - size_t expected_remainder_len; + size_t journal_remainder_len = 0; + size_t expected_remainder_len = 0; ssize_t read_result; int journal_file_fd = -1; int expected_file_fd = -1; @@ -5757,7 +5757,7 @@ check_message_format(void) checkpoint++, (int)pass2); /* Fill out verify array with expected messages */ - sprintf(verify[0], "0 ver_num 1 target_file_name HDF5.file creation_date %010.10s human_readable 1\n", ctime(¤t_date)); + sprintf(verify[0], "0 ver_num 1 target_file_name HDF5.file creation_date %10.10s human_readable 1\n", ctime(¤t_date)); sprintf(verify[1], "1 bgn_trans 1\n"); sprintf(verify[2], "2 trans_num 1 length 1 base_addr 0x0 body 41 \n"); sprintf(verify[3], "2 trans_num 1 length 2 base_addr 0x1 body 41 42 \n"); @@ -5913,7 +5913,7 @@ check_message_format(void) checkpoint++, (int)pass2); /* Fill out verify array with expected messages */ - sprintf(verify[0], "0 ver_num 1 target_file_name HDF5.file creation_date %010.10s human_readable 1\n", ctime(¤t_date)); + sprintf(verify[0], "0 ver_num 1 target_file_name HDF5.file creation_date %10.10s human_readable 1\n", ctime(¤t_date)); sprintf(verify[1], "1 bgn_trans 3\n"); sprintf(verify[2], "2 trans_num 3 length 6 base_addr 0x6faf body 23 31 6e 4e 60 7d \n"); sprintf(verify[3], "3 end_trans 3\n"); -- cgit v0.12