summaryrefslogtreecommitdiffstats
path: root/test/cache_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/cache_common.c')
-rw-r--r--test/cache_common.c2328
1 files changed, 1493 insertions, 835 deletions
diff --git a/test/cache_common.c b/test/cache_common.c
index 60ab827..f3da908 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -23,6 +23,7 @@
#include "H5Cprivate.h"
#include "H5Iprivate.h"
#include "H5MFprivate.h"
+#include "H5MMprivate.h"
#include "cache_common.h"
@@ -57,8 +58,6 @@ haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the
hbool_t write_permitted = TRUE;
hbool_t pass = TRUE; /* set to false on error */
-hbool_t skip_long_tests = TRUE;
-hbool_t run_full_test = TRUE;
hbool_t try_core_file_driver = FALSE;
hbool_t core_file_driver_failed = FALSE;
const char *failure_mssg = NULL;
@@ -77,79 +76,156 @@ static test_entry_t notify_entries[NUM_NOTIFY_ENTRIES], orig_notify_entries[NUM_
hbool_t orig_entry_arrays_init = FALSE;
-static herr_t pico_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t nano_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t micro_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t tiny_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t small_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t medium_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t large_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t huge_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t monster_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t variable_clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t notify_clear(H5F_t * f, void * thing, hbool_t dest);
-
-static herr_t pico_dest(H5F_t * f, void * thing);
-static herr_t nano_dest(H5F_t * f, void * thing);
-static herr_t micro_dest(H5F_t * f, void * thing);
-static herr_t tiny_dest(H5F_t * f, void * thing);
-static herr_t small_dest(H5F_t * f, void * thing);
-static herr_t medium_dest(H5F_t * f, void * thing);
-static herr_t large_dest(H5F_t * f, void * thing);
-static herr_t huge_dest(H5F_t * f, void * thing);
-static herr_t monster_dest(H5F_t * f, void * thing);
-static herr_t variable_dest(H5F_t * f, void * thing);
-static herr_t notify_dest(H5F_t * f, void * thing);
-
-static herr_t pico_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t nano_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t micro_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t tiny_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t small_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t medium_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t large_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t huge_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t monster_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t variable_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-static herr_t notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned * flags_ptr);
-
-static void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static void * notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-
-static herr_t pico_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t nano_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t micro_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t tiny_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t small_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t medium_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t large_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t huge_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t monster_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t variable_size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t notify_size(H5F_t * f, void * thing, size_t * size_ptr);
+static herr_t pico_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t nano_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t micro_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t tiny_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t small_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t medium_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t large_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t huge_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t monster_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t variable_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+static herr_t notify_get_load_size(const void *udata_ptr, size_t *image_len_ptr);
+
+static void *pico_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *nano_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *micro_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *tiny_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *small_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *medium_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *large_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *huge_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *monster_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+static void *variable_deserialize(const void *image_ptr, size_t len, void *udata_ptr,
+ hbool_t *dirty_ptr);
+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_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);
+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);
+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);
+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);
+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);
+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);
+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);
+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);
+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);
+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);
+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);
+
+static herr_t pico_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t nano_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t micro_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t tiny_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t small_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t medium_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t large_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t huge_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t monster_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t variable_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+static herr_t notify_serialize(const H5F_t *f, void *image_ptr,
+ size_t len, void *thing);
+
+static herr_t pico_free_icr(void *thing);
+static herr_t nano_free_icr(void *thing);
+static herr_t micro_free_icr(void *thing);
+static herr_t tiny_free_icr(void *thing);
+static herr_t small_free_icr(void *thing);
+static herr_t medium_free_icr(void *thing);
+static herr_t large_free_icr(void *thing);
+static herr_t huge_free_icr(void *thing);
+static herr_t monster_free_icr(void *thing);
+static herr_t variable_free_icr(void *thing);
+static herr_t notify_free_icr(void *thing);
+
static herr_t notify_notify(H5C_notify_action_t action, void *thing);
+/* Generic callback routines */
+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 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);
+static herr_t serialize(const H5F_t *f, void *image_ptr, size_t len,
+ void *thing);
+static herr_t notify(H5C_notify_action_t action, void *thing, int32_t
+ entry_type);
+static herr_t free_icr(test_entry_t *entry, int32_t entry_type);
+
+/* Local routines */
+static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
+ struct flush_op *op_ptr, unsigned *flags_ptr);
+
+
test_entry_t *entries[NUMBER_OF_ENTRY_TYPES] =
{
pico_entries,
@@ -262,118 +338,171 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] =
{
{
PICO_ENTRY_TYPE,
- (H5C_load_func_t)pico_load,
- (H5C_flush_func_t)pico_flush,
- (H5C_dest_func_t)pico_dest,
- (H5C_clear_func_t)pico_clear,
+ "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_size_func_t)pico_size
+ (H5C_free_icr_func_t)pico_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
NANO_ENTRY_TYPE,
- (H5C_load_func_t)nano_load,
- (H5C_flush_func_t)nano_flush,
- (H5C_dest_func_t)nano_dest,
- (H5C_clear_func_t)nano_clear,
+ "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_size_func_t)nano_size
+ (H5C_free_icr_func_t)nano_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
MICRO_ENTRY_TYPE,
- (H5C_load_func_t)micro_load,
- (H5C_flush_func_t)micro_flush,
- (H5C_dest_func_t)micro_dest,
- (H5C_clear_func_t)micro_clear,
+ "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_size_func_t)micro_size
+ (H5C_free_icr_func_t)micro_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
TINY_ENTRY_TYPE,
- (H5C_load_func_t)tiny_load,
- (H5C_flush_func_t)tiny_flush,
- (H5C_dest_func_t)tiny_dest,
- (H5C_clear_func_t)tiny_clear,
+ "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_size_func_t)tiny_size
+ (H5C_free_icr_func_t)tiny_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
SMALL_ENTRY_TYPE,
- (H5C_load_func_t)small_load,
- (H5C_flush_func_t)small_flush,
- (H5C_dest_func_t)small_dest,
- (H5C_clear_func_t)small_clear,
+ "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_size_func_t)small_size
+ (H5C_free_icr_func_t)small_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
MEDIUM_ENTRY_TYPE,
- (H5C_load_func_t)medium_load,
- (H5C_flush_func_t)medium_flush,
- (H5C_dest_func_t)medium_dest,
- (H5C_clear_func_t)medium_clear,
+ "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_size_func_t)medium_size
+ (H5C_free_icr_func_t)medium_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
LARGE_ENTRY_TYPE,
- (H5C_load_func_t)large_load,
- (H5C_flush_func_t)large_flush,
- (H5C_dest_func_t)large_dest,
- (H5C_clear_func_t)large_clear,
+ "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_size_func_t)large_size
+ (H5C_free_icr_func_t)large_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
HUGE_ENTRY_TYPE,
- (H5C_load_func_t)huge_load,
- (H5C_flush_func_t)huge_flush,
- (H5C_dest_func_t)huge_dest,
- (H5C_clear_func_t)huge_clear,
+ "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_size_func_t)huge_size
+ (H5C_free_icr_func_t)huge_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
MONSTER_ENTRY_TYPE,
- (H5C_load_func_t)monster_load,
- (H5C_flush_func_t)monster_flush,
- (H5C_dest_func_t)monster_dest,
- (H5C_clear_func_t)monster_clear,
+ "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_size_func_t)monster_size
+ (H5C_free_icr_func_t)monster_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
VARIABLE_ENTRY_TYPE,
- (H5C_load_func_t)variable_load,
- (H5C_flush_func_t)variable_flush,
- (H5C_dest_func_t)variable_dest,
- (H5C_clear_func_t)variable_clear,
+ "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_size_func_t)variable_size
+ (H5C_free_icr_func_t)variable_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
},
{
NOTIFY_ENTRY_TYPE,
- (H5C_load_func_t)notify_load,
- (H5C_flush_func_t)notify_flush,
- (H5C_dest_func_t)notify_dest,
- (H5C_clear_func_t)notify_clear,
+ "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_size_func_t)notify_size
+ (H5C_free_icr_func_t)notify_free_icr,
+ (H5C_clear_func_t)NULL,
+ (H5C_get_fsf_size_t)NULL,
}
};
-static herr_t clear(H5F_t * f, void * thing, hbool_t dest);
-static herr_t destroy(H5F_t * f, void * thing);
-static herr_t flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
- haddr_t addr, void *thing, unsigned H5_ATTR_UNUSED * flags_ptr);
-static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata);
-static herr_t size(H5F_t * f, void * thing, size_t * size_ptr);
-static herr_t notify(H5C_notify_action_t action, void *thing);
-static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr,
- struct flush_op *op_ptr, unsigned *flags_ptr);
-
-
-
-
/* address translation functions: */
@@ -478,7 +607,7 @@ addr_to_type_and_index(haddr_t addr,
static herr_t
check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_ptr)
{
- HDassert(write_permitted_ptr);
+ HDassert( write_permitted_ptr );
*write_permitted_ptr = write_permitted;
@@ -487,721 +616,834 @@ check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_pt
/*-------------------------------------------------------------------------
- * Function: clear & friends
+ * Function: get_load_size & friends
*
- * Purpose: clear the entry. The helper functions verify that the
- * correct version of clear is being called, and then call
- * clear proper.
+ * Purpose: Query the image size for loading an entry. The helper
+ * functions funnel into get_load_size proper.
*
* Return: SUCCEED
*
- * Programmer: John Mainzer
- * 6/10/04
+ * Programmer: Quincey Koziol
+ * 5/18/10
*
*-------------------------------------------------------------------------
*/
-
-herr_t
-clear(H5F_t * f,
- void * thing,
- hbool_t dest)
+static herr_t
+get_load_size(const void *udata, size_t *image_length, int32_t entry_type)
{
- test_entry_t * entry_ptr;
- test_entry_t * base_addr;
-
- HDassert( thing );
-
- entry_ptr = (test_entry_t *)thing;
- base_addr = entries[entry_ptr->type];
-
- HDassert( entry_ptr->index >= 0 );
- HDassert( entry_ptr->index <= max_indices[entry_ptr->type] );
- HDassert( entry_ptr == &(base_addr[entry_ptr->index]) );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->header.addr == entry_ptr->addr );
- HDassert( entry_ptr->header.size == entry_ptr->size );
- HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) ||
- ( entry_ptr->size == entry_sizes[entry_ptr->type] ) );
-
- entry_ptr->header.is_dirty = FALSE;
- entry_ptr->is_dirty = FALSE;
+ test_entry_t *entry;
+ test_entry_t *base_addr;
+ haddr_t addr = *(const haddr_t *)udata;
+ int32_t type;
+ int32_t idx;
- entry_ptr->cleared = TRUE;
+ addr_to_type_and_index(addr, &type, &idx);
- if ( dest ) {
+ base_addr = entries[type];
+ entry = &(base_addr[idx]);
- destroy(f, thing);
+ HDassert(entry->type >= 0);
+ HDassert(entry->type == type);
+ HDassert(entry->type == entry_type);
+ HDassert(entry->type < NUMBER_OF_ENTRY_TYPES);
+ HDassert(entry->index == idx);
+ HDassert(entry->index >= 0);
+ HDassert(entry->index <= max_indices[type]);
+ HDassert(entry == entry->self);
+ HDassert(entry->addr == addr);
- }
+ *image_length = entry->size;
return(SUCCEED);
+} /* get_load_size() */
-} /* clear() */
-
-herr_t
-pico_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+pico_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, PICO_ENTRY_TYPE);
}
-herr_t
-nano_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+nano_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, NANO_ENTRY_TYPE);
}
-herr_t
-micro_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+micro_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, MICRO_ENTRY_TYPE);
}
-herr_t
-tiny_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+tiny_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, TINY_ENTRY_TYPE);
}
-herr_t
-small_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+small_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, SMALL_ENTRY_TYPE);
}
-herr_t
-medium_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+medium_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, MEDIUM_ENTRY_TYPE);
}
-herr_t
-large_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+large_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, LARGE_ENTRY_TYPE);
}
-herr_t
-huge_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+huge_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, HUGE_ENTRY_TYPE);
}
-herr_t
-monster_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+monster_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, MONSTER_ENTRY_TYPE);
}
-herr_t
-variable_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+variable_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == VARIABLE_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, VARIABLE_ENTRY_TYPE);
}
-herr_t
-notify_clear(H5F_t * f, void * thing, hbool_t dest)
+static herr_t
+notify_get_load_size(const void *udata, size_t *image_length)
{
- HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE );
- return(clear(f, thing, dest));
+ return get_load_size(udata, image_length, NOTIFY_ENTRY_TYPE);
}
-
/*-------------------------------------------------------------------------
- * Function: dest & friends
+ * Function: deserialize & friends
*
- * Purpose: Destroy the entry. The helper functions verify that the
- * correct version of dest is being called, and then call
- * dest proper.
+ * Purpose: deserialize the entry. The helper functions verify that the
+ * correct version of deserialize is being called, and then call
+ * deserialize proper.
*
- * Return: SUCCEED
+ * Return: void * (pointer to the in core representation of the entry)
*
* Programmer: John Mainzer
- * 6/10/04
+ * 9/20/07
*
*-------------------------------------------------------------------------
*/
-
-herr_t
-destroy(H5F_t H5_ATTR_UNUSED * f,
- void * thing)
+static void *
+deserialize(const void *image, size_t len, void *udata, hbool_t *dirty,
+ int32_t entry_type)
{
- int i;
- test_entry_t * entry_ptr;
- test_entry_t * base_addr;
- test_entry_t * pinned_entry_ptr;
- test_entry_t * pinned_base_addr;
-
- HDassert( thing );
-
- entry_ptr = (test_entry_t *)thing;
- base_addr = entries[entry_ptr->type];
-
- HDassert( entry_ptr->index >= 0 );
- HDassert( entry_ptr->index <= max_indices[entry_ptr->type] );
- HDassert( entry_ptr == &(base_addr[entry_ptr->index]) );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->cache_ptr != NULL );
- HDassert( entry_ptr->cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( ( entry_ptr->header.destroy_in_progress ) ||
- ( entry_ptr->header.addr == entry_ptr->addr ) );
- HDassert( entry_ptr->header.size == entry_ptr->size );
- HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) ||
- ( entry_ptr->size == entry_sizes[entry_ptr->type] ) );
-
- HDassert( !(entry_ptr->is_dirty) );
- HDassert( !(entry_ptr->header.is_dirty) );
-
- if ( entry_ptr->num_pins > 0 ) {
-
- for ( i = 0; i < entry_ptr->num_pins; i++ )
- {
- pinned_base_addr = entries[entry_ptr->pin_type[i]];
- pinned_entry_ptr = &(pinned_base_addr[entry_ptr->pin_idx[i]]);
-
- HDassert( 0 <= pinned_entry_ptr->type );
- HDassert( pinned_entry_ptr->type < NUMBER_OF_ENTRY_TYPES );
- HDassert( pinned_entry_ptr->type == entry_ptr->pin_type[i] );
- HDassert( pinned_entry_ptr->index >= 0 );
- HDassert( pinned_entry_ptr->index <=
- max_indices[pinned_entry_ptr->type] );
- HDassert( pinned_entry_ptr->index == entry_ptr->pin_idx[i] );
- HDassert( pinned_entry_ptr == pinned_entry_ptr->self );
- HDassert( pinned_entry_ptr->header.is_pinned );
- HDassert( pinned_entry_ptr->is_pinned );
- HDassert( pinned_entry_ptr->pinning_ref_count > 0 );
-
- pinned_entry_ptr->pinning_ref_count--;
-
- if ( pinned_entry_ptr->pinning_ref_count <= 0 ) {
-
- unpin_entry(pinned_entry_ptr->type,
- pinned_entry_ptr->index);
- }
+ test_entry_t *entry;
+ test_entry_t *base_addr;
+ haddr_t addr = *(haddr_t *)udata;
+ int32_t type;
+ int32_t idx;
- entry_ptr->pin_type[i] = -1;
- entry_ptr->pin_idx[i] = -1;
- }
- entry_ptr->num_pins = 0;
- }
+ addr_to_type_and_index(addr, &type, &idx);
- entry_ptr->destroyed = TRUE;
- entry_ptr->cache_ptr = NULL;
+ base_addr = entries[type];
+ entry = &(base_addr[idx]);
+
+ HDassert(entry->type >= 0);
+ HDassert(entry->type == type);
+ HDassert(entry->type == entry_type);
+ HDassert(entry->type < NUMBER_OF_ENTRY_TYPES);
+ HDassert(entry->index == idx);
+ HDassert(entry->index >= 0);
+ HDassert(entry->index <= max_indices[type]);
+ HDassert(entry == entry->self);
+ HDassert(entry->addr == addr);
+ HDassert(entry->size == len);
+ HDassert((entry->type == VARIABLE_ENTRY_TYPE) || (entry->size == entry_sizes[type]));
+ HDassert(dirty != NULL);
+
+ /* for now *dirty will always be FALSE */
+ *dirty = FALSE;
+
+ /* verify that the image contains the expected data. */
+ HDassert(image != NULL);
+ if((entry->at_main_addr && entry->written_to_main_addr) ||
+ (!entry->at_main_addr && entry->written_to_alt_addr)) {
+ if((type == PICO_ENTRY_TYPE) || (type == VARIABLE_ENTRY_TYPE) ||
+ (type == NOTIFY_ENTRY_TYPE)) {
+ if((*((const char *)image)) != (char)(idx & 0xFF)) {
+ HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n",
+ type, idx, (long)addr);
+ HDfprintf(stdout, "*image = 0x%x\n",
+ (int)(*((const char *)image)));
+ HDfprintf(stdout, "expected *image = 0x%x\n",
+ (int)(idx & 0xFF));
+ } /* end if */
+ HDassert((*((const char *)image)) == (char)(idx & 0xFF));
+ } /* end if */
+ else {
+ if((*(((const char *)image) + 2)) != (char)(idx & 0xFF)) {
+ HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n",
+ type, idx, (long)addr);
+ HDfprintf(stdout, "*image = 0x%x 0x%x 0x%x\n",
+ (int)(*((const char *)image)),
+ (int)(*(((const char *)image) + 1)),
+ (int)(*(((const char *)image) + 2)));
+ HDfprintf(stdout, "expected *image = 0x%x\n",
+ (int)(idx & 0xFF),
+ (int)((idx & 0xFF00) >> 8));
+ } /* end if */
+ HDassert((*((const char *)image)) == (char)(type & 0xFF));
+ HDassert((*(((const char *)image) + 1)) == (char)((idx & 0xFF00) >> 8));
+ HDassert((*(((const char *)image) + 2)) == (char)(idx & 0xFF));
+ } /* end else */
+ } /* end if */
- return(SUCCEED);
+ entry->deserialized = TRUE;
+ entry->header.is_dirty = FALSE;
+ entry->is_dirty = FALSE;
+ (entry->deserializes)++;
-} /* dest() */
+ return((void *)entry);
+} /* deserialize() */
-herr_t
-pico_dest(H5F_t * f, void * thing)
+void *
+pico_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, PICO_ENTRY_TYPE);
}
-herr_t
-nano_dest(H5F_t * f, void * thing)
+void *
+nano_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, NANO_ENTRY_TYPE);
}
-herr_t
-micro_dest(H5F_t * f, void * thing)
+void *
+micro_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, MICRO_ENTRY_TYPE);
}
-herr_t
-tiny_dest(H5F_t * f, void * thing)
+void *
+tiny_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, TINY_ENTRY_TYPE);
}
-herr_t
-small_dest(H5F_t * f, void * thing)
+void *
+small_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, SMALL_ENTRY_TYPE);
}
-herr_t
-medium_dest(H5F_t * f, void * thing)
+void *
+medium_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, MEDIUM_ENTRY_TYPE);
}
-herr_t
-large_dest(H5F_t * f, void * thing)
+void *
+large_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, LARGE_ENTRY_TYPE);
}
-herr_t
-huge_dest(H5F_t * f, void * thing)
+void *
+huge_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, HUGE_ENTRY_TYPE);
}
-herr_t
-monster_dest(H5F_t * f, void * thing)
+void *
+monster_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, MONSTER_ENTRY_TYPE);
}
-herr_t
-variable_dest(H5F_t * f, void * thing)
+void *
+variable_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == VARIABLE_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, VARIABLE_ENTRY_TYPE);
}
-herr_t
-notify_dest(H5F_t * f, void * thing)
+void *
+notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
{
- HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE );
- return(destroy(f, thing));
+ return deserialize(image, len, udata, dirty, NOTIFY_ENTRY_TYPE);
}
/*-------------------------------------------------------------------------
- * Function: flush & friends
+ * Function: image_len & friends
*
- * Purpose: flush the entry and mark it as clean. The helper functions
- * verify that the correct version of flush is being called,
- * and then call flush proper.
+ * Purpose: Return the real (and possibly reduced) length of the image.
+ * The helper functions verify that the correct version of
+ * deserialize is being called, and then call deserialize
+ * proper.
*
* Return: SUCCEED
*
* Programmer: John Mainzer
- * 6/10/04
+ * 9/19/07
*
*-------------------------------------------------------------------------
*/
herr_t
-flush(H5F_t *f,
- hid_t H5_ATTR_UNUSED dxpl_id,
- hbool_t dest,
- haddr_t
-#ifdef NDEBUG
- H5_ATTR_UNUSED
-#endif /* NDEBUG */
- addr,
- void *thing,
- unsigned * flags_ptr)
+image_len(void *thing, size_t *image_length, int32_t entry_type)
{
- int i;
- test_entry_t * entry_ptr;
- test_entry_t * base_addr;
-
- HDassert( thing );
-
- entry_ptr = (test_entry_t *)thing;
- base_addr = entries[entry_ptr->type];
-
- HDassert( entry_ptr->index >= 0 );
- HDassert( entry_ptr->index <= max_indices[entry_ptr->type] );
- HDassert( entry_ptr == &(base_addr[entry_ptr->index]) );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->header.addr == entry_ptr->addr );
- HDassert( entry_ptr->addr == addr );
- HDassert( entry_ptr->header.size == entry_ptr->size );
- HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) ||
- ( entry_ptr->size == entry_sizes[entry_ptr->type] ) );
- HDassert( entry_ptr->header.is_dirty == entry_ptr->is_dirty );
- HDassert( entry_ptr->cache_ptr != NULL );
- HDassert( entry_ptr->cache_ptr->magic == H5C__H5C_T_MAGIC );
- HDassert( entry_ptr->num_flush_ops >= 0 );
- HDassert( entry_ptr->num_flush_ops < MAX_FLUSH_OPS );
-
- if ( entry_ptr->num_flush_ops > 0 ) {
-
- for ( i = 0; i < entry_ptr->num_flush_ops; i++ )
- {
- execute_flush_op(f,
- entry_ptr,
- &((entry_ptr->flush_ops)[i]),
- flags_ptr);
- }
- entry_ptr->num_flush_ops = 0;
- entry_ptr->flush_op_self_resize_in_progress = FALSE;
- }
+ test_entry_t *entry;
+ test_entry_t *base_addr;
+ int32_t type;
+ int32_t idx;
- entry_ptr->flushed = TRUE;
+ HDassert(thing);
+ HDassert(image_length);
- if ( ( ! write_permitted ) && ( entry_ptr->is_dirty ) ) {
+ entry = (test_entry_t *)thing;
- pass = FALSE;
- failure_mssg = "called flush when write_permitted is FALSE.";
- }
+ HDassert(entry->self == entry);
- if ( entry_ptr->is_dirty ) {
+ type = entry->type;
+ idx = entry->index;
- (entry_ptr->writes)++;
- entry_ptr->is_dirty = FALSE;
- entry_ptr->header.is_dirty = FALSE;
- }
+ HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert(type == entry_type);
+ HDassert((idx >= 0) && (idx <= max_indices[type]));
- if ( dest ) {
+ base_addr = entries[type];
+ HDassert(entry == &(base_addr[idx]));
- destroy(f, thing);
+ if(type != VARIABLE_ENTRY_TYPE)
+ HDassert(entry->size == entry_sizes[type]);
+ else {
+ HDassert(entry->size <= entry_sizes[type]);
+ HDassert(entry->size > 0);
+ } /* end else */
- }
+ *image_length = entry->size;
return(SUCCEED);
-} /* flush() */
+} /* image_len() */
herr_t
-pico_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+pico_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, PICO_ENTRY_TYPE);
}
herr_t
-nano_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+nano_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, NANO_ENTRY_TYPE);
}
herr_t
-micro_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+micro_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, MICRO_ENTRY_TYPE);
}
herr_t
-tiny_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+tiny_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, TINY_ENTRY_TYPE);
}
herr_t
-small_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+small_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, SMALL_ENTRY_TYPE);
}
herr_t
-medium_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+medium_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, MEDIUM_ENTRY_TYPE);
}
herr_t
-large_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+large_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, LARGE_ENTRY_TYPE);
}
herr_t
-huge_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+huge_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, HUGE_ENTRY_TYPE);
}
herr_t
-monster_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+monster_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, MONSTER_ENTRY_TYPE);
}
herr_t
-variable_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+variable_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == VARIABLE_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, VARIABLE_ENTRY_TYPE);
}
herr_t
-notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr,
- void *thing, unsigned * flags_ptr)
+notify_image_len(void *thing, size_t *image_length,
+ hbool_t H5_ATTR_UNUSED *compressed_ptr, size_t H5_ATTR_UNUSED *compressed_len_ptr)
{
- HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE );
- return(flush(f, dxpl_id, dest, addr, thing, flags_ptr));
+ return image_len(thing, image_length, NOTIFY_ENTRY_TYPE);
}
/*-------------------------------------------------------------------------
- * Function: load & friends
+ * Function: pre_serialize & friends
*
- * Purpose: "load" the requested entry and mark it as clean. The
- * helper functions verify that the correct version of load
- * is being called, and then call load proper.
+ * Purpose: Pre_serialize the supplied entry. For now this consistes of
+ * executing any flush operations and loading the appropriate
+ * values into *new_addr_ptr, *new_len_ptr, and *flags_ptr.
*
- * Return: SUCCEED
+ * The helper functions verify that the correct version of
+ * serialize is being called, and then call serialize
+ * proper.
+ *
+ * Return: SUCCEED if successful, FAIL otherwise.
*
* Programmer: John Mainzer
- * 6/10/04
+ * 8/07/14
*
*-------------------------------------------------------------------------
*/
-
-void *
-load(H5F_t H5_ATTR_UNUSED *f,
- hid_t H5_ATTR_UNUSED dxpl_id,
- haddr_t addr,
- void H5_ATTR_UNUSED *udata)
+herr_t
+pre_serialize(const H5F_t *f,
+ hid_t H5_ATTR_UNUSED dxpl_id,
+ void *thing,
+ haddr_t addr,
+ size_t len,
+ haddr_t *new_addr_ptr,
+ size_t *new_len_ptr,
+ unsigned *flags_ptr)
{
+ test_entry_t *entry;
+ test_entry_t *base_addr;
int32_t type;
int32_t idx;
- test_entry_t * entry_ptr;
- test_entry_t * base_addr;
+ int32_t i;
- addr_to_type_and_index(addr, &type, &idx);
+ HDassert(f);
+ HDassert(thing);
+ HDassert(flags_ptr);
+
+ *flags_ptr = H5C__SERIALIZE_NO_FLAGS_SET;
+
+ HDassert(new_addr_ptr);
+ HDassert(new_len_ptr);
+
+ entry = (test_entry_t *)thing;
+
+ HDassert(entry->self == entry);
+ HDassert(entry->addr == addr);
+ HDassert(entry->size == len);
+
+ /* shouldn't serialize the entry unless it is dirty */
+ HDassert(entry->is_dirty);
+
+ type = entry->type;
+ idx = entry->index;
+
+ HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((idx >= 0) && (idx <= max_indices[type]));
base_addr = entries[type];
- entry_ptr = &(base_addr[idx]);
- HDassert( entry_ptr->type == type );
- HDassert( entry_ptr->type >= 0 );
- HDassert( entry_ptr->type < NUMBER_OF_ENTRY_TYPES );
- HDassert( entry_ptr->index == idx );
- HDassert( entry_ptr->index >= 0 );
- HDassert( entry_ptr->index <= max_indices[type] );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->addr == addr );
-#if 1 /* JRM */
- if ( ! ( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) ||
- ( entry_ptr->size == entry_sizes[type] ) ) ) {
-
- HDfprintf(stdout, "entry type/index/size = %d/%d/%ld\n",
- (int)(entry_ptr->type),
- (int)(entry_ptr->index),
- (long)(entry_ptr->size));
- }
-#endif /* JRM */
- HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) ||
- ( entry_ptr->size == entry_sizes[type] ) );
+ HDassert(entry == &(base_addr[idx]));
+ HDassert(entry->num_flush_ops >= 0);
+ HDassert(entry->num_flush_ops < MAX_FLUSH_OPS);
- entry_ptr->loaded = TRUE;
+ if(entry->num_flush_ops > 0) {
+ for(i = 0; i < entry->num_flush_ops; i++ ) {
+ HDassert(entry->file_ptr);
- entry_ptr->header.is_dirty = FALSE;
- entry_ptr->is_dirty = FALSE;
+ execute_flush_op(entry->file_ptr, entry,
+ &((entry->flush_ops)[i]), flags_ptr);
+ } /* end for */
+ entry->num_flush_ops = 0;
+ entry->flush_op_self_resize_in_progress = FALSE;
- (entry_ptr->reads)++;
+ /* This looks wrong, but it isn't -- *flags_ptr will be modified
+ * by execute_flush_op() only if the target is this entry --
+ * and the flags set will accumulate over the set of calls in
+ * the for loop.
+ */
+ if(pass && (((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0)) {
- return(entry_ptr);
+ /* set *new_len_ptr to the new length. */
-} /* load() */
+ HDassert(entry->type == VARIABLE_ENTRY_TYPE);
+ HDassert(entry->size > 0);
+ HDassert(entry->size <= VARIABLE_ENTRY_SIZE);
-void *
-pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+ *new_len_ptr = entry->size;
+ } /* end if */
+
+ if(((*flags_ptr) & H5C__SERIALIZE_MOVED_FLAG) != 0) {
+
+ HDassert(((*flags_ptr) | H5C__SERIALIZE_RESIZED_FLAG) != 0);
+
+ /* place the new address in *new_addr */
+ *new_addr_ptr = entry->addr;
+ } /* end if */
+ } /* end if */
+
+ return(SUCCEED);
+
+} /* pre_serialize() */
+
+herr_t
+pico_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-nano_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+nano_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-micro_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+micro_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-tiny_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+tiny_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-small_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+small_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-medium_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+medium_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-large_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+large_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-huge_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+huge_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+monster_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+variable_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
-void *
-notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *udata)
+herr_t
+notify_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_ptr,
+ size_t *new_len_ptr,
+ size_t H5_ATTR_UNUSED *new_compressed_len_ptr,
+ unsigned *flags_ptr)
{
- return(load(f, dxpl_id, addr, udata));
+ return pre_serialize(f, dxpl_id, thing, addr, len,
+ new_addr_ptr, new_len_ptr, flags_ptr);
}
+
/*-------------------------------------------------------------------------
- * Function: size & friends
+ * Function: serialize & friends
*
- * Purpose: Get the size of the specified entry. The helper functions
- * verify that the correct version of size is being called,
- * and then call size proper.
+ * Purpose: Serialize the supplied entry. For now this consistes of
+ * loading the type and index of the entry into the first
+ * three bytes of the image (if it is long enough -- if not
+ * just load the low order byte of the index into the first
+ * byte of the image).
*
- * Return: SUCCEED
+ * The helper functions verify that the correct version of
+ * serialize is being called, and then call serialize
+ * proper.
+ *
+ * Return: SUCCEED if successful, FAIL otherwise.
*
* Programmer: John Mainzer
- * 6/10/04
+ * 9/19/07
*
*-------------------------------------------------------------------------
*/
herr_t
-size(H5F_t H5_ATTR_UNUSED * f,
- void * thing,
- size_t * size_ptr)
+serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- test_entry_t * entry_ptr;
- test_entry_t * base_addr;
+ test_entry_t *entry;
+ test_entry_t *base_addr;
+ int32_t type;
+ int32_t idx;
- HDassert( size_ptr );
- HDassert( thing );
+ HDassert(image_ptr);
+ HDassert(thing);
- entry_ptr = (test_entry_t *)thing;
- base_addr = entries[entry_ptr->type];
+ entry = (test_entry_t *)thing;
- HDassert( entry_ptr->index >= 0 );
- HDassert( entry_ptr->index <= max_indices[entry_ptr->type] );
- HDassert( entry_ptr == &(base_addr[entry_ptr->index]) );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->header.addr == entry_ptr->addr );
- HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) || \
- ( entry_ptr->size == entry_sizes[entry_ptr->type] ) );
+ HDassert(entry->self == entry);
+ HDassert(entry->size == len);
- *size_ptr = entry_ptr->size;
+ /* shouldn't serialize the entry unless it is dirty */
+ HDassert(entry->is_dirty);
+
+ type = entry->type;
+ idx = entry->index;
+
+ HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((idx >= 0) && (idx <= max_indices[type]));
+
+ base_addr = entries[type];
+
+ HDassert(entry == &(base_addr[idx]));
+ HDassert(entry->num_flush_ops >= 0);
+ HDassert(entry->num_flush_ops < MAX_FLUSH_OPS);
+
+ /* null out the image to avoid spurious failures */
+ HDmemset(image_ptr, 0, len);
+
+ if((type == PICO_ENTRY_TYPE) || (type == VARIABLE_ENTRY_TYPE) ||
+ (type == NOTIFY_ENTRY_TYPE )) {
+ HDassert(entry->size >= PICO_ENTRY_SIZE);
+ *((char *)image_ptr) = (char)((entry->index) & 0xFF);
+ } /* end if */
+ else {
+ HDassert(entry->size >= NANO_ENTRY_SIZE);
+ *((char *)image_ptr) = (char)((entry->type) & 0xFF);
+ *(((char *)image_ptr) + 1) = (char)(((entry->index) & 0xFF00) >> 8);
+ *(((char *)image_ptr) + 2) = (char)((entry->index) & 0xFF);
+ } /* end else */
+
+ /* We no longer do the actual write through an callback -- this is
+ * as close to that callback as we will get. Hence mark the entry
+ * clean here. If all goes well, it will be flushed shortly.
+ */
+ entry->is_dirty = FALSE;
+
+ /* since the entry is about to be written to disk, we can mark it
+ * as initialized.
+ */
+ if(entry->at_main_addr)
+ entry->written_to_main_addr = TRUE;
+ else
+ entry->written_to_alt_addr = TRUE;
+
+ /* do book keeping */
+ (entry->serializes)++;
+ entry->serialized = TRUE;
return(SUCCEED);
-} /* size() */
+} /* serialize() */
herr_t
-pico_size(H5F_t * f, void * thing, size_t * size_ptr)
+pico_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == PICO_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-nano_size(H5F_t * f, void * thing, size_t * size_ptr)
+nano_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == NANO_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-micro_size(H5F_t * f, void * thing, size_t * size_ptr)
+micro_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == MICRO_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-tiny_size(H5F_t * f, void * thing, size_t * size_ptr)
+tiny_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == TINY_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-small_size(H5F_t * f, void * thing, size_t * size_ptr)
+small_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == SMALL_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-medium_size(H5F_t * f, void * thing, size_t * size_ptr)
+medium_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
+ void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == MEDIUM_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-large_size(H5F_t * f, void * thing, size_t * size_ptr)
+large_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == LARGE_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-huge_size(H5F_t * f, void * thing, size_t * size_ptr)
+huge_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == HUGE_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-monster_size(H5F_t * f, void * thing, size_t * size_ptr)
+monster_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
+ void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == MONSTER_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-variable_size(H5F_t * f, void * thing, size_t * size_ptr)
+variable_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
+ void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == VARIABLE_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
herr_t
-notify_size(H5F_t * f, void * thing, size_t * size_ptr)
+notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
+ void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE );
- return(size(f, thing, size_ptr));
+ return serialize(f, image_ptr, len, thing);
}
@@ -1220,32 +1462,39 @@ notify_size(H5F_t * f, void * thing, size_t * size_ptr)
*-------------------------------------------------------------------------
*/
static herr_t
-notify(H5C_notify_action_t action, void *thing)
+notify(H5C_notify_action_t action, void *thing, int32_t entry_type)
{
- test_entry_t * entry_ptr;
+ test_entry_t *entry;
test_entry_t *base_addr;
HDassert(thing);
- entry_ptr = (test_entry_t *)thing;
- base_addr = entries[entry_ptr->type];
+ entry = (test_entry_t *)thing;
+ base_addr = entries[entry->type];
- HDassert( entry_ptr->index >= 0 );
- HDassert( entry_ptr->index <= max_indices[entry_ptr->type] );
- HDassert( entry_ptr == &(base_addr[entry_ptr->index]) );
- HDassert( entry_ptr == entry_ptr->self );
- HDassert( entry_ptr->header.addr == entry_ptr->addr );
- HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) || \
- ( entry_ptr->size == entry_sizes[entry_ptr->type] ) );
+ HDassert(entry->index >= 0);
+ HDassert(entry->index <= max_indices[entry->type]);
+ HDassert((entry->type >= 0) && (entry->type < NUMBER_OF_ENTRY_TYPES));
+ HDassert(entry->type == entry_type);
+ HDassert(entry == &(base_addr[entry->index]));
+ HDassert(entry == entry->self);
+ HDassert(entry->header.addr == entry->addr);
+ HDassert((entry->type == VARIABLE_ENTRY_TYPE) || \
+ (entry->size == entry_sizes[entry->type]));
/* Increment count for appropriate action */
switch(action) {
- case H5C_NOTIFY_ACTION_AFTER_INSERT: /* Entry has been added to the cache */
- entry_ptr->notify_after_insert_count++;
+ case H5C_NOTIFY_ACTION_AFTER_INSERT: /* Entry has been added */
+ case H5C_NOTIFY_ACTION_AFTER_LOAD: /* to the cache. */
+ entry->notify_after_insert_count++;
break;
+ case H5C_NOTIFY_ACTION_AFTER_FLUSH:
+ /* do nothing */
+ break;
+
case H5C_NOTIFY_ACTION_BEFORE_EVICT: /* Entry is about to be evicted from cache */
- entry_ptr->notify_before_evict_count++;
+ entry->notify_before_evict_count++;
break;
default:
@@ -1258,11 +1507,160 @@ notify(H5C_notify_action_t action, void *thing)
herr_t
notify_notify(H5C_notify_action_t action, void *thing)
{
- HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE );
- return(notify(action, thing));
+ return(notify(action, thing, NOTIFY_ENTRY_TYPE));
}
+
+/*-------------------------------------------------------------------------
+ * Function: free_icr & friends
+ *
+ * Purpose: Nominally, this callback is supposed to free the
+ * in core representation of the entry.
+ *
+ * In the context of this test bed, we use it to do
+ * do all the processing we used to do on a destroy.
+ * In particular, we use it to release all the pins
+ * that this entry may have on other entries.
+ *
+ * The helper functions verify that the correct version of
+ * serialize is being called, and then call free_icr
+ * proper.
+ *
+ * Return: SUCCEED
+ *
+ * Programmer: John Mainzer
+ * 9/19/07
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+free_icr(test_entry_t *entry, int32_t entry_type)
+{
+ test_entry_t *base_addr;
+ HDassert(entry);
+
+ base_addr = entries[entry->type];
+
+ HDassert(entry->type == entry_type);
+ HDassert(entry->index >= 0);
+ HDassert(entry->index <= max_indices[entry->type]);
+ HDassert(entry == &(base_addr[entry->index]));
+ HDassert(entry == entry->self);
+ HDassert(entry->cache_ptr != NULL);
+ HDassert(entry->cache_ptr->magic == H5C__H5C_T_MAGIC);
+ HDassert((entry->header.destroy_in_progress) ||
+ (entry->header.addr == entry->addr));
+ HDassert(entry->header.size == entry->size);
+ HDassert((entry->type == VARIABLE_ENTRY_TYPE) ||
+ (entry->size == entry_sizes[entry->type]));
+
+ if(entry->num_pins > 0) {
+ int i;
+
+ for(i = 0; i < entry->num_pins; i++) {
+ test_entry_t *pinned_entry;
+ test_entry_t *pinned_base_addr;
+
+ pinned_base_addr = entries[entry->pin_type[i]];
+ pinned_entry = &(pinned_base_addr[entry->pin_idx[i]]);
+
+ HDassert(0 <= pinned_entry->type);
+ HDassert(pinned_entry->type < NUMBER_OF_ENTRY_TYPES);
+ HDassert(pinned_entry->type == entry->pin_type[i]);
+ HDassert(pinned_entry->index >= 0);
+ HDassert(pinned_entry->index <= max_indices[pinned_entry->type]);
+ HDassert(pinned_entry->index == entry->pin_idx[i]);
+ HDassert(pinned_entry == pinned_entry->self);
+ HDassert(pinned_entry->header.is_pinned);
+ HDassert(pinned_entry->is_pinned);
+ HDassert(pinned_entry->pinning_ref_count > 0);
+
+ pinned_entry->pinning_ref_count--;
+
+ if(pinned_entry->pinning_ref_count <= 0) {
+ HDassert(pinned_entry->file_ptr);
+
+ unpin_entry(pinned_entry->type, pinned_entry->index);
+ } /* end if */
+
+ entry->pin_type[i] = -1;
+ entry->pin_idx[i] = -1;
+ } /* end if */
+ entry->num_pins = 0;
+ } /* end if */
+
+ entry->destroyed = TRUE;
+ entry->cache_ptr = NULL;
+
+ return(SUCCEED);
+} /* free_icr() */
+
+herr_t
+pico_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, PICO_ENTRY_TYPE);
+}
+
+herr_t
+nano_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, NANO_ENTRY_TYPE);
+}
+
+herr_t
+micro_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, MICRO_ENTRY_TYPE);
+}
+
+herr_t
+tiny_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, TINY_ENTRY_TYPE);
+}
+
+herr_t
+small_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, SMALL_ENTRY_TYPE);
+}
+
+herr_t
+medium_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, MEDIUM_ENTRY_TYPE);
+}
+
+herr_t
+large_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, LARGE_ENTRY_TYPE);
+}
+
+herr_t
+huge_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, HUGE_ENTRY_TYPE);
+}
+
+herr_t
+monster_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, MONSTER_ENTRY_TYPE);
+}
+
+herr_t
+variable_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, VARIABLE_ENTRY_TYPE);
+}
+
+herr_t
+notify_free_icr(void *thing)
+{
+ return free_icr((test_entry_t *)thing, NOTIFY_ENTRY_TYPE);
+}
/**************************************************************************/
@@ -1565,17 +1963,10 @@ execute_flush_op(H5F_t * file_ptr,
HDassert( op_ptr->size <= VARIABLE_ENTRY_SIZE );
entry_ptr->size = op_ptr->size;
- (*flags_ptr) |= H5C_CALLBACK__SIZE_CHANGED_FLAG;
- entry_ptr->flush_op_self_resize_in_progress = TRUE;
- /* if the entry is in the process of being destroyed,
- * set the header size to match the entry size so as
- * to avoid a spurious failure in the destroy callback.
- */
- if ( entry_ptr->header.destroy_in_progress ) {
+ (*flags_ptr) |= H5C__SERIALIZE_RESIZED_FLAG;
- entry_ptr->header.size = entry_ptr->size;
- }
+ entry_ptr->flush_op_self_resize_in_progress = TRUE;
} else {
@@ -1587,7 +1978,29 @@ execute_flush_op(H5F_t * file_ptr,
break;
case FLUSH_OP__MOVE:
- move_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
+ if((entry_ptr->type == op_ptr->type) &&
+ (entry_ptr->index == op_ptr->idx)) {
+
+ /* the flush operation is acting on the entry to
+ * which it is attached. Handle this here:
+ */
+
+ HDassert(((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0);
+ (*flags_ptr) |= H5C__SERIALIZE_MOVED_FLAG;
+
+ if(op_ptr->flag) {
+ HDassert(entry_ptr->addr == entry_ptr->alt_addr);
+ entry_ptr->addr = entry_ptr->main_addr;
+ entry_ptr->at_main_addr = TRUE;
+ } /* end if */
+ else {
+ HDassert(entry_ptr->addr == entry_ptr->main_addr);
+ entry_ptr->addr = entry_ptr->alt_addr;
+ entry_ptr->at_main_addr = FALSE;
+ } /* end else */
+ } /* end if */
+ else
+ move_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag);
break;
case FLUSH_OP__ORDER:
@@ -1596,6 +2009,33 @@ execute_flush_op(H5F_t * file_ptr,
(*op_ptr->order_ptr)++;
break;
+ case FLUSH_OP__EXPUNGE:
+ /* the expunge flush op exists to allow us to simulate the
+ * case in which an entry is removed from the cashe as the
+ * the result of the flush of a second entry. At present,
+ * this can only happen via the take ownership flag, but
+ * we will make this test feature more general to as to make
+ * tests easier to write.
+ *
+ * When this operation is executed, the target entry is
+ * removed from the cache without being flushed if dirty
+ * via the expunge_entry() test function (which calls
+ * H5C_expunge_entry()). Note that this flush operation
+ * must always be executed on an entry other than the
+ * entry being flushed.
+ */
+ HDassert( ( entry_ptr->type != op_ptr->type ) ||
+ ( entry_ptr->index != op_ptr->idx ) );
+ expunge_entry(file_ptr, op_ptr->type, op_ptr->idx);
+ break;
+
+ case FLUSH_OP__DEST_FLUSH_DEP:
+ HDassert( ( entry_ptr->type != op_ptr->type ) ||
+ ( entry_ptr->index != op_ptr->idx ) );
+ destroy_flush_dependency(op_ptr->type, op_ptr->idx,
+ entry_ptr->type, entry_ptr->index);
+ break;
+
default:
pass = FALSE;
failure_mssg = "Undefined flush op code.";
@@ -1721,6 +2161,8 @@ reset_entries(void)
base_addr[j].self = &(base_addr[j]);
base_addr[j].cache_ptr = NULL;
+ base_addr[j].written_to_main_addr = FALSE;
+ base_addr[j].written_to_alt_addr = FALSE;
base_addr[j].addr = addr;
base_addr[j].at_main_addr = TRUE;
base_addr[j].main_addr = addr;
@@ -1728,8 +2170,8 @@ reset_entries(void)
base_addr[j].size = entry_size;
base_addr[j].type = i;
base_addr[j].index = j;
- base_addr[j].reads = 0;
- base_addr[j].writes = 0;
+ base_addr[j].serializes = 0;
+ base_addr[j].deserializes = 0;
base_addr[j].is_dirty = FALSE;
base_addr[j].is_protected = FALSE;
base_addr[j].is_read_only = FALSE;
@@ -1755,10 +2197,10 @@ reset_entries(void)
}
base_addr[j].flush_op_self_resize_in_progress = FALSE;
- base_addr[j].loaded = FALSE;
- base_addr[j].cleared = FALSE;
- base_addr[j].flushed = FALSE;
+ base_addr[j].deserialized = FALSE;
+ base_addr[j].serialized = FALSE;
base_addr[j].destroyed = FALSE;
+ base_addr[j].expunged = FALSE;
base_addr[j].flush_dep_par_type = -1;
base_addr[j].flush_dep_par_idx = -1;
@@ -1987,15 +2429,24 @@ verify_entry_status(H5C_t * cache_ptr,
unsigned u; /* Local index variable */
if ( ( ! expected[i].in_cache ) &&
- ( ( expected[i].is_dirty ) ||
- ( expected[i].is_protected ) ||
- ( expected[i].is_pinned ) ) ) {
+ ( ( expected[i].is_protected ) || ( expected[i].is_pinned ) ) ) {
pass = FALSE;
sprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i);
failure_mssg = msg;
}
+ if ( ( ! expected[i].in_cache ) &&
+ ( expected[i].is_dirty ) &&
+ ( ! entry_ptr->expunged ) ) {
+
+ pass = FALSE;
+ sprintf(msg,
+ "%d: expected[%d] specs non-expunged, dirty, non-resident.\n",
+ tag, i);
+ failure_mssg = msg;
+ }
+
if ( pass ) {
in_cache = entry_in_cache(cache_ptr, expected[i].entry_type,
@@ -2161,23 +2612,20 @@ verify_entry_status(H5C_t * cache_ptr,
if ( pass ) {
- if ( ( entry_ptr->loaded != expected[i].loaded ) ||
- ( entry_ptr->cleared != expected[i].cleared ) ||
- ( entry_ptr->flushed != expected[i].flushed ) ||
+ if ( ( entry_ptr->deserialized != expected[i].deserialized ) ||
+ ( entry_ptr->serialized != expected[i].serialized ) ||
( entry_ptr->destroyed != expected[i].destroyed ) ) {
pass = FALSE;
sprintf(msg,
- "%d entry (%d,%d) loaded = %d(%d), clrd = %d(%d), flshd = %d(%d), dest = %d(%d)\n",
+ "%d entry (%d,%d) deserialized = %d(%d), serialized = %d(%d), dest = %d(%d)\n",
tag,
(int)expected[i].entry_type,
(int)expected[i].entry_index,
- (int)(entry_ptr->loaded),
- (int)(expected[i].loaded),
- (int)(entry_ptr->cleared),
- (int)(expected[i].cleared),
- (int)(entry_ptr->flushed),
- (int)(expected[i].flushed),
+ (int)(entry_ptr->deserialized),
+ (int)(expected[i].deserialized),
+ (int)(entry_ptr->serialized),
+ (int)(expected[i].serialized),
(int)(entry_ptr->destroyed),
(int)(expected[i].destroyed));
failure_mssg = msg;
@@ -2372,20 +2820,37 @@ verify_unprotected(void)
} /* verify_unprotected() */
-/*-------------------------------------------------------------------------
- * Function: setup_cache()
+/*****************************************************************************
*
- * Purpose: Allocate a cache of the desired size and configure it for
- * use in the test bed. Return a pointer to the new cache
- * structure.
+ * Function: setup_cache()
*
- * Return: Pointer to new cache, or NULL on failure.
+ * Purpose: Open an HDF file. This will allocate an instance and
+ * initialize an associated instance of H5C_t. However,
+ * we want to test an instance of H5C_t, so allocate and
+ * initialize one with the file ID returned by the call to
+ * H5Fcreate(). Return a pointer to this instance of H5C_t.
*
- * Programmer: John Mainzer
- * 6/11/04
+ * Observe that we open a HDF file because the cache now
+ * writes directly to file, and we need the file I/O facilities
+ * associated with the file.
*
- *-------------------------------------------------------------------------
- */
+ * To avoid tripping on error check code, must allocate enough
+ * space in the file to hold all the test entries and their
+ * alternates. This is a little sticky, as the addresses of
+ * all the test entries are determined at compile time.
+ *
+ * Deal with this by choosing BASE_ADDR large enough that
+ * the base address of the allocate space will be less than
+ * or equal to BASE_ADDR, and then requesting an extra BASE_ADDR
+ * bytes, so we don't have to wory about exceeding the allocation.
+ *
+ * Return: Success: Ptr to H5C_t
+ *
+ * Failure: NULL
+ *
+ * Programmer: JRM -- 9/13/07
+ *
+ *****************************************************************************/
H5F_t *
setup_cache(size_t max_cache_size,
@@ -2650,8 +3115,11 @@ setup_cache(size_t max_cache_size,
/*-------------------------------------------------------------------------
* Function: takedown_cache()
*
- * Purpose: Flush the specified cache and disable it. If requested,
- * dump stats first. If pass is FALSE, do nothing.
+ * Purpose: Flush the specified cache and destroy it. If requested,
+ * dump stats first. Then close and delete the associate
+ * file.
+ *
+ * If pass is FALSE, do nothing.
*
* Return: void
*
@@ -2678,7 +3146,7 @@ takedown_cache(H5F_t * file_ptr,
flush_cache(file_ptr, TRUE, FALSE, FALSE);
- H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT);
+ H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT);
if ( saved_cache != NULL ) {
@@ -2753,6 +3221,11 @@ takedown_cache(H5F_t * file_ptr,
* Programmer: John Mainzer
* 7/6/06
*
+ * Changes: Added code to set entry_ptr->expunged to TRUE if
+ * H5C_expunge_entry() returns without error.
+ *
+ * JRM -- 8/21/14
+ *
*-------------------------------------------------------------------------
*/
@@ -2787,7 +3260,7 @@ expunge_entry(H5F_t * file_ptr,
HDassert( ! ( entry_ptr->header.is_pinned ) );
HDassert( ! ( entry_ptr->is_pinned ) );
- result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
+ result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT,
&(types[type]), entry_ptr->addr, H5C__NO_FLAGS_SET);
if ( result < 0 ) {
@@ -2795,6 +3268,9 @@ expunge_entry(H5F_t * file_ptr,
pass = FALSE;
failure_mssg = "error in H5C_expunge_entry().";
+ } else {
+
+ entry_ptr->expunged = TRUE;
}
}
@@ -2837,11 +3313,11 @@ flush_cache(H5F_t * file_ptr,
if(destroy_entries)
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C__FLUSH_INVALIDATE_FLAG);
else
result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT,
- H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET);
+ H5C__NO_FLAGS_SET);
if(dump_stats)
H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
@@ -2921,8 +3397,8 @@ insert_entry(H5F_t * file_ptr,
entry_ptr->is_dirty = TRUE;
- result = H5C_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags);
+ result = H5C_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags);
if ( ( result < 0 ) ||
( entry_ptr->header.is_protected ) ||
@@ -2951,6 +3427,7 @@ insert_entry(H5F_t * file_ptr,
}
HDassert(entry_ptr->cache_ptr == NULL);
+ entry_ptr->file_ptr = file_ptr;
entry_ptr->cache_ptr = cache_ptr;
if(insert_pinned)
@@ -3174,8 +3651,8 @@ protect_entry(H5F_t * file_ptr,
HDassert( entry_ptr == entry_ptr->self );
HDassert( !(entry_ptr->is_protected) );
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[type]), entry_ptr->addr, NULL, H5C__NO_FLAGS_SET);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
@@ -3214,6 +3691,7 @@ protect_entry(H5F_t * file_ptr,
( entry_ptr->cache_ptr == cache_ptr ) );
entry_ptr->cache_ptr = cache_ptr;
+ entry_ptr->file_ptr = file_ptr;
entry_ptr->is_protected = TRUE;
}
@@ -3270,8 +3748,8 @@ protect_entry_ro(H5F_t * file_ptr,
( ( entry_ptr->is_read_only ) &&
( entry_ptr->ro_ref_count > 0 ) ) );
- cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[type]), entry_ptr->addr, NULL, H5C__READ_ONLY_FLAG);
+ cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG);
if ( ( cache_entry_ptr != (void *)entry_ptr ) ||
( !(entry_ptr->header.is_protected) ) ||
@@ -3290,6 +3768,7 @@ protect_entry_ro(H5F_t * file_ptr,
( entry_ptr->cache_ptr == cache_ptr ) );
entry_ptr->cache_ptr = cache_ptr;
+ entry_ptr->file_ptr = file_ptr;
entry_ptr->is_protected = TRUE;
entry_ptr->is_read_only = TRUE;
entry_ptr->ro_ref_count++;
@@ -3479,8 +3958,8 @@ unprotect_entry(H5F_t * file_ptr,
if(flags & H5C__DIRTIED_FLAG)
entry_ptr->is_dirty = TRUE;
- result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, H5P_DATASET_XFER_DEFAULT,
- &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags);
+ result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT,
+ entry_ptr->addr, (void *)entry_ptr, flags);
if ( ( result < 0 ) ||
( ( entry_ptr->header.is_protected ) &&
@@ -3563,6 +4042,7 @@ unprotect_entry(H5F_t * file_ptr,
void
row_major_scan_forward(H5F_t * file_ptr,
+ int32_t max_index,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -3579,6 +4059,7 @@ row_major_scan_forward(H5F_t * file_ptr,
H5C_t * cache_ptr = NULL;
int32_t type = 0;
int32_t idx;
+ int32_t local_max_index;
if ( verbose )
HDfprintf(stdout, "%s(): entering.\n", FUNC);
@@ -3601,208 +4082,283 @@ row_major_scan_forward(H5F_t * file_ptr,
{
idx = -lag;
- while ( ( pass ) && ( idx <= (max_indices[type] + lag) ) )
+ local_max_index = MIN(max_index, max_indices[type]);
+
+ while ( ( pass ) && ( idx <= (local_max_index + lag) ) )
{
+ int32_t tmp_idx;
+
if ( verbose ) {
HDfprintf(stdout, "%d:%d: ", type, idx);
}
- if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) &&
- ( (idx + lag) <= max_indices[type] ) &&
- ( ((idx + lag) % 2) == 0 ) &&
- ( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) {
+ tmp_idx = idx + lag;
+ if ( ( pass ) && ( do_inserts ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( (tmp_idx % 2) == 0 ) &&
+ ( ! entry_in_cache(cache_ptr, type, tmp_idx) ) ) {
if ( verbose )
- HDfprintf(stdout, "(i, %d, %d) ", type, (idx + lag));
+ HDfprintf(stdout, "1(i, %d, %d) ", type, tmp_idx);
- insert_entry(file_ptr, type, (idx + lag), H5C__NO_FLAGS_SET);
- }
+ insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+ }
- if ( ( pass ) && ( (idx + lag - 1) >= 0 ) &&
- ( (idx + lag - 1) <= max_indices[type] ) &&
- ( ( (idx + lag - 1) % 3 ) == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 3 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1));
+ HDfprintf(stdout, "2(p, %d, %d) ", type, tmp_idx);
+
+ protect_entry(file_ptr, type, tmp_idx);
- protect_entry(file_ptr, type, (idx + lag - 1));
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx + lag - 2) >= 0 ) &&
- ( (idx + lag - 2) <= max_indices[type] ) &&
- ( ( (idx + lag - 2) % 3 ) == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 3 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2));
+ HDfprintf(stdout, "3(u, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, idx+lag-2, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
+ /* (don't decrement tmp_idx) */
+ if ( ( pass ) && ( do_moves ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 3 ) == 0 ) ) {
- if ( ( pass ) && ( do_moves ) && ( (idx + lag - 2) >= 0 ) &&
- ( (idx + lag - 2) <= max_indices[type] ) &&
- ( ( (idx + lag - 2) % 3 ) == 0 ) ) {
+ if ( verbose )
+ HDfprintf(stdout, "4(r, %d, %d, %d) ",
+ type, tmp_idx, (int)move_to_main_addr);
- move_entry(cache_ptr, type, (idx + lag - 2),
- move_to_main_addr);
- }
+ move_entry(cache_ptr, type, tmp_idx, move_to_main_addr);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+ }
- if ( ( pass ) && ( (idx + lag - 3) >= 0 ) &&
- ( (idx + lag - 3) <= max_indices[type] ) &&
- ( ( (idx + lag - 3) % 5 ) == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 5 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 3));
+ HDfprintf(stdout, "5(p, %d, %d) ", type, tmp_idx);
+
+ protect_entry(file_ptr, type, tmp_idx);
- protect_entry(file_ptr, type, (idx + lag - 3));
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx + lag - 5) >= 0 ) &&
- ( (idx + lag - 5) <= max_indices[type] ) &&
- ( ( (idx + lag - 5) % 5 ) == 0 ) ) {
+ tmp_idx -= 2;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 5 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 5));
+ HDfprintf(stdout, "6(u, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, type, idx+lag-5, H5C__NO_FLAGS_SET);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
if ( do_mult_ro_protects )
{
- if ( ( pass ) && ( (idx + lag - 5) >= 0 ) &&
- ( (idx + lag - 5) < max_indices[type] ) &&
- ( (idx + lag - 5) % 9 == 0 ) ) {
+ /* (don't decrement tmp_idx) */
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 9 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p-ro, %d, %d) ", type,
- (idx + lag - 5));
+ HDfprintf(stdout, "7(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, (idx + lag - 5));
+ protect_entry_ro(file_ptr, type, tmp_idx);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx + lag - 6) >= 0 ) &&
- ( (idx + lag - 6) < max_indices[type] ) &&
- ( (idx + lag - 6) % 11 == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 11 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p-ro, %d, %d) ", type,
- (idx + lag - 6));
+ HDfprintf(stdout, "8(p-ro, %d, %d) ", type, tmp_idx);
+
+ protect_entry_ro(file_ptr, type, tmp_idx);
- protect_entry_ro(file_ptr, type, (idx + lag - 6));
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx + lag - 7) >= 0 ) &&
- ( (idx + lag - 7) < max_indices[type] ) &&
- ( (idx + lag - 7) % 13 == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 13 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p-ro, %d, %d) ", type,
- (idx + lag - 7));
+ HDfprintf(stdout, "9(p-ro, %d, %d) ", type, tmp_idx);
+
+ protect_entry_ro(file_ptr, type, tmp_idx);
- protect_entry_ro(file_ptr, type, (idx + lag - 7));
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx + lag - 7) >= 0 ) &&
- ( (idx + lag - 7) < max_indices[type] ) &&
- ( (idx + lag - 7) % 9 == 0 ) ) {
+ /* (don't decrement tmp_idx) */
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 9 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u-ro, %d, %d) ", type,
- (idx + lag - 7));
+ HDfprintf(stdout, "10(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, (idx + lag - 7), H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx + lag - 8) >= 0 ) &&
- ( (idx + lag - 8) < max_indices[type] ) &&
- ( (idx + lag - 8) % 11 == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 11 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u-ro, %d, %d) ", type,
- (idx + lag - 8));
+ HDfprintf(stdout, "11(u-ro, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, type, (idx + lag - 8), H5C__NO_FLAGS_SET);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx + lag - 9) >= 0 ) &&
- ( (idx + lag - 9) < max_indices[type] ) &&
- ( (idx + lag - 9) % 13 == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 13 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u-ro, %d, %d) ", type,
- (idx + lag - 9));
+ HDfprintf(stdout, "12(u-ro, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, type, (idx + lag - 9), H5C__NO_FLAGS_SET);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
} /* if ( do_mult_ro_protects ) */
- if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) {
+ if ( ( pass ) && ( idx >= 0 ) && ( idx <= local_max_index ) ) {
if ( verbose )
- HDfprintf(stdout, "(p, %d, %d) ", type, idx);
+ HDfprintf(stdout, "13(p, %d, %d) ", type, idx);
protect_entry(file_ptr, type, idx);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx - lag + 2) >= 0 ) &&
- ( (idx - lag + 2) <= max_indices[type] ) &&
- ( ( (idx - lag + 2) % 7 ) == 0 ) ) {
+ tmp_idx = idx - lag + 2;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 7 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2));
+ HDfprintf(stdout, "14(u, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, type, idx-lag+2, H5C__NO_FLAGS_SET);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
- if ( ( pass ) && ( (idx - lag + 1) >= 0 ) &&
- ( (idx - lag + 1) <= max_indices[type] ) &&
- ( ( (idx - lag + 1) % 7 ) == 0 ) ) {
+ tmp_idx--;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 7 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1));
+ HDfprintf(stdout, "15(p, %d, %d) ", type, tmp_idx);
- protect_entry(file_ptr, type, (idx - lag + 1));
+ protect_entry(file_ptr, type, tmp_idx);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
if ( do_destroys ) {
- if ( ( pass ) && ( (idx - lag) >= 0 ) &&
- ( ( idx - lag) <= max_indices[type] ) ) {
+ tmp_idx = idx - lag;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) ) {
- switch ( (idx - lag) %4 ) {
+ switch ( tmp_idx %4 ) {
case 0: /* we just did an insert */
- unprotect_entry(file_ptr, type, idx - lag, H5C__NO_FLAGS_SET);
+
+ if ( verbose )
+ HDfprintf(stdout, "16(u, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
break;
case 1:
- if ( (entries[type])[idx-lag].is_dirty ) {
+ if ( (entries[type])[tmp_idx].is_dirty ) {
+
+ if ( verbose )
+ HDfprintf(stdout, "17(u, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- unprotect_entry(file_ptr, type, idx - lag, H5C__NO_FLAGS_SET);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
} else {
- unprotect_entry(file_ptr, type, idx - lag,
+ if ( verbose )
+ HDfprintf(stdout, "18(u, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx,
(dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
break;
- case 2: /* we just did an insrt */
- unprotect_entry(file_ptr, type, idx - lag, H5C__DELETED_FLAG);
+ case 2: /* we just did an insert */
+
+ if ( verbose )
+ HDfprintf(stdout, "19(u-del, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
break;
case 3:
- if ( (entries[type])[idx-lag].is_dirty ) {
+ if ( (entries[type])[tmp_idx].is_dirty ) {
+
+ if ( verbose )
+ HDfprintf(stdout, "20(u-del, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
- unprotect_entry(file_ptr, type, idx - lag, H5C__DELETED_FLAG);
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
} else {
- unprotect_entry(file_ptr, type, idx - lag,
+ if ( verbose )
+ HDfprintf(stdout, "21(u-del, %d, %d) ", type, tmp_idx);
+
+ unprotect_entry(file_ptr, type, tmp_idx,
(dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)
| H5C__DELETED_FLAG);
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
break;
@@ -3814,14 +4370,17 @@ row_major_scan_forward(H5F_t * file_ptr,
} else {
- if ( ( pass ) && ( (idx - lag) >= 0 ) &&
- ( ( idx - lag) <= max_indices[type] ) ) {
+ tmp_idx = idx - lag;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) ) {
if ( verbose )
- HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag));
+ HDfprintf(stdout, "22(u, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, idx - lag,
+ unprotect_entry(file_ptr, type, tmp_idx,
(dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
+
+ HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
}
}
@@ -3965,6 +4524,7 @@ hl_row_major_scan_forward(H5F_t * file_ptr,
void
row_major_scan_backward(H5F_t * file_ptr,
+ int32_t max_index,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -3981,6 +4541,7 @@ row_major_scan_backward(H5F_t * file_ptr,
H5C_t * cache_ptr = NULL;
int32_t type = NUMBER_OF_ENTRY_TYPES - 1;
int32_t idx;
+ int32_t local_max_index;
if ( verbose )
HDfprintf(stdout, "%s(): Entering.\n", FUNC);
@@ -4000,142 +4561,152 @@ row_major_scan_backward(H5F_t * file_ptr,
while ( ( pass ) && ( type >= 0 ) )
{
- idx = max_indices[type] + lag;
+ local_max_index = MIN(max_index, max_indices[type]);
+
+ idx = local_max_index + lag;
while ( ( pass ) && ( idx >= -lag ) )
{
- if ( ( pass ) && ( do_inserts ) && ( (idx - lag) >= 0 ) &&
- ( (idx - lag) <= max_indices[type] ) &&
- ( ((idx - lag) % 2) == 1 ) &&
- ( ! entry_in_cache(cache_ptr, type, (idx - lag)) ) ) {
+ int32_t tmp_idx;
+
+ tmp_idx = idx - lag;
+ if ( ( pass ) && ( do_inserts ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( (tmp_idx % 2) == 1 ) &&
+ ( ! entry_in_cache(cache_ptr, type, tmp_idx) ) ) {
if ( verbose )
- HDfprintf(stdout, "(i, %d, %d) ", type, (idx - lag));
+ HDfprintf(stdout, "(i, %d, %d) ", type, tmp_idx);
- insert_entry(file_ptr, type, (idx - lag), H5C__NO_FLAGS_SET);
+ insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
-
- if ( ( pass ) && ( (idx - lag + 1) >= 0 ) &&
- ( (idx - lag + 1) <= max_indices[type] ) &&
- ( ( (idx - lag + 1) % 3 ) == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 3 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 1));
+ HDfprintf(stdout, "(p, %d, %d) ", type, tmp_idx);
- protect_entry(file_ptr, type, (idx - lag + 1));
+ protect_entry(file_ptr, type, tmp_idx);
}
- if ( ( pass ) && ( (idx - lag + 2) >= 0 ) &&
- ( (idx - lag + 2) <= max_indices[type] ) &&
- ( ( (idx - lag + 2) % 3 ) == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 3 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 2));
+ HDfprintf(stdout, "(u, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, idx-lag+2, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
+ /* (don't increment tmp_idx) */
+ if ( ( pass ) && ( do_moves ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 3 ) == 0 ) ) {
- if ( ( pass ) && ( do_moves ) && ( (idx - lag + 2) >= 0 ) &&
- ( (idx - lag + 2) <= max_indices[type] ) &&
- ( ( (idx - lag + 2) % 3 ) == 0 ) ) {
+ if ( verbose )
+ HDfprintf(stdout, "(r, %d, %d, %d) ",
+ type, tmp_idx, (int)move_to_main_addr);
- move_entry(cache_ptr, type, (idx - lag + 2),
- move_to_main_addr);
+ move_entry(cache_ptr, type, tmp_idx, move_to_main_addr);
}
-
- if ( ( pass ) && ( (idx - lag + 3) >= 0 ) &&
- ( (idx - lag + 3) <= max_indices[type] ) &&
- ( ( (idx - lag + 3) % 5 ) == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 5 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p, %d, %d) ", type, (idx - lag + 3));
+ HDfprintf(stdout, "(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, (idx - lag + 3));
}
- if ( ( pass ) && ( (idx - lag + 5) >= 0 ) &&
- ( (idx - lag + 5) <= max_indices[type] ) &&
- ( ( (idx - lag + 5) % 5 ) == 0 ) ) {
+ tmp_idx += 2;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 5 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag + 5));
+ HDfprintf(stdout, "(u, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, idx-lag+5, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
+ /* (don't increment tmp_idx) */
if ( do_mult_ro_protects )
{
- if ( ( pass ) && ( (idx - lag + 5) >= 0 ) &&
- ( (idx - lag + 5) < max_indices[type] ) &&
- ( (idx - lag + 5) % 9 == 0 ) ) {
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 9 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p-ro, %d, %d) ", type,
- (idx - lag + 5));
+ HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, (idx - lag + 5));
+ protect_entry_ro(file_ptr, type, tmp_idx);
}
- if ( ( pass ) && ( (idx - lag + 6) >= 0 ) &&
- ( (idx - lag + 6) < max_indices[type] ) &&
- ( (idx - lag + 6) % 11 == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 11 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p-ro, %d, %d) ", type,
- (idx - lag + 6));
+ HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, (idx - lag + 6));
+ protect_entry_ro(file_ptr, type, tmp_idx);
}
- if ( ( pass ) && ( (idx - lag + 7) >= 0 ) &&
- ( (idx - lag + 7) < max_indices[type] ) &&
- ( (idx - lag + 7) % 13 == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 13 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p-ro, %d, %d) ", type,
- (idx - lag + 7));
+ HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx);
- protect_entry_ro(file_ptr, type, (idx - lag + 7));
+ protect_entry_ro(file_ptr, type, tmp_idx);
}
- if ( ( pass ) && ( (idx - lag + 7) >= 0 ) &&
- ( (idx - lag + 7) < max_indices[type] ) &&
- ( (idx - lag + 7) % 9 == 0 ) ) {
+ /* (don't increment tmp_idx) */
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 9 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u-ro, %d, %d) ", type,
- (idx - lag + 7));
+ HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, (idx - lag + 7), H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
- if ( ( pass ) && ( (idx - lag + 8) >= 0 ) &&
- ( (idx - lag + 8) < max_indices[type] ) &&
- ( (idx - lag + 8) % 11 == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 11 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u-ro, %d, %d) ", type,
- (idx - lag + 8));
+ HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, (idx - lag + 8), H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
- if ( ( pass ) && ( (idx - lag + 9) >= 0 ) &&
- ( (idx - lag + 9) < max_indices[type] ) &&
- ( (idx - lag + 9) % 13 == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx < local_max_index ) &&
+ ( tmp_idx % 13 == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u-ro, %d, %d) ", type,
- (idx - lag + 9));
+ HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, (idx - lag + 9), H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
} /* if ( do_mult_ro_protects ) */
- if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) {
+ if ( ( pass ) && ( idx >= 0 ) && ( idx <= local_max_index ) ) {
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
@@ -4143,32 +4714,33 @@ row_major_scan_backward(H5F_t * file_ptr,
protect_entry(file_ptr, type, idx);
}
-
- if ( ( pass ) && ( (idx + lag - 2) >= 0 ) &&
- ( (idx + lag - 2) <= max_indices[type] ) &&
- ( ( (idx + lag - 2) % 7 ) == 0 ) ) {
+ tmp_idx = idx + lag - 2;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 7 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag - 2));
+ HDfprintf(stdout, "(u, %d, %d) ", type, tmp_idx);
- unprotect_entry(file_ptr, type, idx+lag-2, H5C__NO_FLAGS_SET);
+ unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
}
- if ( ( pass ) && ( (idx + lag - 1) >= 0 ) &&
- ( (idx + lag - 1) <= max_indices[type] ) &&
- ( ( (idx + lag - 1) % 7 ) == 0 ) ) {
+ tmp_idx++;
+ if ( ( pass ) && ( tmp_idx >= 0 ) &&
+ ( tmp_idx <= local_max_index ) &&
+ ( ( tmp_idx % 7 ) == 0 ) ) {
if ( verbose )
- HDfprintf(stdout, "(p, %d, %d) ", type, (idx + lag - 1));
+ HDfprintf(stdout, "(p, %d, %d) ", type, tmp_idx);
- protect_entry(file_ptr, type, (idx + lag - 1));
+ protect_entry(file_ptr, type, tmp_idx);
}
if ( do_destroys ) {
if ( ( pass ) && ( (idx + lag) >= 0 ) &&
- ( ( idx + lag) <= max_indices[type] ) ) {
+ ( ( idx + lag) <= local_max_index ) ) {
switch ( (idx + lag) % 4 ) {
@@ -4211,7 +4783,7 @@ row_major_scan_backward(H5F_t * file_ptr,
} else {
if ( ( pass ) && ( (idx + lag) >= 0 ) &&
- ( ( idx + lag) <= max_indices[type] ) ) {
+ ( ( idx + lag) <= local_max_index ) ) {
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag));
@@ -4361,6 +4933,7 @@ hl_row_major_scan_backward(H5F_t * file_ptr,
void
col_major_scan_forward(H5F_t * file_ptr,
+ int32_t max_index,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -4372,14 +4945,19 @@ col_major_scan_forward(H5F_t * file_ptr,
H5C_t * cache_ptr = NULL;
int32_t type = 0;
int32_t idx;
+ int32_t local_max_index[NUMBER_OF_ENTRY_TYPES];
if ( verbose )
HDfprintf(stdout, "%s: entering.\n", FUNC);
if ( pass ) {
+ int i;
cache_ptr = file_ptr->shared->cache;
+ for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
+ local_max_index[i] = MIN(max_index, max_indices[i]);
+
HDassert( lag > 5 );
if ( reset_stats ) {
@@ -4397,7 +4975,7 @@ col_major_scan_forward(H5F_t * file_ptr,
while ( ( pass ) && ( type < NUMBER_OF_ENTRY_TYPES ) )
{
if ( ( pass ) && ( do_inserts ) && ( (idx + lag) >= 0 ) &&
- ( (idx + lag) <= max_indices[type] ) &&
+ ( (idx + lag) <= local_max_index[type] ) &&
( ((idx + lag) % 3) == 0 ) &&
( ! entry_in_cache(cache_ptr, type, (idx + lag)) ) ) {
@@ -4407,7 +4985,9 @@ col_major_scan_forward(H5F_t * file_ptr,
insert_entry(file_ptr, type, (idx + lag), H5C__NO_FLAGS_SET);
}
- if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) {
+ if ( ( pass ) &&
+ ( idx >= 0 ) &&
+ ( idx <= local_max_index[type] ) ) {
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
@@ -4416,7 +4996,7 @@ col_major_scan_forward(H5F_t * file_ptr,
}
if ( ( pass ) && ( (idx - lag) >= 0 ) &&
- ( (idx - lag) <= max_indices[type] ) ) {
+ ( (idx - lag) <= local_max_index[type] ) ) {
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx - lag));
@@ -4529,7 +5109,7 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
}
if ( ( pass ) && ( i >= 0 ) &&
- ( i <= max_indices[type] ) ) {
+ ( i <= local_max_index ) ) {
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, i);
@@ -4577,6 +5157,7 @@ hl_col_major_scan_forward(H5F_t * file_ptr,
void
col_major_scan_backward(H5F_t * file_ptr,
+ int32_t max_index,
int32_t lag,
hbool_t verbose,
hbool_t reset_stats,
@@ -4589,16 +5170,21 @@ col_major_scan_backward(H5F_t * file_ptr,
int mile_stone = 1;
int32_t type;
int32_t idx;
+ int32_t local_max_index[NUMBER_OF_ENTRY_TYPES];
if ( verbose )
HDfprintf(stdout, "%s: entering.\n", FUNC);
if ( pass ) {
+ int i;
cache_ptr = file_ptr->shared->cache;
HDassert( cache_ptr != NULL );
+ for ( i = 0; i < NUMBER_OF_ENTRY_TYPES; i++ )
+ local_max_index[i] = MIN(max_index, max_indices[i]);
+
HDassert( lag > 5 );
if ( reset_stats ) {
@@ -4607,7 +5193,7 @@ col_major_scan_backward(H5F_t * file_ptr,
}
}
- idx = MAX_ENTRIES + lag;
+ idx = local_max_index[NUMBER_OF_ENTRY_TYPES - 1] + lag;
if ( verbose ) /* 1 */
HDfprintf(stdout, "%s: point %d.\n", FUNC, mile_stone++);
@@ -4620,7 +5206,7 @@ col_major_scan_backward(H5F_t * file_ptr,
while ( ( pass ) && ( type >= 0 ) )
{
if ( ( pass ) && ( do_inserts) && ( (idx - lag) >= 0 ) &&
- ( (idx - lag) <= max_indices[type] ) &&
+ ( (idx - lag) <= local_max_index[type] ) &&
( ((idx - lag) % 3) == 0 ) &&
( ! entry_in_cache(cache_ptr, type, (idx - lag)) ) ) {
@@ -4630,7 +5216,9 @@ col_major_scan_backward(H5F_t * file_ptr,
insert_entry(file_ptr, type, (idx - lag), H5C__NO_FLAGS_SET);
}
- if ( ( pass ) && ( idx >= 0 ) && ( idx <= max_indices[type] ) ) {
+ if ( ( pass ) &&
+ ( idx >= 0 ) &&
+ ( idx <= local_max_index[type] ) ) {
if ( verbose )
HDfprintf(stdout, "(p, %d, %d) ", type, idx);
@@ -4639,7 +5227,7 @@ col_major_scan_backward(H5F_t * file_ptr,
}
if ( ( pass ) && ( (idx + lag) >= 0 ) &&
- ( (idx + lag) <= max_indices[type] ) ) {
+ ( (idx + lag) <= local_max_index[type] ) ) {
if ( verbose )
HDfprintf(stdout, "(u, %d, %d) ", type, (idx + lag));
@@ -5445,3 +6033,73 @@ validate_mdc_config(hid_t file_id,
} /* validate_mdc_config() */
+
+#if 0 /* debugging functions -- normally commented out */
+/*-------------------------------------------------------------------------
+ * Function: dump_LRU
+ *
+ * Purpose: Display a summarize list of the contents of the LRU
+ * from head to tail.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 2/16/15
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+dump_LRU(H5F_t * file_ptr)
+{
+ const char * hdr_0 =
+ " Entry Entry Entry Entry Entry \n";
+ const char * hdr_1 =
+ " Num: Dirty: Size: Addr: Type: \n";
+ const char * hdr_2 =
+ "==============================================================\n";
+ int i = 0;
+ H5C_cache_entry_t * entry_ptr = NULL;
+ H5C_t *cache_ptr = file_ptr->shared->cache;
+
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ entry_ptr = cache_ptr->LRU_head_ptr;
+
+ HDfprintf(stdout,
+ "\n\nIndex len/size/clean size/dirty size = %d/%lld/%lld/%lld\n",
+ cache_ptr->index_len, (long long)(cache_ptr->index_size),
+ (long long)(cache_ptr->clean_index_size),
+ (long long)(cache_ptr->dirty_index_size));
+ HDfprintf(stdout, "\nLRU len/size = %d/%lld.\n\n",
+ cache_ptr->LRU_list_len, (long long)(cache_ptr->LRU_list_size));
+
+ if ( entry_ptr != NULL )
+ {
+ HDfprintf(stdout, "%s%s%s", hdr_0, hdr_1, hdr_2);
+ }
+
+ while ( entry_ptr != NULL )
+ {
+ HDfprintf(stdout,
+ " %3d %d %10lld 0x%010llx %s(%d)\n",
+ i,
+ (int)(entry_ptr->is_dirty),
+ (long long)(entry_ptr->size),
+ (long long)(entry_ptr->addr),
+ entry_ptr->type->name,
+ entry_ptr->type->id);
+ i++;
+ entry_ptr = entry_ptr->next;
+ }
+
+ if ( cache_ptr->LRU_list_len > 0 )
+ {
+ HDfprintf(stdout, "%s\n", hdr_2);
+ }
+
+ return;
+
+} /* dump_LRU() */
+
+#endif /* debugging functions -- normally commented out */