From be27e1ad79dfa0507f589b29d938b7e1020a5b2d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 17 Nov 2016 12:58:04 -0800 Subject: Remove explicit support within the metadata cache for tracked compressed entries, they are now completely handled in the clients. --- src/H5AC.c | 4 +- src/H5ACprivate.h | 2 - src/H5B2cache.c | 32 ++--- src/H5Bcache.c | 6 +- src/H5C.c | 237 ++++++---------------------------- src/H5Cepoch.c | 11 +- src/H5Cprivate.h | 353 +++++++-------------------------------------------- src/H5EAcache.c | 35 ++--- src/H5FAcache.c | 20 +-- src/H5FScache.c | 24 ++-- src/H5Fsuper_cache.c | 24 +--- src/H5Gcache.c | 6 +- src/H5HFcache.c | 173 ++++++++----------------- src/H5HGcache.c | 6 +- src/H5HLcache.c | 22 +--- src/H5Ocache.c | 27 +--- src/H5SMcache.c | 20 +-- test/cache_common.c | 338 +++++++++++++++++++++--------------------------- test/earray.c | 62 +++------ testpar/t_cache.c | 27 ++-- 20 files changed, 385 insertions(+), 1044 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 3b19db4..1c6f3c9 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -1639,11 +1639,9 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, * the entry. */ if(dirtied && !deleted) { - hbool_t curr_compressed = FALSE; /* dummy for call */ size_t curr_size = 0; - size_t curr_compressed_size = 0; /* dummy for call */ - if((type->image_len)(thing, &curr_size, &curr_compressed, &curr_compressed_size) < 0) + if((type->image_len)(thing, &curr_size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing") if(((H5AC_info_t *)thing)->size != curr_size) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 01b7125..abda6ae 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -142,7 +142,6 @@ typedef enum { #define H5AC__SERIALIZE_RESIZED_FLAG H5C__SERIALIZE_RESIZED_FLAG #define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG -#define H5AC__SERIALIZE_COMPRESSED_FLAG H5C__SERIALIZE_COMPRESSED_FLAG /* Cork actions: cork/uncork/get cork status of an object */ #define H5AC__SET_CORK H5C__SET_CORK @@ -171,7 +170,6 @@ typedef H5C_notify_action_t H5AC_notify_action_t; #define H5AC__CLASS_NO_FLAGS_SET H5C__CLASS_NO_FLAGS_SET #define H5AC__CLASS_SPECULATIVE_LOAD_FLAG H5C__CLASS_SPECULATIVE_LOAD_FLAG -#define H5AC__CLASS_COMPRESSED_FLAG H5C__CLASS_COMPRESSED_FLAG /* The following flags should only appear in test code */ #define H5AC__CLASS_SKIP_READS H5C__CLASS_SKIP_READS diff --git a/src/H5B2cache.c b/src/H5B2cache.c index b899f6a..c9e2767 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -68,8 +68,7 @@ static herr_t H5B2__cache_hdr_get_load_size(const void *udata, size_t *image_len); static void *H5B2__cache_hdr_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5B2__cache_hdr_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5B2__cache_hdr_image_len(const void *thing, size_t *image_len); static herr_t H5B2__cache_hdr_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5B2__cache_hdr_free_icr(void *thing); @@ -77,8 +76,7 @@ static herr_t H5B2__cache_hdr_free_icr(void *thing); static herr_t H5B2__cache_int_get_load_size(const void *udata, size_t *image_len); static void *H5B2__cache_int_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5B2__cache_int_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5B2__cache_int_image_len(const void *thing, size_t *image_len); static herr_t H5B2__cache_int_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5B2__cache_int_free_icr(void *thing); @@ -86,8 +84,7 @@ static herr_t H5B2__cache_int_free_icr(void *thing); static herr_t H5B2__cache_leaf_get_load_size(const void *udata, size_t *image_len); static void *H5B2__cache_leaf_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5B2__cache_leaf_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5B2__cache_leaf_image_len(const void *thing, size_t *image_len); static herr_t H5B2__cache_leaf_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5B2__cache_leaf_free_icr(void *thing); @@ -310,8 +307,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len) { const H5B2_hdr_t *hdr = (const H5B2_hdr_t *)_thing; /* Pointer to the B-tree header */ @@ -601,8 +597,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2__cache_int_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5B2__cache_int_image_len(const void *_thing, size_t *image_len) { const H5B2_internal_t *internal = (const H5B2_internal_t *)_thing; /* Pointer to the B-tree internal node */ @@ -721,17 +716,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2__cache_int_free_icr(void *thing) +H5B2__cache_int_free_icr(void *_thing) { + H5B2_internal_t *internal = (H5B2_internal_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check arguments */ - HDassert(thing); + HDassert(internal); /* Release v2 B-tree internal node */ - if(H5B2__internal_free((H5B2_internal_t *)thing) < 0) + if(H5B2__internal_free(internal) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node") done: @@ -890,8 +886,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len) { const H5B2_leaf_t *leaf = (const H5B2_leaf_t *)_thing; /* Pointer to the B-tree leaf node */ @@ -996,17 +991,18 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B2__cache_leaf_free_icr(void *thing) +H5B2__cache_leaf_free_icr(void *_thing) { + H5B2_leaf_t *leaf = (H5B2_leaf_t *)_thing; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Check arguments */ - HDassert(thing); + HDassert(leaf); /* Destroy v2 B-tree leaf node */ - if(H5B2__leaf_free((H5B2_leaf_t *)thing) < 0) + if(H5B2__leaf_free(leaf) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree leaf node") done: diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 8354e8e..d485049 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -57,8 +57,7 @@ static herr_t H5B__get_load_size(const void *udata, size_t *image_len); static void *H5B__deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5B__image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5B__image_len(const void *thing, size_t *image_len); static herr_t H5B__serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5B__free_icr(void *thing); @@ -248,8 +247,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B__image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5B__image_len(const void *_thing, size_t *image_len) { const H5B_t *bt = (const H5B_t *)_thing; /* Pointer to the B-tree node */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ diff --git a/src/H5C.c b/src/H5C.c index d2812b3..3b32aa7 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -1273,24 +1273,10 @@ H5C_insert_entry(H5F_t * f, /* not protected, so can't be dirtied */ entry_ptr->dirtied = FALSE; - /* Retrieve the size of the thing. Set the compressed field to FALSE - * and the compressed_size field to zero first, as they may not be - * initialized by the image_len call. - */ - entry_ptr->compressed = FALSE; - entry_ptr->compressed_size = 0; - if((type->image_len)(thing, &(entry_ptr->size), &(entry_ptr->compressed), &(entry_ptr->compressed_size)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing") + /* Retrieve the size of the thing */ + if((type->image_len)(thing, &(entry_ptr->size)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "can't get size of thing") HDassert(entry_ptr->size > 0 && entry_ptr->size < H5C_MAX_ENTRY_SIZE); - HDassert(((type->flags & H5C__CLASS_COMPRESSED_FLAG) != 0) || - (entry_ptr->compressed == FALSE)); - - /* entry has just been inserted -- thus compressed size cannot have - * been computed yet. Thus if entry_ptr->compressed is TRUE, - * entry_ptr->size must equal entry_ptr->compressed_size. - */ - HDassert(!entry_ptr->compressed || (entry_ptr->size == entry_ptr->compressed_size)); - HDassert(entry_ptr->compressed || (entry_ptr->compressed_size == 0)); entry_ptr->in_slist = FALSE; @@ -2119,22 +2105,14 @@ H5C_protect(H5F_t * f, if(entry_ptr->image_ptr == NULL) { int mpi_rank; - size_t image_size; if((mpi_rank = H5F_mpi_get_rank(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - if(entry_ptr->compressed) - image_size = entry_ptr->compressed_size; - else - image_size = entry_ptr->size; - HDassert(image_size > 0); - - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, - H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ if(0 == mpi_rank) if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id) < 0) @@ -5862,19 +5840,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ #endif /* H5C_DO_SANITY_CHECKS */ if(NULL == entry_ptr->image_ptr) { - size_t image_size; - - if(entry_ptr->compressed) - image_size = entry_ptr->compressed_size; - else - image_size = entry_ptr->size; - HDassert(image_size > 0); - - - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ } /* end if */ @@ -5890,19 +5859,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ * in the entry's type, we silently skip the write. This * flag should only be used in test code. */ - if(((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0) - { - /* If compression is not enabled, the size of the entry on - * disk is entry_prt->size. However if entry_ptr->compressed - * is TRUE, the on disk size is entry_ptr->compressed_size. - */ - size_t image_size; - - if(entry_ptr->compressed) - image_size = entry_ptr->compressed_size; - else - image_size = entry_ptr->size; - + if(((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0) { #ifdef H5_HAVE_PARALLEL if(collective_write_list) { H5C_collective_write_t *item; @@ -5910,7 +5867,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ if(NULL == (item = (H5C_collective_write_t *)H5FL_MALLOC(H5C_collective_write_t))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "unable to allocate skip list item") - item->length = image_size; + item->length = entry_ptr->size; item->free_buf = FALSE; item->buf = entry_ptr->image_ptr; item->offset = entry_ptr->addr; @@ -5922,10 +5879,9 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ } /* end if */ else #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_write(f, entry_ptr->type->mem_type, entry_ptr->addr, - image_size, dxpl_id, entry_ptr->image_ptr) < 0) + if(H5F_block_write(f, entry_ptr->type->mem_type, entry_ptr->addr, entry_ptr->size, dxpl_id, entry_ptr->image_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file.") - } + } /* end if */ /* if the entry has a notify callback, notify it that we have * just flushed the entry. @@ -6082,30 +6038,22 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr)); #ifndef NDEBUG { - hbool_t curr_compressed = FALSE; size_t curr_len; - size_t curr_compressed_len = 0; /* Get the actual image size for the thing again */ - entry_ptr->type->image_len((void *)entry_ptr, &curr_len, &curr_compressed, &curr_compressed_len); + entry_ptr->type->image_len((void *)entry_ptr, &curr_len); HDassert(curr_len == entry_ptr->size); - HDassert(curr_compressed == entry_ptr->compressed); - HDassert(curr_compressed_len == entry_ptr->compressed_size); } #endif /* NDEBUG */ - /* if the file space free size callback is defined, use + /* If the file space free size callback is defined, use * it to get the size of the block of file space to free. - * Otherwise use entry_ptr->compressed_size if - * entry_ptr->compressed == TRUE, and entry_ptr->size - * if entry_ptr->compressed == FALSE. + * Otherwise use entry_ptr->size. */ if(entry_ptr->type->fsf_size) { if((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size") } /* end if */ - else if(entry_ptr->compressed) /* use compressed size */ - fsf_size = entry_ptr->compressed_size; else /* no file space free size callback -- use entry size */ fsf_size = entry_ptr->size; @@ -6228,14 +6176,6 @@ H5C_load_entry(H5F_t * f, void * udata) { hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */ - hbool_t compressed = FALSE; /* flag indicating whether thing */ - /* will be run through filters on */ - /* on read and write. Usually FALSE */ - /* set to true if appropriate. */ - size_t compressed_size = 0; /* entry compressed size if */ - /* known -- otherwise uncompressed. */ - /* Zero indicates compression not */ - /* enabled. */ void * image = NULL; /* Buffer for disk image */ void * thing = NULL; /* Pointer to thing loaded */ H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */ @@ -6254,17 +6194,11 @@ H5C_load_entry(H5F_t * f, HDassert(f->shared->cache); HDassert(type); - /* for now, we do not combine the speculative load and compressed flags */ - HDassert(!((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && - (type->flags & H5C__CLASS_COMPRESSED_FLAG))); - /* Can't see how skip reads could be usefully combined with - * either the speculative read or compressed flags. Hence disallow. + * the speculative read flag. Hence disallow. */ HDassert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG))); - HDassert(!((type->flags & H5C__CLASS_SKIP_READS) && - (type->flags & H5C__CLASS_COMPRESSED_FLAG))); HDassert(H5F_addr_defined(addr)); HDassert(type->get_load_size); @@ -6378,54 +6312,19 @@ H5C_load_entry(H5F_t * f, entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; entry->type = type; - /* verify that compressed and compressed_len are initialized */ - HDassert(compressed == FALSE); - HDassert(compressed_size == 0); - /* Get the actual image size for the thing */ - if(type->image_len(thing, &new_len, &compressed, &compressed_size) < 0) + if(type->image_len(thing, &new_len) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image length") if(new_len == 0) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "image length is 0") - HDassert(((type->flags & H5C__CLASS_COMPRESSED_FLAG) != 0) || - ((compressed == FALSE) && (compressed_size == 0))); - HDassert((compressed == TRUE) || (compressed_size == 0)); - if(new_len != len) { - if(type->flags & H5C__CLASS_COMPRESSED_FLAG) { - - /* if new_len != len, then compression must be - * enabled on the entry. In this case, the image_len - * callback should have set compressed to TRUE, set - * new_len equal to the uncompressed size of the - * entry, and compressed_len equal to the compressed - * size -- which must equal len. - * - * We can't verify the uncompressed size, but we can - * verify the rest with the following assertions. - */ - HDassert(compressed); - HDassert(compressed_size == len); - - /* new_len should contain the uncompressed size. Set len - * equal to new_len, so that the cache will use the - * uncompressed size for purposes of space allocation, etc. - */ - len = new_len; - - } else if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) { + if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) { void *new_image; /* Buffer for disk image */ - /* compressed must be FALSE, and compressed_size - * must be zero. - */ - HDassert(!compressed); - HDassert(compressed_size == 0); - /* Adjust the size of the image to match new_len */ if(NULL == (new_image = H5MM_realloc(image, new_len + H5C_IMAGE_EXTRA_SPACE))) @@ -6486,13 +6385,6 @@ H5C_load_entry(H5F_t * f, #ifndef NDEBUG { - /* new_compressed and new_compressed_size must be - * initialize to FALSE / 0 respectively, as clients - * that don't use compression may ignore these two - * parameters. - */ - hbool_t new_compressed = FALSE; - size_t new_compressed_size = 0; size_t new_new_len; /* Get the actual image size for the thing again. Note @@ -6504,10 +6396,8 @@ H5C_load_entry(H5F_t * f, entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; entry->type = type; - type->image_len(thing, &new_new_len, &new_compressed, &new_compressed_size); + type->image_len(thing, &new_new_len); HDassert(new_new_len == new_len); - HDassert(!new_compressed); - HDassert(new_compressed_size == 0); } /* end block */ #endif /* NDEBUG */ } /* end if (new_len > len) */ @@ -6518,7 +6408,7 @@ H5C_load_entry(H5F_t * f, } else { /* throw an error */ HGOTO_ERROR(H5E_CACHE, H5E_UNSUPPORTED, NULL, \ - "size of non-speculative, non-compressed object changed") + "size of non-speculative object changed") } } /* end if (new_len != len) */ } /* end if */ @@ -6551,8 +6441,6 @@ H5C_load_entry(H5F_t * f, entry->addr = addr; entry->size = len; HDassert(entry->size < H5C_MAX_ENTRY_SIZE); - entry->compressed = compressed; - entry->compressed_size = compressed_size; entry->image_ptr = image; entry->image_up_to_date = TRUE; entry->type = type; @@ -7710,7 +7598,6 @@ H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_p haddr_t new_addr = HADDR_UNDEF; haddr_t old_addr = HADDR_UNDEF; size_t new_len = 0; - size_t new_compressed_len = 0; unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; herr_t ret_value = SUCCEED; @@ -7724,18 +7611,15 @@ H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_p /* Call client's pre-serialize callback, if there's one */ if(entry_ptr->type->pre_serialize && - (entry_ptr->type->pre_serialize)(f, dxpl_id, - (void *)entry_ptr, entry_ptr->addr, entry_ptr->size, - entry_ptr->compressed_size, &new_addr, &new_len, - &new_compressed_len, &serialize_flags) < 0) + (entry_ptr->type->pre_serialize)(f, dxpl_id, (void *)entry_ptr, + entry_ptr->addr, entry_ptr->size, &new_addr, &new_len, &serialize_flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") /* Check for any flags set in the pre-serialize callback */ if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { /* Check for unexpected flags from serialize callback */ if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | - H5C__SERIALIZE_MOVED_FLAG | - H5C__SERIALIZE_COMPRESSED_FLAG)) + H5C__SERIALIZE_MOVED_FLAG)) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") #ifdef H5_HAVE_PARALLEL @@ -7769,49 +7653,31 @@ H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_p HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.") #endif - /* Resize the buffer if required */ - if(((!entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG)) || - ((entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG))) { - size_t new_image_size; - - if(entry_ptr->compressed) - new_image_size = new_compressed_len; - else - new_image_size = new_len; - HDassert(new_image_size > 0); - - /* Release the current image */ - if(entry_ptr->image_ptr) - entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - + /* If required, resize the buffer and update the entry and the cache + * data structures */ + if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { /* Allocate a new image buffer */ - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE))) + if(NULL == (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") - #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ - /* If required, update the entry and the cache data structures - * for a resize. - */ - if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { + /* Update statistics for resizing the entry */ H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); - /* update the hash table for the size change*/ + /* update the hash table for the size change */ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ new_len, entry_ptr, !(entry_ptr->is_dirty)); - /* The entry can't be protected since we are - * in the process of flushing it. Thus we must - * update the replacement policy data - * structures for the size change. The macro - * deals with the pinned case. + /* The entry can't be protected since we are in the process of + * flushing it. Thus we must update the replacement policy data + * structures for the size change. The macro deals with the pinned + * case. */ H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); - /* as we haven't updated the cache data structures for + /* As we haven't updated the cache data structures for * for the flush or flush destroy yet, the entry should * be in the slist. Thus update it for the size change. */ @@ -7828,12 +7694,9 @@ H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_p if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr); + /* We must update cache data structures for the change in address */ if(entry_ptr->addr == old_addr) { - /* we must update cache data structures for the - * change in address. - */ - - /* delete the entry from the hash table and the slist */ + /* Delete the entry from the hash table and the slist */ H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr); H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); @@ -7847,35 +7710,15 @@ H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_p else /* move is already done for us -- just do sanity checks */ HDassert(entry_ptr->addr == new_addr); } /* end if */ - - if(serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG) { - /* just save the new compressed entry size in - * entry_ptr->compressed_size. We don't need to - * do more, as compressed size is only used for I/O. - */ - HDassert(entry_ptr->compressed); - entry_ptr->compressed_size = new_compressed_len; - } /* end if */ } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ /* Serialize object into buffer */ - { - size_t image_len; - - if(entry_ptr->compressed) - image_len = entry_ptr->compressed_size; - else - image_len = entry_ptr->size; - - if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, image_len, (void *)entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") - + if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, (void *)entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") #if H5C_DO_MEMORY_SANITY_CHECKS - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len, - H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); + HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - entry_ptr->image_up_to_date = TRUE; - } /* end block */ + entry_ptr->image_up_to_date = TRUE; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Cepoch.c b/src/H5Cepoch.c index 7c5e441..3dbf57f 100644 --- a/src/H5Cepoch.c +++ b/src/H5Cepoch.c @@ -68,11 +68,10 @@ static herr_t H5C__epoch_marker_get_load_size(const void *udata_ptr, static void * H5C__epoch_marker_deserialize(const void * image_ptr, size_t len, void * udata, hbool_t * dirty_ptr); static herr_t H5C__epoch_marker_image_len(const void * thing, - size_t *image_len_ptr, hbool_t *compressed_ptr, size_t *compressed_len_ptr); + size_t *image_len_ptr); static herr_t H5C__epoch_marker_pre_serialize(const H5F_t *f, hid_t dxpl_id, void * thing, haddr_t addr, size_t len, - size_t compressed_len, haddr_t * new_addr_ptr, size_t * new_len_ptr, - size_t * new_compressed_len_ptr, unsigned * flags_ptr); + haddr_t * new_addr_ptr, size_t * new_len_ptr, unsigned * flags_ptr); static herr_t H5C__epoch_marker_serialize(const H5F_t *f, void * image_ptr, size_t len, void * thing); static herr_t H5C__epoch_marker_notify(H5C_notify_action_t action, void *thing); @@ -152,8 +151,7 @@ H5C__epoch_marker_deserialize(const void H5_ATTR_UNUSED * image_ptr, size_t H5_A static herr_t H5C__epoch_marker_image_len(const void H5_ATTR_UNUSED *thing, - size_t H5_ATTR_UNUSED *image_len_ptr, hbool_t H5_ATTR_UNUSED *compressed_ptr, - size_t H5_ATTR_UNUSED *compressed_len_ptr) + size_t H5_ATTR_UNUSED *image_len_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ @@ -166,8 +164,7 @@ H5C__epoch_marker_image_len(const void H5_ATTR_UNUSED *thing, static herr_t H5C__epoch_marker_pre_serialize(const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED *thing, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t H5_ATTR_UNUSED *new_addr_ptr, - size_t H5_ATTR_UNUSED *new_len_ptr, size_t H5_ATTR_UNUSED *new_compressed_len_ptr, + haddr_t H5_ATTR_UNUSED *new_addr_ptr, size_t H5_ATTR_UNUSED *new_len_ptr, unsigned H5_ATTR_UNUSED *flags_ptr) { FUNC_ENTER_STATIC_NOERR /* Yes, even though this pushes an error on the stack */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index e98bc07..be04265 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -68,16 +68,14 @@ /* Flags for cache client class behavior */ #define H5C__CLASS_NO_FLAGS_SET ((unsigned)0x0) #define H5C__CLASS_SPECULATIVE_LOAD_FLAG ((unsigned)0x1) -#define H5C__CLASS_COMPRESSED_FLAG ((unsigned)0x2) /* The following flags may only appear in test code */ -#define H5C__CLASS_SKIP_READS ((unsigned)0x4) -#define H5C__CLASS_SKIP_WRITES ((unsigned)0x8) +#define H5C__CLASS_SKIP_READS ((unsigned)0x2) +#define H5C__CLASS_SKIP_WRITES ((unsigned)0x4) /* Flags for pre-serialize callback */ #define H5C__SERIALIZE_NO_FLAGS_SET ((unsigned)0) #define H5C__SERIALIZE_RESIZED_FLAG ((unsigned)0x1) #define H5C__SERIALIZE_MOVED_FLAG ((unsigned)0x2) -#define H5C__SERIALIZE_COMPRESSED_FLAG ((unsigned)0x4) /* Upper and lower limits on cache size. These limits are picked * out of a hat -- you should be able to change them as necessary. @@ -286,19 +284,12 @@ typedef struct H5C_t H5C_t; * * flags: Flags indicating class-specific behavior. * - * Whoever created the flags field neglected to document the meanings - * of the flags he created. Hence the following discussion of the - * H5C__CLASS_SPECULATIVE_LOAD_FLAG and (to a lesser extent) - * H5C__CLASS_COMPRESSED_FLAG should be viewed with suspicion, - * as the meanings are divined from the source code, and thus may be - * inaccurate. Please correct any errors you find. - * * Possible flags are: * * H5C__CLASS_NO_FLAGS_SET: No special processing. * - * H5C__CLASS_SPECULATIVE_LOAD_FLAG: This flag appears to be used - * only in H5C_load_entry(). When it is set, entries are + * H5C__CLASS_SPECULATIVE_LOAD_FLAG: This flag is used only in + * H5C_load_entry(). When it is set, entries are * permitted to change their sizes on the first attempt * to load. * @@ -312,56 +303,15 @@ typedef struct H5C_t H5C_t; * entry in the cache. * * If the new size is smaller than the old, no new loads - * or desearializes are performed, but the new size becomes + * or deserializes are performed, but the new size becomes * the size of the entry in the cache. * * When this flag is set, an attempt to read past the - * end of file is pemitted. In this case, if the size + * end of file could occur. In this case, if the size * returned get_load_size callback would result in a - * read past the end of file, the size is trunkated to + * read past the end of file, the size is truncated to * avoid this, and processing proceeds as normal. * - * H5C__CLASS_COMPRESSED_FLAG: This flags indicates that the entry - * may be compressed -- i.e. its on disk image is run through - * filters on the way to and from disk. Thus the uncompressed - * (or unfiltered) size of the entry may be different from the - * size of the entry in file. - * - * This has the following implications: - * - * On load, uncompressed size and load size may be different. - * Presumably, load size will be smaller than uncompressed - * size, but there is no requirement for this in the code - * (but note that I have inserted an assertion to this effect, - * which has not been triggered to date). - * - * On insertion, compressed (AKA filtered, AKA on disk) size - * is unknown, as the entry has yet to be run through filters. - * Compressed size is computed whenever the entry is - * written (or the image is updated -- not relevant until - * journaling is brought back). - * - * On dirty (of a clean entry), compressed (AKA filtered, - * AKA on disk) size becomes unknown. Thus, compressed size - * must be computed by the pre-serialize callback before the - * entry may be written. - * - * Once the compressed size becomes unknown, it remains so - * until the on disk image is constructed. - * - * Observe that the cache needs to know the size of the entry - * for space allocation purposes. Since the compressed size - * can change or become unknown, it uses the uncompressed - * size which may change, but which should always be known. - * The compressed size is used only for journaling and disk I/O. - * - * While there is no logical reason why they could not be - * combined, due to absence of need and for simplicity of code, - * the cache does not permit both the the - * H5C__CLASS_COMPRESSED_FLAG and the - * H5C__CLASS_SPECULATIVE_LOAD_FLAG to be set in the same - * instance of H5C_class_t. - * * The following flags may only appear in test code. * * H5C__CLASS_SKIP_READS: This flags is intended only for use in test @@ -379,14 +329,10 @@ typedef struct H5C_t H5C_t; * a metadata cache entry, given the 'udata' that will be passed to the * 'deserialize' callback. * - * Note that if either the H5C__CLASS_SPECULATIVE_LOAD_FLAG or - * the H5C__CLASS_COMPRESSED_FLAG is set, the disk image size - * returned by this callback is either a first guess (if the - * H5C__CLASS_SPECULATIVE_LOAD_FLAG is set) or (if the - * H5C__CLASS_COMPRESSED_FLAG is set), the exact on disk size - * of the entry whether it has been run through filters or not. - * In all other cases, the value returned should be the correct - * uncompressed size of the entry. + * Note that if either the H5C__CLASS_SPECULATIVE_LOAD_FLAG is set, the disk image size + * returned by this callback is a first guess. + * In other cases, the value returned should be the correct + * size of the entry. * * The typedef for the deserialize callback is as follows: * @@ -499,37 +445,16 @@ typedef struct H5C_t H5C_t; * and load a new buffer of the correct size from file, and then call * the deserialize callback again. * - * If the H5C__CLASS_COMPRESSED_FLAG is set, exceptions are as per the - * H5C__CLASS_SPECULATIVE_LOAD_FLAG, save that only oversized buffers - * are permitted. - * * * IMAGE_LEN: Pointer to the image length callback. * - * This callback exists primarily to support - * H5C__CLASS_SPECULATIVE_LOAD_FLAG and H5C__CLASS_COMPRESSED_FLAG - * discussed above, although it is also used to obtain the size of - * newly inserted entries. - * - * In the case of the H5C__CLASS_SPECULATIVE_LOAD_FLAG, it is used to - * allow the client to change the size of an entry in the deserialize - * callback. - * - * For the H5C__CLASS_COMPRESSED_FLAG, it is used to allow the client - * to indicate whether the entry is compressed (i.e. whether entries - * are run through filters) and if so, to report both the uncompressed - * and the compressed entry size (i.e. the actual on disk size after - * the entry has been run through filters) if that value is known. - * - * The callback is also used in H5C_insert_entry() to obtain the - * size of the newly inserted entry. + * The image_len callback is used to obtain the size of newly inserted + * entries and assert verification. * * The typedef for the image_len callback is as follows: * * typedef herr_t (*H5C_image_len_func_t)(void *thing, - * size_t *image_len_ptr, - * hbool_t *compressed_ptr, - * size_t *compressed_image_len_ptr); + * size_t *image_len_ptr); * * The parameters of the image_len callback are as follows: * @@ -538,84 +463,15 @@ typedef struct H5C_t H5C_t; * image_len_ptr: Pointer to size_t in which the callback will return * the length (in bytes) of the cache entry. * - * If the H5C__CLASS_COMPRESSED_FLAG is not set in the - * associated instance of H5C_class_t, or if the flag is - * set, and the callback sets *compressed_ptr to FALSE, - * this size is the actual size of the entry on disk. - * - * Otherwise, this size is the uncompressed size of the - * entry -- which the cache will use for all purposes OTHER - * than journal writes and disk I/O. - * - * compressed_ptr: Pointer to a boolean flag indicating whether - * the cache entry will be compressed / uncompressed on - * disk writes / reads. - * - * If the H5C__CLASS_COMPRESSED_FLAG is not set in the - * associated instance of H5C_class_t, *compressed_ptr - * must be set to FALSE. - * - * If the H5C__CLASS_COMPRESSED_FLAG is set in the - * associated instance of H5C_class_t, and filters are - * not enabled, *compressed_ptr must be set to FALSE. - * - * If the H5C__CLASS_COMPRESSED_FLAG is set in the - * associated instance of H5C_class_t, and filters are - * enabled, the callback must set *compressed_ptr to TRUE. - * - * Note that *compressed_ptr will always be set to FALSE - * by the caller prior to invocation of the callback. Thus - * callbacks for clients that don't set the - * H5C__CLASS_COMPRESSED_FLAG can ignore this parameter. - * - * compressed_image_len_ptr: Pointer to size_t in which the callback - * may return the length (in bytes) of the compressed on - * disk image of the entry, or the uncompressed size if the - * compressed size has not yet been calculated. - * - * Since computing the compressed image len is expensive, - * the callback should only report the most recently computed - * value -- which will typically be incorrect if the entry - * is dirty. - * - * If *compressed_ptr is set to FALSE, *compressed_image_len_ptr - * should be set to zero. However, as *compressed_image_len_ptr - * will be initialize to zero prior to the call, the callback - * need not modify it if the H5C__CLASS_COMPRESSED_FLAG is - * not set. - * - * If the H5C__CLASS_COMPRESSED_FLAG is not set in the associated - * instance of H5C_class_t, processing in the image_len function - * should proceed as follows: + * Processing in the image_len function should proceed as follows: * * If successful, the function will place the length of the on disk * image associated with the in core representation provided in the - * thing parameter in *image_len_ptr, and then return SUCCEED. Since - * *compressed_ptr and *compressed_image_len_ptr will be initialized to - * FALSE and zero respectively before the call, the callback need not - * modify these values, and may declare the associated parameters as - * UNUSED. - * - * If the H5C__CLASS_COMPRESSED_FLAG is set in the associated - * instance of H5C_class_t, processing in the image_len function - * should proceed as follows: - * - * If successful, the function will place the uncompressed length of - * the on disk image associated with the in core representation - * provided in the thing parameter in *image_len_ptr. If filters - * are not enabled for the entry, it will set *compressed_ptr to FALSE, - * and *compressed_image_len_ptr to zero. If filters are enabled, - * it will set *compressed_ptr to TRUE. In this case, it must set - * *compressed_image_len_ptr equal to the last computed compressed - * if the compressed size, or to the uncompressed size if that value - * is yet to be computed. In all cases, it will return SUCCEED if - * successful. - * - * In either case, if the function fails, it must return FAIL and - * push error information onto the error stack with the error API - * routines, and return without modifying the values pointed to by - * the image_len_ptr, compressed_ptr, and compressed_image_len_ptr - * parameters. + * thing parameter in *image_len_ptr, and then return SUCCEED. + * + * If the function fails, it must return FAIL and push error information + * onto the error stack with the error API routines, and return without + * modifying the values pointed to by the image_len_ptr parameter. * * PRE_SERIALIZE: Pointer to the pre-serialize callback. * @@ -623,11 +479,11 @@ typedef struct H5C_t H5C_t; * it needs a current on-disk image of the metadata entry for purposes * either constructing a journal or flushing the entry to disk. * - * If the client needs to change the address or compressed or - * uncompressed length of the entry prior to flush, the pre-serialize - * callback is responsible for these actions, so that the actual - * serialize callback (described below) is only responsible for - * serializing the data structure, not moving it on disk or resizing it. + * If the client needs to change the address or length of the entry prior + * to flush, the pre-serialize callback is responsible for these actions, + * so that the actual serialize callback (described below) is only + * responsible for serializing the data structure, not moving it on disk + * or resizing it. * * In addition, the client may use the pre-serialize callback to * ensure that the entry is ready to be flushed -- in particular, @@ -641,7 +497,7 @@ typedef struct H5C_t H5C_t; * However, that need not be the case as free space section info * entries will change size (and possibly location) depending on the * number of blocks of free space being manages, and fractal heap - * direct blocks can change compressed size (and possibly location) + * direct blocks can change compressed size (and possibly location) * on serialization if compression is enabled. Similarly, it may * be necessary to move entries from temporary to real file space. * @@ -655,10 +511,8 @@ typedef struct H5C_t H5C_t; * void * thing, * haddr_t addr, * size_t len, - * size_t compressed_len, * haddr_t * new_addr_ptr, * size_t * new_len_ptr, - * size_t * new_compressed_len_ptr, * unsigned * flags_ptr); * * The parameters of the pre-serialize callback are as follows: @@ -686,22 +540,8 @@ typedef struct H5C_t H5C_t; * * len: Length in bytes of the in file image of the entry to be * serialized. Also the size the image passed to the - * serialize callback (discussed below) unless either that - * value is altered by this function, or the entry will be - * compressed. In the latter case, the compressed size - * of the entry will be reported in *new_compressed_len_ptr. - * - * This parameter is supplied mainly for sanity checking. - * Sanity checks should be performed when compiled in debug - * mode, but the parameter may be unused when compiled in - * production mode. - * - * compressed_len: If the entry is to be compressed (i.e. run through - * filters) prior to flush, Length in bytes of the last know - * compressed size of the entry -- or the uncompressed size - * if no such value exists (i.e. the entry has been inserted, - * but never flushed). This parameter should be set to zero - * in all other cases. + * serialize callback (discussed below) unless that + * value is altered by this function. * * This parameter is supplied mainly for sanity checking. * Sanity checks should be performed when compiled in debug @@ -726,20 +566,12 @@ typedef struct H5C_t H5C_t; * *new_len_ptr is undefined on pre-serialize callback * return. * - * new_compressed_len_ptr: Pointer to size_t. If the image will be - * compressed (i.e. run through filters) prior to being - * written to disk, the compressed size (in bytes) of the - * on disk image must be stored in *new_compressed_len_ptr, - * and the appropriate flag set in *flags_ptr. - * * flags_ptr: Pointer to an unsigned integer used to return flags * indicating whether the preserialize function resized or moved - * the entry, or computed its compressed size. If the entry was - * neither resized or moved, nor will be compressed, - * the serialize function must set *flags_ptr to zero. - * H5C__SERIALIZE_RESIZED_FLAG, H5C__SERIALIZE_MOVED_FLAG - * and H5C__SERIALIZE_COMPRESSED_FLAG must be set to indicate - * a resize, a move, or compression respectively. + * the entry. If the entry was neither resized or moved, the + * serialize function must set *flags_ptr to zero. The + * H5C__SERIALIZE_RESIZED_FLAG or H5C__SERIALIZE_MOVED_FLAG must + * be set to indicate a resize or move respectively. * * If the H5C__SERIALIZE_RESIZED_FLAG is set, the new length * must be stored in *new_len_ptr. @@ -747,40 +579,21 @@ typedef struct H5C_t H5C_t; * If the H5C__SERIALIZE_MOVED_FLAG flag is set, the * new image base address must be stored in *new_addr_ptr. * - * If the H5C__SERIALIZE_COMPRESSED_FLAG is set, the - * compressed size of the new image must be stored in - * *new_compressed_len_ptr. - * * Processing in the pre-serialize function should proceed as follows: * * The pre-serialize function must examine the in core representation * indicated by the thing parameter, if the pre-serialize function does - * not need to change the size or location of the on-disk image, or - * compute its compress size, it must set *flags_ptr to zero. + * not need to change the size or location of the on-disk image, it must + * set *flags_ptr to zero. * - * If the (uncompressed) size of the on-disk image must be changed, - * the pre-serialize function must load the length of the new image - * into *new_len_ptr, and set the H5C__SERIALIZE_RESIZED_FLAG in - * *flags_ptr. + * If the size of the on-disk image must be changed, the pre-serialize + * function must load the length of the new image into *new_len_ptr, and + * set the H5C__SERIALIZE_RESIZED_FLAG in *flags_ptr. * * If the base address of the on disk image must be changed, the * pre-serialize function must set *new_addr_ptr to the new base address, * and set the H5C__SERIALIZE_MOVED_FLAG in *flags_ptr. * - * If the H5C__CLASS_COMPRESSED_FLAG is set in the assocated instance - * of H5C_class_t, and filters (i.e. compression) are enabled, the - * pre-serialize function must compute the compressed size of the - * on disk image, and if it has changed, load this value into - * *new_compressed_len_ptr, and set H5C__SERIALIZE_COMPRESSED_FLAG in - * *flags_ptr. - * - * Note that to do this, the preserialize function will typically have - * to serialize the entry, and run it through the filters to obtain - * the compressed size. For efficiency, the compressed image may - * be stored to be copied into the supplied buffer by the - * serialize callback. Needless to say this is awkward. We may - * want to re-work the API for cache clients to simplify this. - * * In addition, the pre-serialize callback may perform any other * processing required before the entry is written to disk * @@ -829,11 +642,7 @@ typedef struct H5C_t H5C_t; * the buffer. * * len: Length in bytes of the in file image of the entry to be - * serialized. Also the size of *image_ptr (below). If - * compression is not enabled, this value is simply the - * uncompressed size of the entry's image on disk. If - * compression is enabled, this value is the size of the - * compressed image. + * serialized. Also the size of *image_ptr (below). * * This parameter is supplied mainly for sanity checking. * Sanity checks should be performed when compiled in debug @@ -852,8 +661,7 @@ typedef struct H5C_t H5C_t; * * The serialize function must then examine the in core * representation indicated by the thing parameter, and write a - * serialized (and possibly compressed) image of its contents into - * the provided buffer. + * serialized image of its contents into the provided buffer. * * If it is successful, the function must return SUCCEED. * @@ -1019,12 +827,12 @@ typedef struct H5C_t H5C_t; * At present this callback is used only by the H5FA and H5EA dblock * and dblock page client classes. * - * The typedef for the clear callback is as follows: + * The typedef for the get_fsf_size callback is as follows: * * typedef herr_t (*H5C_get_fsf_size_t)(const void * thing, * size_t *fsf_size_ptr); * - * The parameters of the clear callback are as follows: + * The parameters of the get_fsf_size callback are as follows: * * thing: Pointer to void containing the address of the in core * representation of the target metadata cache entry. This @@ -1072,12 +880,10 @@ typedef herr_t (*H5C_get_load_size_func_t)(const void *udata_ptr, size_t *image_len_ptr); typedef void *(*H5C_deserialize_func_t)(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr); -typedef herr_t (*H5C_image_len_func_t)(const void *thing, - size_t *image_len_ptr, hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +typedef herr_t (*H5C_image_len_func_t)(const void *thing, size_t *image_len_ptr); typedef herr_t (*H5C_pre_serialize_func_t)(const H5F_t *f, hid_t dxpl_id, - void *thing, haddr_t addr, size_t len, size_t compressed_len, - haddr_t *new_addr_ptr, size_t *new_len_ptr, size_t *new_compressed_len_ptr, - unsigned *flags_ptr); + void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); typedef herr_t (*H5C_serialize_func_t)(const H5F_t *f, void *image_ptr, size_t len, void *thing); typedef herr_t (*H5C_notify_func_t)(H5C_notify_action_t action, void *thing); @@ -1204,51 +1010,11 @@ typedef int H5C_ring_t; * * addr: Base address of the cache entry on disk. * - * size: Length of the cache entry on disk in bytes(exception: if - * the entry is compressed on disk, this field contains the - * uncompressed size of the entry -- see discussion of - * compressed entries below). Note that unlike normal - * caches, the entries in this cache are of arbitrary size. - * - * With the exception of compressed entries, the file space - * allocations for cache entries implied by the addr and size - * fields must be disjoint. For compressed entries, - * the size field contains the uncompressed size -- thus in - * in this case, substitution of compressed size for size - * must result in disjoint file space allocations. However, - * as discussed below, the compressed size may not be know. - * - * Any entry whose associated instance of H5C_class_t has the - * H5C__CLASS_COMPRESSED_FLAG set may be compressed. When - * an entry is compressed (that is, when filters are enabled - * on it), the compressed flag (see below) must be set, and - * the compressed size (if known), must be stored in - * the compressed_size field. - * - * Since the compressed size will be unknown unless the - * entry is clean, or has an up to date image (see the - * image_ptr and image_up_to_date fields below), we use the - * uncompressed size for all purposes other than disk I/O. - * - * compressed: Boolean flag that is set iff the instance of H5C_class_t - * associated with the entry has the H5C__CLASS_COMPRESSED_FLAG - * set, and filters are enabled on the entry. - * - * compressed_size: If compressed is TRUE, this field contains the actual - * compressed size of the entry in bytes, which is also its - * true size on disk -- or the uncompressed size if the - * compressed size is unknown (i.e. the entry has been - * inserted in the cache, but it has not been compressed yet). - * Note that this value will usually be incorrect if the - * entry is dirty. - * - * Since this value is frequently out of date and expensive to - * compute, it is used only for disk I/O. The uncompressed - * size of the entry (stored in the size field above) is used - * for all other purposes (i.e. computing the sum of the sizes - * of all entries in the cache, etc.). - * - * If compressed is FALSE, this field should contain 0. + * size: Length of the cache entry on disk in bytes Note that unlike + * normal caches, the entries in this cache are of arbitrary size. + * + * The file space allocations for cache entries implied by the + * addr and size fields must be disjoint. * * image_ptr: Pointer to void. When not NULL, this field points to a * dynamically allocated block of size bytes in which the @@ -1273,25 +1039,6 @@ typedef int H5C_ring_t; * entry has been modified since the last time it was written * to disk. * - * NOTE: For historical reasons, this field is not maintained - * by the cache. Instead, the module using the cache - * sets this flag when it modifies the entry, and the - * flush and clear functions supplied by that module - * reset the dirty when appropriate. - * - * This is a bit quirky, so we may want to change this - * someday. However it will require a change in the - * cache interface. - * - * Update: Management of the is_dirty field has been largely - * moved into the cache. The only remaining exceptions - * are the flush and clear functions supplied by the - * modules using the cache. These still clear the - * is_dirty field as before. -- JRM 7/5/05 - * - * Update: Management of the is_dirty field is now entirely - * in the cache. -- JRM 7/5/07 - * * dirtied: Boolean flag used to indicate that the entry has been * dirtied while protected. * @@ -1604,8 +1351,6 @@ typedef struct H5C_cache_entry_t { H5C_t * cache_ptr; haddr_t addr; size_t size; - hbool_t compressed; - size_t compressed_size; void * image_ptr; hbool_t image_up_to_date; const H5C_class_t * type; diff --git a/src/H5EAcache.c b/src/H5EAcache.c index ea8bd0e..e944393 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -76,8 +76,7 @@ static herr_t H5EA__cache_hdr_get_load_size(const void *udata, size_t *image_len); static void *H5EA__cache_hdr_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5EA__cache_hdr_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5EA__cache_hdr_image_len(const void *thing, size_t *image_len); static herr_t H5EA__cache_hdr_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5EA__cache_hdr_free_icr(void *thing); @@ -85,9 +84,7 @@ static herr_t H5EA__cache_hdr_free_icr(void *thing); static herr_t H5EA__cache_iblock_get_load_size(const void *udata, size_t *image_len); static void *H5EA__cache_iblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5EA__cache_iblock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5EA__cache_iblock_image_len(const void *thing, size_t *image_len); static herr_t H5EA__cache_iblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *thing); @@ -96,9 +93,7 @@ static herr_t H5EA__cache_iblock_free_icr(void *thing); static herr_t H5EA__cache_sblock_get_load_size(const void *udata, size_t *image_len); static void *H5EA__cache_sblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5EA__cache_sblock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5EA__cache_sblock_image_len(const void *thing, size_t *image_len); static herr_t H5EA__cache_sblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *thing); @@ -107,9 +102,7 @@ static herr_t H5EA__cache_sblock_free_icr(void *thing); static herr_t H5EA__cache_dblock_get_load_size(const void *udata, size_t *image_len); static void *H5EA__cache_dblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5EA__cache_dblock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5EA__cache_dblock_image_len(const void *thing, size_t *image_len); static herr_t H5EA__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *thing); @@ -120,8 +113,7 @@ static herr_t H5EA__cache_dblk_page_get_load_size(const void *udata, size_t *ima static void *H5EA__cache_dblk_page_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); static herr_t H5EA__cache_dblk_page_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); + size_t *image_len); static herr_t H5EA__cache_dblk_page_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *thing); @@ -408,8 +400,7 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */ @@ -690,8 +681,7 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */ @@ -1061,8 +1051,7 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */ @@ -1434,8 +1423,7 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ @@ -1632,7 +1620,7 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */ * file space block set. * * This function is needed when the data block is paged, as - * the datablock header and all its pages are allocted as a + * the datablock header and all its pages are allocated as a * single contiguous chunk of file space, and must be * deallocated the same way. * @@ -1797,8 +1785,7 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 540004a..f904a78 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -74,8 +74,7 @@ static herr_t H5FA__cache_hdr_get_load_size(const void *udata, size_t *image_len); static void *H5FA__cache_hdr_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5FA__cache_hdr_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5FA__cache_hdr_image_len(const void *thing, size_t *image_len); static herr_t H5FA__cache_hdr_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5FA__cache_hdr_free_icr(void *thing); @@ -83,9 +82,7 @@ static herr_t H5FA__cache_hdr_free_icr(void *thing); static herr_t H5FA__cache_dblock_get_load_size(const void *udata, size_t *image_len); static void *H5FA__cache_dblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5FA__cache_dblock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5FA__cache_dblock_image_len(const void *thing, size_t *image_len); static herr_t H5FA__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5FA__cache_dblock_free_icr(void *thing); @@ -94,9 +91,7 @@ static herr_t H5FA__cache_dblock_fsf_size(const void *thing, size_t *fsf_size); static herr_t H5FA__cache_dblk_page_get_load_size(const void *udata, size_t *image_len); static void *H5FA__cache_dblk_page_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5FA__cache_dblk_page_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5FA__cache_dblk_page_image_len(const void *thing, size_t *image_len); static herr_t H5FA__cache_dblk_page_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5FA__cache_dblk_page_free_icr(void *thing); @@ -336,8 +331,7 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5FA_hdr_t *hdr = (const H5FA_hdr_t *)_thing; /* Pointer to the object */ @@ -618,8 +612,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */ @@ -915,8 +908,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr)) +H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)) /* Local variables */ const H5FA_dblk_page_t *dblk_page = (const H5FA_dblk_page_t *)_thing; /* Pointer to the object */ diff --git a/src/H5FScache.c b/src/H5FScache.c index c04ac7c..9b44d8a 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -81,11 +81,9 @@ static herr_t H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *ke static herr_t H5FS__cache_hdr_get_load_size(const void *udata, size_t *image_len); static void *H5FS__cache_hdr_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5FS__cache_hdr_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5FS__cache_hdr_image_len(const void *thing, size_t *image_len); static herr_t H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, - void *thing, haddr_t addr, size_t len, size_t compressed_len, - haddr_t *new_addr, size_t *new_len, size_t *new_compressed_len, + void *thing, haddr_t addr, size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags); static herr_t H5FS__cache_hdr_serialize(const H5F_t *f, void *image, size_t len, void *thing); @@ -94,11 +92,9 @@ static herr_t H5FS__cache_hdr_free_icr(void *thing); static herr_t H5FS__cache_sinfo_get_load_size(const void *udata, size_t *image_len); static void *H5FS__cache_sinfo_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5FS__cache_sinfo_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5FS__cache_sinfo_image_len(const void *thing, size_t *image_len); static herr_t H5FS__cache_sinfo_pre_serialize(const H5F_t *f, hid_t dxpl_id, - void *thing, haddr_t addr, size_t len, size_t compressed_len, - haddr_t *new_addr, size_t *new_len, size_t *new_compressed_len, + void *thing, haddr_t addr, size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags); static herr_t H5FS__cache_sinfo_serialize(const H5F_t *f, void *image, size_t len, void *thing); @@ -326,8 +322,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len) { const H5FS_t *fspace = (const H5FS_t *)_thing; /* Pointer to the object */ @@ -375,8 +370,7 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len, */ static herr_t H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, - haddr_t addr, size_t H5_ATTR_UNUSED len, size_t H5_ATTR_UNUSED compressed_len, - haddr_t *new_addr, size_t *new_len, size_t H5_ATTR_UNUSED *new_compressed_len, + haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t *new_addr, size_t *new_len, unsigned *flags) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */ @@ -990,8 +984,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) { const H5FS_sinfo_t *sinfo = (const H5FS_sinfo_t *)_thing; /* Pointer to the object */ const H5FS_t *fspace; /* Free space header */ @@ -1033,8 +1026,7 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len, */ static herr_t H5FS__cache_sinfo_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, - haddr_t addr, size_t len, size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr, - size_t *new_len, size_t H5_ATTR_UNUSED *new_compressed_len, unsigned *flags) + haddr_t addr, size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags) { H5FS_sinfo_t *sinfo = (H5FS_sinfo_t *)_thing; /* Pointer to the object */ H5FS_t *fspace; /* Free space header */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 2592b90..61ab253 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -70,13 +70,10 @@ static herr_t H5F__cache_superblock_get_load_size(const void *udata, size_t *image_len); static void *H5F__cache_superblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5F__cache_superblock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5F__cache_superblock_image_len(const void *thing, size_t *image_len); static herr_t H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, haddr_t addr, size_t len, - size_t compressed_len, haddr_t *new_addr, size_t *new_len, - size_t *new_compressed_len, unsigned *flags); + haddr_t *new_addr, size_t *new_len, unsigned *flags); static herr_t H5F__cache_superblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5F__cache_superblock_free_icr(void *thing); @@ -84,9 +81,7 @@ static herr_t H5F__cache_superblock_free_icr(void *thing); static herr_t H5F__cache_drvrinfo_get_load_size(const void *udata, size_t *image_len); static void *H5F__cache_drvrinfo_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5F__cache_drvrinfo_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5F__cache_drvrinfo_image_len(const void *thing, size_t *image_len); static herr_t H5F__cache_drvrinfo_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5F__cache_drvrinfo_free_icr(void *thing); @@ -453,7 +448,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F__cache_superblock_image_len(const void *_thing, size_t *image_len, hbool_t *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5F__cache_superblock_image_len(const void *_thing, size_t *image_len) { const H5F_super_t *sblock = (const H5F_super_t *)_thing; /* Pointer to the object */ @@ -464,14 +459,10 @@ H5F__cache_superblock_image_len(const void *_thing, size_t *image_len, hbool_t * HDassert(sblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(sblock->cache_info.type == H5AC_SUPERBLOCK); HDassert(image_len); - HDassert(compressed_ptr); /* Set the image length size */ *image_len = (size_t)H5F_SUPERBLOCK_SIZE(sblock); - /* Set *compressed_ptr to FALSE unconditionally */ - *compressed_ptr = FALSE; - FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5F__cache_superblock_image_len() */ @@ -511,8 +502,7 @@ H5F__cache_superblock_image_len(const void *_thing, size_t *image_len, hbool_t * static herr_t H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t H5_ATTR_UNUSED *new_addr, - size_t H5_ATTR_UNUSED *new_len, size_t H5_ATTR_UNUSED *new_compressed_len, + haddr_t H5_ATTR_UNUSED *new_addr, size_t H5_ATTR_UNUSED *new_len, unsigned H5_ATTR_UNUSED *flags) { H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ @@ -909,8 +899,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len) { const H5O_drvinfo_t *drvinfo = (const H5O_drvinfo_t *)_thing; /* Pointer to the object */ @@ -921,7 +910,6 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len, HDassert(drvinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(drvinfo->cache_info.type == H5AC_DRVRINFO); HDassert(image_len); - HDassert(compressed_ptr); /* Set the image length size */ *image_len = (size_t)(H5F_DRVINFOBLOCK_HDR_SIZE + /* Fixed-size portion of driver info block */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index e3303d1..8ac0215 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -66,8 +66,7 @@ static herr_t H5G__cache_node_get_load_size(const void *udata, size_t *image_len); static void *H5G__cache_node_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5G__cache_node_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5G__cache_node_image_len(const void *thing, size_t *image_len); static herr_t H5G__cache_node_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5G__cache_node_free_icr(void *thing); @@ -241,8 +240,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G__cache_node_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5G__cache_node_image_len(const void *_thing, size_t *image_len) { const H5G_node_t *sym = (const H5G_node_t *)_thing; /* Pointer to object */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 3308f25..bcf1344 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -76,11 +76,9 @@ static herr_t H5HF__dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *d static herr_t H5HF__cache_hdr_get_load_size(const void *udata, size_t *image_len); static void *H5HF__cache_hdr_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5HF__cache_hdr_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5HF__cache_hdr_image_len(const void *thing, size_t *image_len); static herr_t H5HF__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, - void *thing, haddr_t addr, size_t len, size_t compressed_len, - haddr_t *new_addr, size_t *new_len, size_t *new_compressed_len, + void *thing, haddr_t addr, size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags); static herr_t H5HF__cache_hdr_serialize(const H5F_t *f, void *image, size_t len, void *thing); @@ -89,12 +87,9 @@ static herr_t H5HF__cache_hdr_free_icr(void *thing); static herr_t H5HF__cache_iblock_get_load_size(const void *udata, size_t *image_len); static void *H5HF__cache_iblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5HF__cache_iblock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5HF__cache_iblock_image_len(const void *thing, size_t *image_len); static herr_t H5HF__cache_iblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, - void *thing, haddr_t addr, size_t len, size_t compressed_len, - haddr_t *new_addr, size_t *new_len, size_t *new_compressed_len, + void *thing, haddr_t addr, size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags); static herr_t H5HF__cache_iblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); @@ -104,12 +99,9 @@ static herr_t H5HF__cache_iblock_free_icr(void *thing); static herr_t H5HF__cache_dblock_get_load_size(const void *udata, size_t *image_len); static void *H5HF__cache_dblock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5HF__cache_dblock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5HF__cache_dblock_image_len(const void *thing, size_t *image_len); static herr_t H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, - void *thing, haddr_t addr, size_t len, size_t compressed_len, - haddr_t *new_addr, size_t *new_len, size_t *new_compressed_len, + void *thing, haddr_t addr, size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags); static herr_t H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, void *thing); @@ -172,7 +164,7 @@ const H5AC_class_t H5AC_FHEAP_DBLOCK[1] = {{ H5AC_FHEAP_DBLOCK_ID, /* Metadata client ID */ "fractal heap direct block", /* Metadata client name (for debugging) */ H5FD_MEM_FHEAP_DBLOCK, /* File space memory type for client */ - H5C__CLASS_COMPRESSED_FLAG, /* Client class behavior flags */ + H5AC__CLASS_NO_FLAGS_SET, /* Client class behavior flags */ H5HF__cache_dblock_get_load_size, /* 'get_load_size' callback */ H5HF__cache_dblock_deserialize, /* 'deserialize' callback */ H5HF__cache_dblock_image_len, /* 'image_len' callback */ @@ -578,8 +570,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_hdr_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5HF__cache_hdr_image_len(const void *_thing, size_t *image_len) { const H5HF_hdr_t *hdr = (const H5HF_hdr_t *)_thing; /* Fractal heap info */ @@ -619,9 +610,8 @@ H5HF__cache_hdr_image_len(const void *_thing, size_t *image_len, */ static herr_t H5HF__cache_hdr_pre_serialize(const H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, - void *_thing, haddr_t addr, size_t len, size_t H5_ATTR_UNUSED compressed_len, - haddr_t H5_ATTR_UNUSED *new_addr, size_t H5_ATTR_UNUSED *new_len, - size_t H5_ATTR_UNUSED *new_compressed_len, unsigned *flags) + void *_thing, haddr_t addr, size_t len, haddr_t H5_ATTR_UNUSED *new_addr, + size_t H5_ATTR_UNUSED *new_len, unsigned *flags) { H5HF_hdr_t *hdr = (H5HF_hdr_t *)_thing; /* Fractal heap info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1083,8 +1073,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_iblock_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5HF__cache_iblock_image_len(const void *_thing, size_t *image_len) { const H5HF_indirect_t *iblock = (const H5HF_indirect_t *)_thing; /* Indirect block info */ @@ -1123,9 +1112,8 @@ H5HF__cache_iblock_image_len(const void *_thing, size_t *image_len, */ static herr_t H5HF__cache_iblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, - haddr_t addr, size_t H5_ATTR_UNUSED len, size_t H5_ATTR_UNUSED compressed_len, - haddr_t *new_addr, size_t H5_ATTR_UNUSED *new_len, - size_t H5_ATTR_UNUSED *new_compressed_len, unsigned *flags) + haddr_t addr, size_t H5_ATTR_UNUSED len, haddr_t *new_addr, + size_t H5_ATTR_UNUSED *new_len, unsigned *flags) { H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_indirect_t *iblock = (H5HF_indirect_t *)_thing; /* Indirect block info */ @@ -1494,10 +1482,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__cache_iblock_free_icr() */ -/*********************************************************/ -/* metadata cache callback definitions for direct blocks */ -/*********************************************************/ - /*------------------------------------------------------------------------- * Function: H5HF__cache_dblock_get_load_size() @@ -1752,14 +1736,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len, hbool_t *compressed_ptr, size_t *compressed_image_len_ptr) +H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len) { const H5HF_direct_t *dblock = (const H5HF_direct_t *)_thing; /* Direct block info */ - const H5HF_indirect_t *par_iblock; /* Parent iblock */ const H5HF_hdr_t *hdr; /* Shared fractal heap information */ - hbool_t compressed; size_t size; - size_t compressed_size; FUNC_ENTER_STATIC_NOERR @@ -1768,19 +1749,15 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len, hbool_t *com HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); HDassert(image_len); - HDassert(compressed_ptr); - HDassert(compressed_image_len_ptr); /* Set up convenience variables */ hdr = dblock->hdr; - par_iblock = dblock->parent; + HDassert(hdr); /* Check for I/O filters on this heap */ if(hdr->filter_len > 0) { - - /* Filters are enabled, so set compressed to TRUE, and set - * size equal to the uncompressed size of the direct block. - * If the data is available, set compressed_size to the compressed + /* + * If the data is available, set to the compressed * size of the direct block -- otherwise set it equal to the * uncompressed size. * @@ -1790,7 +1767,7 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len, hbool_t *com * case, both dblock->file_size and the size stored in the * parent (either the header or the parent iblock) will all * be zero. In this case, return the uncompressed size - * stored in dblock->size as the compressed size. + * stored in dblock->size as the size. * * Second, the block may have just been serialized, in which * case, dblock->file_size should be zero, and the correct @@ -1804,42 +1781,26 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len, hbool_t *com * and thus looking up the parent will likely return incorrect * data. */ - size = dblock->size; - compressed = TRUE; - compressed_size = dblock->size; /* will overwrite if compressed - * size is available. - */ - if(dblock->file_size != 0) - compressed_size = dblock->file_size; + size = dblock->file_size; else { - if(par_iblock) { - unsigned par_entry; /* Entry in parent indirect block */ - - par_entry = dblock->par_entry; - compressed_size = par_iblock->filt_ents[par_entry].size; + const H5HF_indirect_t *par_iblock = dblock->parent; /* Parent iblock */ - } /* end if */ - else { - compressed_size = hdr->pline_root_direct_size; - } - - if(compressed_size == 0) - compressed_size = dblock->size; + if(par_iblock) + size = par_iblock->filt_ents[dblock->par_entry].size; + else + size = hdr->pline_root_direct_size; + if(size == 0) + size = dblock->size; } /* end else */ } /* end if */ - else { + else size = dblock->size; - compressed = FALSE; - compressed_size = 0; /* a convenient, invalid value */ - } + /* Set the image size */ HDassert(size > 0); - - *image_len = size; - *compressed_ptr = compressed; - *compressed_image_len_ptr = compressed_size; + *image_len = size; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF__cache_dblock_image_len() */ @@ -1851,7 +1812,7 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len, hbool_t *com * Purpose: In principle, the purpose of this function is to determine * the size and location of the disk image of the target direct * block. In this case, the uncompressed size of the block is - * fixed, but sined the H5C__CLASS_COMPRESSED_FLAG is set, + * fixed, but since the direct block could be compressed, * we may need to compute and report the compressed size. * * This is a bit sticky in the case of a direct block when I/O @@ -1863,8 +1824,8 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len, hbool_t *com * * To complicate matters further, the direct block may have been * initially allocated in temporary (AKA imaginary) file space. - * In this case, we must relocate the direct block's on disk - * image to real file space regardless of whether it has changed + * In this case, we must relocate the direct block's on-disk + * image to "real" file space regardless of whether it has changed * size. * * One simplifying factor is the direct block's "blk" field, @@ -1909,8 +1870,7 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len, hbool_t *com */ static herr_t H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr, - size_t H5_ATTR_UNUSED *new_len, size_t *new_compressed_len, unsigned *flags) + haddr_t addr, size_t len, haddr_t *new_addr, size_t *new_len, unsigned *flags) { hbool_t at_tmp_addr; /* Flag to indicate direct block is */ /* at temporary address */ @@ -1936,18 +1896,14 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(dblock->write_size == 0); HDassert(dblock->cache_info.size == len); HDassert(H5F_addr_defined(addr)); - HDassert(len == dblock->size); HDassert(new_addr); - HDassert(new_compressed_len); + HDassert(new_len); HDassert(flags); /* Set up local variables */ hdr = dblock->hdr; dblock_addr = addr; /* will update dblock_addr if we move the block */ - /* dblock->size must match dblock->cache_info.size */ - HDassert(dblock->cache_info.size == dblock->size); - /* Set the shared heap header's file context for this operation */ hdr->f = (H5F_t *)f; @@ -2035,9 +1991,10 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, /* Allocate buffer to perform I/O filtering on */ write_size = dblock->size; - if(NULL == (write_buf = H5MM_malloc(write_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") + + /* Copy the direct block's image into the buffer to compress */ HDmemcpy(write_buf, dblock->blk, write_size); /* Push direct block data through I/O filter pipeline */ @@ -2074,7 +2031,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, * size matches the heap's last record. This value will * likely change shortly. */ - HDassert(compressed_len == hdr->pline_root_direct_size); + HDassert(len == hdr->pline_root_direct_size); /* Check if we need to re-size the block on disk */ if(hdr->pline_root_direct_size != write_size || at_tmp_addr) { @@ -2083,26 +2040,20 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, * * (temp. file space does not need to be freed) */ - if(!at_tmp_addr) { + if(!at_tmp_addr) /* Release direct block's current disk space */ if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)hdr->pline_root_direct_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") - } /* end if */ /* Allocate space for the compressed direct block */ if(HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") - /* Let the metadata cache know, if the block moved */ - if(!H5F_addr_eq(hdr->man_dtable.table_addr, dblock_addr)) - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr, dxpl_id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") - /* Update information about compressed direct block's * location & size */ HDassert(hdr->man_dtable.table_addr == addr); - HDassert(hdr->pline_root_direct_size == compressed_len); + HDassert(hdr->pline_root_direct_size == len); hdr->man_dtable.table_addr = dblock_addr; hdr->pline_root_direct_size = write_size; @@ -2132,7 +2083,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, * size matches the heap's last record. This value will * likely change shortly. */ - HDassert(compressed_len == par_iblock->filt_ents[par_entry].size); + HDassert(len == par_iblock->filt_ents[par_entry].size); /* Check if we need to re-size the block on disk */ if(par_iblock->filt_ents[par_entry].size != write_size || at_tmp_addr) { @@ -2141,26 +2092,20 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, * * (temp. file space does not need to be freed) */ - if(!at_tmp_addr) { + if(!at_tmp_addr) /* Release direct block's current disk space */ if(H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, addr, (hsize_t)par_iblock->filt_ents[par_entry].size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") - } /* end if */ /* Allocate space for the compressed direct block */ if(HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") - /* Let the metadata cache know, if the block moved */ - if(!H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)) - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr, dxpl_id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") - /* Update information about compressed direct block's * location & size */ HDassert(par_iblock->ents[par_entry].addr == addr); - HDassert(par_iblock->filt_ents[par_entry].size == compressed_len); + HDassert(par_iblock->filt_ents[par_entry].size == len); par_iblock->ents[par_entry].addr = dblock_addr; par_iblock->filt_ents[par_entry].size = write_size; @@ -2192,22 +2137,16 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, * to 'normal' file space */ if(at_tmp_addr) { + /* Allocate 'normal' space for the direct block */ + if(HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") + /* Check for root direct block */ if(NULL == dblock->parent) { - /* Sanity check */ + /* Sanity checks */ HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); - - /* Allocate 'normal' space for the direct block */ - if(HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") - - /* Sanity check */ HDassert(!H5F_addr_eq(hdr->man_dtable.table_addr, dblock_addr)); - /* Let the metadata cache know the block moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr, dxpl_id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") - /* Update information about direct block's location */ hdr->man_dtable.table_addr = dblock_addr; @@ -2216,22 +2155,12 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") } /* end if */ else { /* the direct block's parent is an indirect block */ - /* Sanity check */ + /* Sanity checks */ HDassert(par_iblock); HDassert(par_iblock->ents); HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); - - /* Allocate 'normal' space for the direct block */ - if(HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") - - /* Sanity check */ HDassert(!H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)); - /* Let the metadata cache know the block moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr, dxpl_id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") - /* Update information about direct block's location */ par_iblock->ents[par_entry].addr = dblock_addr; @@ -2261,9 +2190,9 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, *new_addr = dblock_addr; } /* end if */ - if((hdr->filter_len > 0) && (compressed_len != write_size)) { - dblock_flags |= H5C__SERIALIZE_COMPRESSED_FLAG; - *new_compressed_len = write_size; + if((hdr->filter_len > 0) && (len != write_size)) { + dblock_flags |= H5C__SERIALIZE_RESIZED_FLAG; + *new_len = write_size; } /* end if */ *flags = dblock_flags; diff --git a/src/H5HGcache.c b/src/H5HGcache.c index c1eb8d9..31f40f5 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -65,8 +65,7 @@ static herr_t H5HG__cache_heap_get_load_size(const void *udata, size_t *image_len); static void *H5HG__cache_heap_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5HG__cache_heap_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5HG__cache_heap_image_len(const void *thing, size_t *image_len); static herr_t H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5HG__cache_heap_free_icr(void *thing); @@ -331,8 +330,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HG__cache_heap_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5HG__cache_heap_image_len(const void *_thing, size_t *image_len) { const H5HG_heap_t *heap = (const H5HG_heap_t *)_thing; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 95ab65d..a9a9851 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -74,9 +74,7 @@ static herr_t H5HL__cache_prefix_get_load_size(const void *udata, size_t *image_len); static void *H5HL__cache_prefix_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5HL__cache_prefix_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5HL__cache_prefix_image_len(const void *thing, size_t *image_len); static herr_t H5HL__cache_prefix_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5HL__cache_prefix_free_icr(void *thing); @@ -86,9 +84,7 @@ static herr_t H5HL__cache_datablock_get_load_size(const void *udata, size_t *image_len); static void *H5HL__cache_datablock_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5HL__cache_datablock_image_len(const void *thing, - size_t *image_len, hbool_t *compressed_ptr, - size_t *compressed_image_len_ptr); +static herr_t H5HL__cache_datablock_image_len(const void *thing, size_t *image_len); static herr_t H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5HL__cache_datablock_free_icr(void *thing); @@ -455,8 +451,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len) { const H5HL_prfx_t *prfx = (const H5HL_prfx_t *)_thing; /* Pointer to local heap prefix to query */ @@ -480,10 +475,6 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HL__cache_prefix_image_len() */ -/****************************************/ -/* no H5HL_cache_prefix_pre_serialize() */ -/****************************************/ - /*------------------------------------------------------------------------- * Function: H5HL__cache_prefix_serialize @@ -746,8 +737,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len) { const H5HL_dblk_t *dblk = (const H5HL_dblk_t *)_thing; /* Pointer to the local heap data block */ @@ -766,10 +756,6 @@ H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HL__cache_datablock_image_len() */ -/*******************************************/ -/* no H5HL_cache_datablock_pre_serialize() */ -/*******************************************/ - /*------------------------------------------------------------------------- * Function: H5HL__cache_datablock_serialize diff --git a/src/H5Ocache.c b/src/H5Ocache.c index f1a128d..badeb69 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -71,8 +71,7 @@ static herr_t H5O__cache_get_load_size(const void *udata, size_t *image_len); static void *H5O__cache_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5O__cache_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5O__cache_image_len(const void *thing, size_t *image_len); static herr_t H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5O__cache_free_icr(void *thing); @@ -81,8 +80,7 @@ static herr_t H5O__cache_clear(const H5F_t *f, void *thing, hbool_t about_to_des static herr_t H5O__cache_chk_get_load_size(const void *udata, size_t *image_len); static void *H5O__cache_chk_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5O__cache_chk_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5O__cache_chk_image_len(const void *thing, size_t *image_len); static herr_t H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5O__cache_chk_free_icr(void *thing); @@ -165,7 +163,8 @@ H5FL_SEQ_DEFINE(H5O_cont_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Aug 2015 + * Programmer: Vailin Choi + * Aug 2015 * *------------------------------------------------------------------------- */ @@ -174,7 +173,6 @@ H5O_decode_prefix(H5F_t *f, H5O_t *oh, const uint8_t *buf, void *_udata) { H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */ const uint8_t *p = buf; /* Pointer into buffer to decode */ - size_t prefix_size; /* Size of object header prefix */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -292,8 +290,7 @@ H5O_decode_prefix(H5F_t *f, H5O_t *oh, const uint8_t *buf, void *_udata) } /* end else */ /* Determine object header prefix length */ - prefix_size = (size_t)(p - buf); - HDassert((size_t)prefix_size == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); + HDassert((size_t)(p - buf) == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); done: FUNC_LEAVE_NOAPI(ret_value) @@ -431,8 +428,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__cache_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5O__cache_image_len(const void *_thing, size_t *image_len) { const H5O_t *oh = (const H5O_t *)_thing; /* Object header to query */ @@ -453,10 +449,6 @@ H5O__cache_image_len(const void *_thing, size_t *image_len, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__cache_image_len() */ -/********************************/ -/* no H5O_cache_pre_serialize() */ -/********************************/ - /*------------------------------------------------------------------------- * Function: H5O__cache_serialize @@ -848,8 +840,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__cache_chk_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5O__cache_chk_image_len(const void *_thing, size_t *image_len) { const H5O_chunk_proxy_t * chk_proxy = (const H5O_chunk_proxy_t *)_thing; /* Chunk proxy to query */ @@ -867,10 +858,6 @@ H5O__cache_chk_image_len(const void *_thing, size_t *image_len, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__cache_chk_image_len() */ -/************************************/ -/* no H5O_cache_chk_pre_serialize() */ -/************************************/ - /*------------------------------------------------------------------------- * Function: H5O__cache_chk_serialize diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 4de86e2..3cac052 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -61,8 +61,7 @@ static herr_t H5SM__cache_table_get_load_size(const void *udata, size_t *image_len); static void *H5SM__cache_table_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5SM__cache_table_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5SM__cache_table_image_len(const void *thing, size_t *image_len); static herr_t H5SM__cache_table_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5SM__cache_table_free_icr(void *thing); @@ -70,8 +69,7 @@ static herr_t H5SM__cache_table_free_icr(void *thing); static herr_t H5SM__cache_list_get_load_size(const void *udata, size_t *image_len); static void *H5SM__cache_list_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty); -static herr_t H5SM__cache_list_image_len(const void *thing, size_t *image_len, - hbool_t *compressed_ptr, size_t *compressed_image_len_ptr); +static herr_t H5SM__cache_list_image_len(const void *thing, size_t *image_len); static herr_t H5SM__cache_list_serialize(const H5F_t *f, void *image, size_t len, void *thing); static herr_t H5SM__cache_list_free_icr(void *thing); @@ -301,8 +299,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_table_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5SM__cache_table_image_len(const void *_thing, size_t *image_len) { const H5SM_master_table_t *table = (const H5SM_master_table_t *)_thing; /* Shared message table to query */ @@ -319,10 +316,6 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__cache_table_image_len() */ -/***************************************/ -/* no H5SM_cache_table_pre_serialize() */ -/***************************************/ - /*------------------------------------------------------------------------- * Function: H5SM__cache_table_serialize @@ -591,8 +584,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5SM__cache_list_image_len(const void *_thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_image_len_ptr) +H5SM__cache_list_image_len(const void *_thing, size_t *image_len) { const H5SM_list_t *list = (const H5SM_list_t *)_thing; /* Shared message list to query */ @@ -610,10 +602,6 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__cache_list_image_len() */ -/**************************************/ -/* no H5SM_cache_list_pre_serialize() */ -/**************************************/ - /*------------------------------------------------------------------------- * Function: H5SM__cache_list_serialize diff --git a/test/cache_common.c b/test/cache_common.c index 94034eb..247ac57 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -111,62 +111,51 @@ static void *variable_deserialize(const void *image_ptr, size_t len, void *udata static void *notify_deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr); -static herr_t pico_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t nano_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t micro_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t tiny_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t small_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t medium_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t large_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t huge_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t monster_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t variable_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); -static herr_t notify_image_len(void *thing, size_t *image_len_ptr, - hbool_t *compressed_ptr, size_t * compressed_len_ptr); +static herr_t pico_image_len(const void *thing, size_t *image_len_ptr); +static herr_t nano_image_len(const void *thing, size_t *image_len_ptr); +static herr_t micro_image_len(const void *thing, size_t *image_len_ptr); +static herr_t tiny_image_len(const void *thing, size_t *image_len_ptr); +static herr_t small_image_len(const void *thing, size_t *image_len_ptr); +static herr_t medium_image_len(const void *thing, size_t *image_len_ptr); +static herr_t large_image_len(const void *thing, size_t *image_len_ptr); +static herr_t huge_image_len(const void *thing, size_t *image_len_ptr); +static herr_t monster_image_len(const void *thing, size_t *image_len_ptr); +static herr_t variable_image_len(const void *thing, size_t *image_len_ptr); +static herr_t notify_image_len(const void *thing, size_t *image_len_ptr); static herr_t pico_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t nano_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t micro_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t tiny_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t small_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t medium_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t large_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t huge_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t monster_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t variable_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t notify_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, - haddr_t addr, size_t len, size_t compressed_len, haddr_t *new_addr_ptr, - size_t *new_len_ptr, size_t *new_compressed_len_ptr, unsigned *flags_ptr); + haddr_t addr, size_t len, haddr_t *new_addr_ptr, + size_t *new_len_ptr, unsigned *flags_ptr); static herr_t pico_serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing); @@ -214,7 +203,7 @@ static herr_t get_load_size(const void *udata_ptr, size_t *image_len_ptr, int32_t entry_type); static void *deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr, int32_t entry_type); -static herr_t image_len(void *thing, size_t *image_len_ptr, int32_t entry_type); +static herr_t image_len(const void *thing, size_t *image_len_ptr, int32_t entry_type); static herr_t pre_serialize(const H5F_t *f, hid_t dxpl_id, void *thing, haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); @@ -317,165 +306,165 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = "pico_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)pico_get_load_size, - (H5C_deserialize_func_t)pico_deserialize, - (H5C_image_len_func_t)pico_image_len, - (H5AC_pre_serialize_func_t)pico_pre_serialize, - (H5C_serialize_func_t)pico_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)pico_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + pico_get_load_size, + pico_deserialize, + pico_image_len, + pico_pre_serialize, + pico_serialize, + NULL, + pico_free_icr, + NULL, + NULL, }, { NANO_ENTRY_TYPE, "nano_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)nano_get_load_size, - (H5C_deserialize_func_t)nano_deserialize, - (H5C_image_len_func_t)nano_image_len, - (H5AC_pre_serialize_func_t)nano_pre_serialize, - (H5C_serialize_func_t)nano_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)nano_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + nano_get_load_size, + nano_deserialize, + nano_image_len, + nano_pre_serialize, + nano_serialize, + NULL, + nano_free_icr, + NULL, + NULL, }, { MICRO_ENTRY_TYPE, "micro_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)micro_get_load_size, - (H5C_deserialize_func_t)micro_deserialize, - (H5C_image_len_func_t)micro_image_len, - (H5AC_pre_serialize_func_t)micro_pre_serialize, - (H5C_serialize_func_t)micro_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)micro_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + micro_get_load_size, + micro_deserialize, + micro_image_len, + micro_pre_serialize, + micro_serialize, + NULL, + micro_free_icr, + NULL, + NULL, }, { TINY_ENTRY_TYPE, "tiny_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)tiny_get_load_size, - (H5C_deserialize_func_t)tiny_deserialize, - (H5C_image_len_func_t)tiny_image_len, - (H5AC_pre_serialize_func_t)tiny_pre_serialize, - (H5C_serialize_func_t)tiny_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)tiny_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + tiny_get_load_size, + tiny_deserialize, + tiny_image_len, + tiny_pre_serialize, + tiny_serialize, + NULL, + tiny_free_icr, + NULL, + NULL, }, { SMALL_ENTRY_TYPE, "small_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)small_get_load_size, - (H5C_deserialize_func_t)small_deserialize, - (H5C_image_len_func_t)small_image_len, - (H5AC_pre_serialize_func_t)small_pre_serialize, - (H5C_serialize_func_t)small_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)small_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + small_get_load_size, + small_deserialize, + small_image_len, + small_pre_serialize, + small_serialize, + NULL, + small_free_icr, + NULL, + NULL, }, { MEDIUM_ENTRY_TYPE, "medium_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)medium_get_load_size, - (H5C_deserialize_func_t)medium_deserialize, - (H5C_image_len_func_t)medium_image_len, - (H5AC_pre_serialize_func_t)medium_pre_serialize, - (H5C_serialize_func_t)medium_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)medium_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + medium_get_load_size, + medium_deserialize, + medium_image_len, + medium_pre_serialize, + medium_serialize, + NULL, + medium_free_icr, + NULL, + NULL, }, { LARGE_ENTRY_TYPE, "large_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)large_get_load_size, - (H5C_deserialize_func_t)large_deserialize, - (H5C_image_len_func_t)large_image_len, - (H5AC_pre_serialize_func_t)large_pre_serialize, - (H5C_serialize_func_t)large_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)large_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + large_get_load_size, + large_deserialize, + large_image_len, + large_pre_serialize, + large_serialize, + NULL, + large_free_icr, + NULL, + NULL, }, { HUGE_ENTRY_TYPE, "huge_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)huge_get_load_size, - (H5C_deserialize_func_t)huge_deserialize, - (H5C_image_len_func_t)huge_image_len, - (H5AC_pre_serialize_func_t)huge_pre_serialize, - (H5C_serialize_func_t)huge_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)huge_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + huge_get_load_size, + huge_deserialize, + huge_image_len, + huge_pre_serialize, + huge_serialize, + NULL, + huge_free_icr, + NULL, + NULL, }, { MONSTER_ENTRY_TYPE, "monster_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)monster_get_load_size, - (H5C_deserialize_func_t)monster_deserialize, - (H5C_image_len_func_t)monster_image_len, - (H5AC_pre_serialize_func_t)monster_pre_serialize, - (H5C_serialize_func_t)monster_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)monster_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + monster_get_load_size, + monster_deserialize, + monster_image_len, + monster_pre_serialize, + monster_serialize, + NULL, + monster_free_icr, + NULL, + NULL, }, { VARIABLE_ENTRY_TYPE, "variable_entry", H5FD_MEM_DEFAULT, H5C__CLASS_SPECULATIVE_LOAD_FLAG, - (H5C_get_load_size_func_t)variable_get_load_size, - (H5C_deserialize_func_t)variable_deserialize, - (H5C_image_len_func_t)variable_image_len, - (H5AC_pre_serialize_func_t)variable_pre_serialize, - (H5C_serialize_func_t)variable_serialize, - (H5C_notify_func_t)NULL, - (H5C_free_icr_func_t)variable_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + variable_get_load_size, + variable_deserialize, + variable_image_len, + variable_pre_serialize, + variable_serialize, + NULL, + variable_free_icr, + NULL, + NULL, }, { NOTIFY_ENTRY_TYPE, "notify_entry", H5FD_MEM_DEFAULT, H5C__CLASS_NO_FLAGS_SET, - (H5C_get_load_size_func_t)notify_get_load_size, - (H5C_deserialize_func_t)notify_deserialize, - (H5C_image_len_func_t)notify_image_len, - (H5AC_pre_serialize_func_t)notify_pre_serialize, - (H5C_serialize_func_t)notify_serialize, - (H5C_notify_func_t)notify_notify, - (H5C_free_icr_func_t)notify_free_icr, - (H5C_clear_func_t)NULL, - (H5C_get_fsf_size_t)NULL, + notify_get_load_size, + notify_deserialize, + notify_image_len, + notify_pre_serialize, + notify_serialize, + notify_notify, + notify_free_icr, + NULL, + NULL, } }; @@ -872,9 +861,9 @@ notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty) *------------------------------------------------------------------------- */ herr_t -image_len(void *thing, size_t *image_length, int32_t entry_type) +image_len(const void *thing, size_t *image_length, int32_t entry_type) { - test_entry_t *entry; + const test_entry_t *entry; test_entry_t *base_addr; int32_t type; int32_t idx; @@ -882,7 +871,7 @@ image_len(void *thing, size_t *image_length, int32_t entry_type) HDassert(thing); HDassert(image_length); - entry = (test_entry_t *)thing; + entry = (const test_entry_t *)thing; HDassert(entry->self == entry); @@ -909,78 +898,67 @@ image_len(void *thing, size_t *image_length, int32_t entry_type) } /* image_len() */ herr_t -pico_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +pico_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, PICO_ENTRY_TYPE); } herr_t -nano_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +nano_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, NANO_ENTRY_TYPE); } herr_t -micro_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +micro_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, MICRO_ENTRY_TYPE); } herr_t -tiny_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +tiny_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, TINY_ENTRY_TYPE); } herr_t -small_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +small_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, SMALL_ENTRY_TYPE); } herr_t -medium_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +medium_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, MEDIUM_ENTRY_TYPE); } herr_t -large_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +large_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, LARGE_ENTRY_TYPE); } herr_t -huge_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +huge_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, HUGE_ENTRY_TYPE); } herr_t -monster_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +monster_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, MONSTER_ENTRY_TYPE); } herr_t -variable_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +variable_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, VARIABLE_ENTRY_TYPE); } herr_t -notify_image_len(void *thing, size_t *image_length, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +notify_image_len(const void *thing, size_t *image_length) { return image_len(thing, image_length, NOTIFY_ENTRY_TYPE); } @@ -1095,10 +1073,8 @@ pico_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1111,10 +1087,8 @@ nano_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1127,10 +1101,8 @@ micro_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1143,10 +1115,8 @@ tiny_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1159,10 +1129,8 @@ small_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1175,10 +1143,8 @@ medium_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1191,10 +1157,8 @@ large_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1207,10 +1171,8 @@ huge_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1223,10 +1185,8 @@ monster_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1239,10 +1199,8 @@ variable_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, @@ -1255,10 +1213,8 @@ notify_pre_serialize(const H5F_t *f, void *thing, haddr_t addr, size_t len, - size_t H5_ATTR_UNUSED compressed_len, haddr_t *new_addr_ptr, size_t *new_len_ptr, - size_t H5_ATTR_UNUSED *new_compressed_len_ptr, unsigned *flags_ptr) { return pre_serialize(f, dxpl_id, thing, addr, len, diff --git a/test/earray.c b/test/earray.c index 44d16c5..5211b97 100644 --- a/test/earray.c +++ b/test/earray.c @@ -163,22 +163,11 @@ typedef struct earray_test_t { static herr_t earray_cache_test_get_load_size(const void *udata_ptr, size_t *image_len_ptr); - -static void *earray_cache_test_deserialize(const void *image_ptr, - size_t len, - void *udata_ptr, - hbool_t *dirty_ptr); - -static herr_t earray_cache_test_image_len(const void *thing, - size_t *image_len_ptr, - hbool_t *compressed_ptr, - size_t * compressed_len_ptr); - -static herr_t earray_cache_test_serialize(const H5F_t *f, - void *image_ptr, - size_t len, - void *thing); - +static void *earray_cache_test_deserialize(const void *image_ptr, size_t len, + void *udata_ptr, hbool_t *dirty_ptr); +static herr_t earray_cache_test_image_len(const void *thing, size_t *image_len_ptr); +static herr_t earray_cache_test_serialize(const H5F_t *f, void *image_ptr, + size_t len, void *thing); static herr_t earray_cache_test_free_icr(void *thing); @@ -201,13 +190,13 @@ const H5AC_class_t H5AC_EARRAY_TEST[1] = {{ /* name */ "earray test", /* mem_type */ H5FD_MEM_DEFAULT, /* flags */ H5AC__CLASS_SKIP_READS | H5AC__CLASS_SKIP_WRITES, - /* get_load_size */ (H5AC_get_load_size_func_t)earray_cache_test_get_load_size, - /* deserialize */ (H5AC_deserialize_func_t)earray_cache_test_deserialize, - /* image_len */ (H5AC_image_len_func_t)earray_cache_test_image_len, - /* pre_serialize */ (H5AC_pre_serialize_func_t)NULL, - /* serialize */ (H5AC_serialize_func_t)earray_cache_test_serialize, - /* notify */ (H5AC_notify_func_t)NULL, - /* free_icr */ (H5AC_free_icr_func_t)earray_cache_test_free_icr, + /* get_load_size */ earray_cache_test_get_load_size, + /* deserialize */ earray_cache_test_deserialize, + /* image_len */ earray_cache_test_image_len, + /* pre_serialize */ NULL, + /* serialize */ earray_cache_test_serialize, + /* notify */ NULL, + /* free_icr */ earray_cache_test_free_icr, /* clear */ NULL, /* fsf_size */ NULL, }}; @@ -659,7 +648,6 @@ earray_cache_test_get_load_size(const void *udata_ptr, size_t *image_len_ptr) *image_len_ptr = 0; return(SUCCEED); - } /* end earray_cache_test_get_load_size() */ @@ -691,12 +679,10 @@ earray_cache_test_deserialize(const void *image_ptr, HDassert(udata_ptr); HDassert(dirty_ptr); - /* Should never be called */ HDassert(0 && "Can't be called!"); return(NULL); - } /* end earray_cache_test_deserialize() */ @@ -719,10 +705,8 @@ earray_cache_test_deserialize(const void *image_ptr, *------------------------------------------------------------------------- */ static herr_t -earray_cache_test_image_len(const void *thing, size_t *image_len_ptr, - hbool_t H5_ATTR_UNUSED * compressed_ptr, size_t H5_ATTR_UNUSED * compressed_len_ptr) +earray_cache_test_image_len(const void *thing, size_t *image_len_ptr) { - HDassert(thing); HDassert(image_len_ptr); @@ -731,14 +715,9 @@ earray_cache_test_image_len(const void *thing, size_t *image_len_ptr, *image_len_ptr = 1; return(SUCCEED); - } /* end earray_cache_test_image_len() */ -/********************************/ -/* no H5O_cache_pre_serialize() */ -/********************************/ - /*------------------------------------------------------------------------- * Function: earray_cache_test_serialize @@ -764,14 +743,12 @@ earray_cache_test_serialize(const H5F_t *f, H5_ATTR_UNUSED size_t len, void *thing) { - earray_test_t *test = NULL; + earray_test_t *test; HDassert(f); HDassert(image_ptr); HDassert(thing); - test = (earray_test_t *)thing; - HDassert(test); HDassert(test->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDassert((const H5AC_class_t *)(test->cache_info.type) == @@ -814,16 +791,10 @@ earray_cache_test_serialize(const H5F_t *f, return(SUCCEED); error: - return(FAIL); - } /* end earray_cache_test_serialize() */ -/******************************************/ -/* no earray_cache_test_notify() function */ -/******************************************/ - /*------------------------------------------------------------------------- * Function: earray_cache_test_free_icr @@ -846,12 +817,10 @@ error: static herr_t earray_cache_test_free_icr(void *thing) { - earray_test_t *test = NULL; + earray_test_t *test; HDassert(thing); - test = (earray_test_t *)thing; - HDassert(test); /* the metadata cache sets cache_info.magic to @@ -867,7 +836,6 @@ earray_cache_test_free_icr(void *thing) HDfree(test); return(SUCCEED); - } /* end earray_cache_test_free_icr() */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 8b77ebe..8312512 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -397,10 +397,8 @@ static void * datum_deserialize(const void * image_ptr, void * udata_ptr, hbool_t * dirty_ptr); -static herr_t datum_image_len(void *thing, - size_t *image_len_ptr, - hbool_t *compressed_ptr, - size_t *compressed_len_ptr); +static herr_t datum_image_len(const void *thing, + size_t *image_len_ptr); static herr_t datum_serialize(const H5F_t *f, void *image_ptr, @@ -439,15 +437,15 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = /* name */ "datum", /* mem_type */ H5FD_MEM_DEFAULT, /* flags */ H5AC__CLASS_SKIP_READS | H5AC__CLASS_SKIP_WRITES, - /* get_load_size */ (H5AC_get_load_size_func_t)datum_get_load_size, - /* deserialize */ (H5AC_deserialize_func_t)datum_deserialize, - /* image_len */ (H5AC_image_len_func_t)datum_image_len, - /* pre_serialize */ (H5AC_pre_serialize_func_t)NULL, - /* serialize */ (H5AC_serialize_func_t)datum_serialize, - /* notify */ (H5AC_notify_func_t)datum_notify, - /* free_icr */ (H5AC_free_icr_func_t)datum_free_icr, - /* clear */ (H5AC_clear_func_t)datum_clear, - /* fsf_size */ (H5AC_get_fsf_size_t)NULL, + /* get_load_size */ datum_get_load_size, + /* deserialize */ datum_deserialize, + /* image_len */ datum_image_len, + /* pre_serialize */ NULL, + /* serialize */ datum_serialize, + /* notify */ datum_notify, + /* free_icr */ datum_free_icr, + /* clear */ datum_clear, + /* fsf_size */ NULL, } }; @@ -2448,8 +2446,7 @@ datum_deserialize(const void * image_ptr, *------------------------------------------------------------------------- */ static herr_t -datum_image_len(void *thing, size_t *image_len, - hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr) +datum_image_len(const void *thing, size_t *image_len) { int idx; struct datum * entry_ptr; -- cgit v0.12