diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-11-12 07:14:58 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-11-12 07:14:58 (GMT) |
commit | 80ac4343cdf0640b114b846db87c091c6e7c66a6 (patch) | |
tree | 1ec049d16537d15f2f7afa3eb2f6608673eb3083 | |
parent | 70938cbf28ca91a17d8d975d5b5ebcd44648e1c9 (diff) | |
download | hdf5-80ac4343cdf0640b114b846db87c091c6e7c66a6.zip hdf5-80ac4343cdf0640b114b846db87c091c6e7c66a6.tar.gz hdf5-80ac4343cdf0640b114b846db87c091c6e7c66a6.tar.bz2 |
Align w/minor cleanups in revise_chunks branch.
-rw-r--r-- | src/H5ACprivate.h | 1 | ||||
-rw-r--r-- | src/H5C.c | 13 | ||||
-rw-r--r-- | src/H5Cpkg.h | 75 | ||||
-rw-r--r-- | src/H5Cprivate.h | 35 | ||||
-rw-r--r-- | test/cache_common.c | 32 | ||||
-rw-r--r-- | test/earray.c | 2 |
6 files changed, 92 insertions, 66 deletions
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index abd1af0..cfb9028 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -170,7 +170,6 @@ typedef H5C_notify_action_t H5AC_notify_action_t; #define H5AC__CLASS_COMPRESSED_FLAG H5C__CLASS_COMPRESSED_FLAG /* The following flags should only appear in test code */ -#define H5AC__CLASS_NO_IO_FLAG H5C__CLASS_NO_IO_FLAG #define H5AC__CLASS_SKIP_READS H5C__CLASS_SKIP_READS #define H5AC__CLASS_SKIP_WRITES H5C__CLASS_SKIP_WRITES @@ -82,9 +82,6 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#ifdef H5_HAVE_PARALLEL -#include "H5ACprivate.h" /* Metadata cache */ -#endif /* H5_HAVE_PARALLEL */ #include "H5Cpkg.h" /* Cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ @@ -1209,6 +1206,7 @@ H5C_insert_entry(H5F_t * f, HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); HDassert( type ); + HDassert( type->image_len ); HDassert( H5F_addr_defined(addr) ); HDassert( thing ); @@ -5843,13 +5841,11 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ /* Finally, write the image to disk. * - * Note that if either the H5C__CLASS_NO_IO_FLAG or the - * the H5AC__CLASS_SKIP_WRITES flag is set in the + * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the * in the entry's type, we silently skip the write. This * flag should only be used in test code. */ - if ( ( ((entry_ptr->type->flags) & H5C__CLASS_NO_IO_FLAG) == 0 ) && - ( ((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0 ) ) + if(((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0) { /* If compression is not enabled, the size of the entry on * disk is entry_prt->size. However if entry_ptr->compressed @@ -6199,9 +6195,6 @@ H5C_load_entry(H5F_t * f, HDassert(f->shared->cache); HDassert(type); - /* verify absence of prohibited or unsupported type flag combinations */ - HDassert(!(type->flags & H5C__CLASS_NO_IO_FLAG)); - /* for now, we do not combine the speculative load and compressed flags */ HDassert(!((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && (type->flags & H5C__CLASS_COMPRESSED_FLAG))); diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 10180b9..78ae930 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -3154,7 +3154,32 @@ if ( ( (entry_ptr) == NULL ) || \ /* Package Private Typedefs */ /****************************/ -/* Info about each set of tagged entries */ +/**************************************************************************** + * + * structure H5C_tag_info_t + * + * Structure about each set of tagged entries for an object in the file. + * + * Each H5C_tag_info_t struct corresponds to a particular object in the file. + * + * Each H5C_cache_entry struct in the linked list of entries for this tag + * also contains a pointer back to the H5C_tag_info_t struct for the + * overall object. + * + * + * The fields of this structure are discussed individually below: + * + * tag: Address (i.e. "tag") of the object header for all the entries + * corresponding to parts of that object. + * + * head: Head of doubly-linked list of all entries belonging to the tag. + * + * entry_cnt: Number of entries on linked list of entries for this tag. + * + * corked: Boolean flag indicating whether entries for this object can be + * evicted. + * + ****************************************************************************/ typedef struct H5C_tag_info_t { haddr_t tag; /* Tag (address) of the entries (must be first, for skiplist) */ H5C_cache_entry_t *head; /* Head of the list of entries for this tag */ @@ -3162,6 +3187,7 @@ typedef struct H5C_tag_info_t { hbool_t corked; /* Whether this object is corked */ } H5C_tag_info_t; + /**************************************************************************** * * structure H5C_t @@ -3429,14 +3455,6 @@ typedef struct H5C_tag_info_t { * (This functions similarly to a "dead man's switch") * * - * With the addition of cache entry tagging, it is possible that - * an entry may be inserted into the cache without a tag during testing - * and the tag's validity shouldn't be checked. - * - * The following field is maintained to facilitate this. - * - * ignore_tags: Boolean flag to disable tag validation during entry insertion. - * * When we flush the cache, we need to write entries out in increasing * address order. An instance of a skip list is used to store dirty entries in * sorted order. Whether it is cheaper to sort the dirty entries as needed, @@ -3513,11 +3531,22 @@ typedef struct H5C_tag_info_t { * to the slist since the last time this field was set to * zero. Note that this value can be negative. * - * cork_list_ptr: A skip list to track object addresses that are corked. - * When an entry is inserted or protected in the cache, - * the entry's associated object address (tag field) is - * checked against this skip list. If found, the entry - * is corked. + * Cache entries belonging to a particular object are "tagged" with that + * object's base object header address. + * + * The following fields are maintained to facilitate this. + * + * tag_list: A skip list to track entries that belong to an object. + * Each H5C_tag_info_t struct on the tag list corresponds to + * a particular object in the file. Tagged entries can be + * flushed or evicted as a group, or corked to prevent entries + * from being evicted from the cache. + * + * "Global" entries, like the superblock and the file's + * freelist, as well as shared entries like global + * heaps and shared object header messages, are not tagged. + * + * ignore_tags: Boolean flag to disable tag validation during entry insertion. * * When a cache entry is protected, it must be removed from the LRU * list(s) as it cannot be either flushed or evicted until it is unprotected. @@ -3742,13 +3771,6 @@ typedef struct H5C_tag_info_t { * all the ways this can happen, we simply set this flag when * we receive a new configuration. * - * cache_full: Boolean flag used to keep track of whether the cache is - * full, so we can refrain from increasing the size of a - * cache which hasn't used up the space allotted to it. - * - * The field is initialized to FALSE, and then set to TRUE - * whenever we attempt to make space in the cache. - * * resize_enabled: This is another convenience flag which is set whenever * a new set of values for resize_ctl are provided. Very * simply, @@ -3756,6 +3778,13 @@ typedef struct H5C_tag_info_t { * resize_enabled = size_increase_possible || * size_decrease_possible; * + * cache_full: Boolean flag used to keep track of whether the cache is + * full, so we can refrain from increasing the size of a + * cache which hasn't used up the space allotted to it. + * + * The field is initialized to FALSE, and then set to TRUE + * whenever we attempt to make space in the cache. + * * size_decreased: Boolean flag set to TRUE whenever the maximum cache * size is decreased. The flag triggers a call to * H5C_make_space_in_cache() on the next call to H5C_protect(). @@ -4128,9 +4157,6 @@ struct H5C_t { H5C_cache_entry_t * last_entry_removed_ptr; H5C_cache_entry_t * entry_watched_for_removal; - /* Field to disable tag validation */ - hbool_t ignore_tags; - /* Fields for maintaining list of in-order entries, for flushing */ hbool_t slist_changed; int32_t slist_len; @@ -4146,6 +4172,7 @@ struct H5C_t { /* Fields for maintaining list of tagged entries */ H5SL_t * tag_list; + hbool_t ignore_tags; /* Fields for tracking protected entries */ int32_t pl_len; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 1cd1e38..9db33d2 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -70,9 +70,8 @@ #define H5C__CLASS_SPECULATIVE_LOAD_FLAG ((unsigned)0x1) #define H5C__CLASS_COMPRESSED_FLAG ((unsigned)0x2) /* The following flags may only appear in test code */ -#define H5C__CLASS_NO_IO_FLAG ((unsigned)0x4) -#define H5C__CLASS_SKIP_READS ((unsigned)0x8) -#define H5C__CLASS_SKIP_WRITES ((unsigned)0x10) +#define H5C__CLASS_SKIP_READS ((unsigned)0x4) +#define H5C__CLASS_SKIP_WRITES ((unsigned)0x8) /* Flags for pre-serialize callback */ #define H5C__SERIALIZE_NO_FLAGS_SET ((unsigned)0) @@ -365,12 +364,6 @@ typedef struct H5C_t H5C_t; * * The following flags may only appear in test code. * - * H5C__CLASS_NO_IO_FLAG: This flag is intended only for use in test - * code. When it is set, any attempt to load an entry of - * the type with this flag set will trigger an assertion - * failure, and any flush of an entry with this flag set - * will not result in any write to file. - * * H5C__CLASS_SKIP_READS: This flags is intended only for use in test * code. When it is set, reads on load will be skipped, * and an uninitialize buffer will be passed to the @@ -1474,7 +1467,7 @@ typedef int H5C_ring_t; * * Fields supporting the hash table: * - * Fields in the cache are indexed by a more or less conventional hash table. + * Entries in the cache are indexed by a more or less conventional hash table. * If there are multiple entries in any hash bin, they are stored in a doubly * linked list. * @@ -1561,6 +1554,28 @@ typedef int H5C_ring_t; * In either case, when there is no previous item, it should * be NULL. * + * + * Fields supporting tagged entries: + * + * Entries in the cache that belong to a single object in the file are + * joined into a doubly-linked list, and are "tagged" with the object header + * address for that object's base header "chunk" (which is used as the + * canonical address for the object). Global and shared entries are + * not tagged. Tagged entries have a pointer to the tag info for the object, + * which is shared state for all the entries for that object. + * + * tl_next: Pointer to the next entry in the tag list for an object. + * NULL for the tail entry in the list, as well as untagged + * entries. + * + * tl_prev: Pointer to the previous entry in the tag list for an object. + * NULL for the head entry in the list, as well as untagged + * entries. + * + * tag_info: Pointer to the common tag state for all entries belonging to + * an object. NULL for untagged entries. + * + * * Cache entry stats collection fields: * * These fields should only be compiled in when both H5C_COLLECT_CACHE_STATS diff --git a/test/cache_common.c b/test/cache_common.c index 4436d7f..945442a 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3535,21 +3535,17 @@ flush_cache(H5F_t * file_ptr, void cork_entry_type(H5F_t *file_ptr, int32_t type) { - H5C_t *cache_ptr; - haddr_t baddrs; - herr_t result; - if(pass) { + H5C_t *cache_ptr; + haddr_t baddrs; + cache_ptr = file_ptr->shared->cache; - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert(cache_ptr); + HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES)); baddrs = base_addrs[type]; - - result = H5C_cork(cache_ptr, baddrs, H5C__SET_CORK, NULL); - if(result < 0) { - + if(H5C_cork(cache_ptr, baddrs, H5C__SET_CORK, NULL) < 0) { pass = FALSE; failure_mssg = "error in H5C_cork()."; } /* end if */ @@ -3575,21 +3571,17 @@ cork_entry_type(H5F_t *file_ptr, int32_t type) void uncork_entry_type(H5F_t *file_ptr, int32_t type) { - H5C_t *cache_ptr; - haddr_t baddrs; - herr_t result; - if(pass) { + H5C_t *cache_ptr; + haddr_t baddrs; + cache_ptr = file_ptr->shared->cache; - HDassert( cache_ptr ); - HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert(cache_ptr); + HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES)); baddrs = base_addrs[type]; - - result = H5C_cork(cache_ptr, baddrs, H5C__UNCORK, NULL); - if(result < 0) { - + if(H5C_cork(cache_ptr, baddrs, H5C__UNCORK, NULL) < 0) { pass = FALSE; failure_mssg = "error in H5C_cork()."; } /* end if */ diff --git a/test/earray.c b/test/earray.c index c3c7d3d..44d16c5 100644 --- a/test/earray.c +++ b/test/earray.c @@ -200,7 +200,7 @@ const H5AC_class_t H5AC_EARRAY_TEST[1] = {{ /* id */ H5AC_TEST_ID, /* name */ "earray test", /* mem_type */ H5FD_MEM_DEFAULT, - /* flags */ H5AC__CLASS_NO_IO_FLAG, + /* flags */ H5AC__CLASS_SKIP_READS | H5AC__CLASS_SKIP_WRITES, /* get_load_size */ (H5AC_get_load_size_func_t)earray_cache_test_get_load_size, /* deserialize */ (H5AC_deserialize_func_t)earray_cache_test_deserialize, /* image_len */ (H5AC_image_len_func_t)earray_cache_test_image_len, |