diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | src/H5AC.c | 23 | ||||
-rw-r--r-- | src/H5AC2.c | 27 | ||||
-rw-r--r-- | src/H5AC2private.h | 4 | ||||
-rw-r--r-- | src/H5AC2public.h | 60 | ||||
-rw-r--r-- | src/H5ACprivate.h | 4 | ||||
-rw-r--r-- | src/H5ACpublic.h | 61 | ||||
-rw-r--r-- | src/H5C.c | 993 | ||||
-rw-r--r-- | src/H5C2.c | 599 | ||||
-rw-r--r-- | src/H5C2journal.c | 519 | ||||
-rw-r--r-- | src/H5C2pkg.h | 14 | ||||
-rw-r--r-- | src/H5C2private.h | 104 | ||||
-rw-r--r-- | src/H5C2public.h | 7 | ||||
-rw-r--r-- | src/H5Cpkg.h | 22 | ||||
-rw-r--r-- | src/H5Cprivate.h | 130 | ||||
-rw-r--r-- | src/H5Cpublic.h | 6 | ||||
-rw-r--r-- | src/H5Fpkg.h | 5 | ||||
-rw-r--r-- | src/H5Fsuper.c | 105 | ||||
-rw-r--r-- | src/H5O.c | 15 | ||||
-rw-r--r-- | src/H5Opkg.h | 7 | ||||
-rw-r--r-- | src/H5Oprivate.h | 59 | ||||
-rwxr-xr-x | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/Makefile.in | 78 | ||||
-rw-r--r-- | test/cache.c | 1957 | ||||
-rw-r--r-- | test/cache2.c | 1958 | ||||
-rw-r--r-- | test/cache2_api.c | 785 | ||||
-rw-r--r-- | test/cache2_common.c | 107 | ||||
-rw-r--r-- | test/cache2_common.h | 5 | ||||
-rw-r--r-- | test/cache_api.c | 416 | ||||
-rw-r--r-- | test/cache_common.c | 107 | ||||
-rw-r--r-- | test/cache_common.h | 5 | ||||
-rw-r--r-- | test/tbogus.h5 | bin | 1944 -> 1944 bytes | |||
-rw-r--r-- | testpar/t_cache.c | 2 | ||||
-rw-r--r-- | testpar/t_cache2.c | 10 |
35 files changed, 7729 insertions, 470 deletions
@@ -452,6 +452,7 @@ ./src/H5Cprivate.h ./src/H5Cpublic.h ./src/H5C2.c +./src/H5C2journal.c ./src/H5C2pkg.h ./src/H5C2private.h ./src/H5C2public.h @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 14270 2007-11-20 04:43:58Z acheng . +# From configure.in Id: configure.in 14483 2008-02-01 06:51:09Z acheng . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for HDF5 1.8.0-beta4post1. # @@ -2546,6 +2546,10 @@ done: * switches for functions that are only tenuously related * to auto resize configuration. * + * JRM - 1/2/08 + * Added support for the new flash cache increment related + * fields. + * *------------------------------------------------------------------------- */ @@ -2625,6 +2629,9 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, config_ptr->max_increment = internal_config.max_increment; config_ptr->decr_mode = internal_config.decr_mode; config_ptr->upper_hr_threshold = internal_config.upper_hr_threshold; + config_ptr->flash_incr_mode = internal_config.flash_incr_mode; + config_ptr->flash_multiple = internal_config.flash_multiple; + config_ptr->flash_threshold = internal_config.flash_threshold; config_ptr->decrement = internal_config.decrement; config_ptr->apply_max_decrement = internal_config.apply_max_decrement; config_ptr->max_decrement = internal_config.max_decrement; @@ -2816,6 +2823,10 @@ done: * switches for functions that are only tenuously related * to auto resize configuration. * + * John Mainzer -- 1/3/07 + * Updated trace file code to record the new flash cache + * size increase related fields. + * *------------------------------------------------------------------------- */ @@ -2969,7 +2980,7 @@ done: ( trace_file_ptr != NULL ) ) { HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %d %d %f %f %d %d %d %d %f %d %d\n", + "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %d %d\n", "H5AC_set_cache_auto_resize_config", trace_config.version, (int)(trace_config.rpt_fcn_enabled), @@ -2986,6 +2997,9 @@ done: (int)(trace_config.incr_mode), trace_config.lower_hr_threshold, trace_config.increment, + (int)(trace_config.flash_incr_mode), + trace_config.flash_multiple, + trace_config.flash_threshold, (int)(trace_config.apply_max_increment), (int)(trace_config.max_increment), (int)(trace_config.decr_mode), @@ -3618,7 +3632,9 @@ done: * * Modifications: * - * None. + * Updated function for flash cache increment fields. + * + * JRM -- 1/2/08 * *------------------------------------------------------------------------- */ @@ -3661,6 +3677,9 @@ H5AC_ext_config_2_int_config(H5AC_cache_config_t * ext_conf_ptr, int_conf_ptr->increment = ext_conf_ptr->increment; int_conf_ptr->apply_max_increment = ext_conf_ptr->apply_max_increment; int_conf_ptr->max_increment = ext_conf_ptr->max_increment; + int_conf_ptr->flash_incr_mode = ext_conf_ptr->flash_incr_mode; + int_conf_ptr->flash_multiple = ext_conf_ptr->flash_multiple; + int_conf_ptr->flash_threshold = ext_conf_ptr->flash_threshold; int_conf_ptr->decr_mode = ext_conf_ptr->decr_mode; int_conf_ptr->upper_hr_threshold = ext_conf_ptr->upper_hr_threshold; diff --git a/src/H5AC2.c b/src/H5AC2.c index a053b36..49e4934 100644 --- a/src/H5AC2.c +++ b/src/H5AC2.c @@ -2587,6 +2587,10 @@ done: * Modified code in support of revised cache API needed * to permit journaling. * + * JRM - 1/2/08 + * Added support for the new flash cache increment related + * fields. + * *------------------------------------------------------------------------- */ @@ -2665,6 +2669,9 @@ H5AC2_get_cache_auto_resize_config(H5AC2_t * cache_ptr, config_ptr->increment = internal_config.increment; config_ptr->apply_max_increment = internal_config.apply_max_increment; config_ptr->max_increment = internal_config.max_increment; + config_ptr->flash_incr_mode = internal_config.flash_incr_mode; + config_ptr->flash_multiple = internal_config.flash_multiple; + config_ptr->flash_threshold = internal_config.flash_threshold; config_ptr->decr_mode = internal_config.decr_mode; config_ptr->upper_hr_threshold = internal_config.upper_hr_threshold; config_ptr->decrement = internal_config.decrement; @@ -2868,6 +2875,10 @@ done: * Modified code in support of revised cache API needed * to permit journaling. * + * John Mainzer -- 1/3/07 + * Updated trace file code to record the new flash cache + * size increase related fields. + * *------------------------------------------------------------------------- */ @@ -3021,7 +3032,7 @@ done: ( trace_file_ptr != NULL ) ) { HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %d %d %f %f %d %d %d %d %f %d %d\n", + "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %d %d %f %f %d %f %f %d %d %d %d %f %d %d\n", "H5AC2_set_cache_auto_resize_config", trace_config.version, (int)(trace_config.rpt_fcn_enabled), @@ -3040,6 +3051,9 @@ done: trace_config.increment, (int)(trace_config.apply_max_increment), (int)(trace_config.max_increment), + (int)(trace_config.flash_incr_mode), + trace_config.flash_multiple, + trace_config.flash_threshold, (int)(trace_config.decr_mode), trace_config.upper_hr_threshold, trace_config.decrement, @@ -3379,7 +3393,7 @@ H5AC2_open_trace_file(H5AC2_t * cache_ptr, HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "trace file open failed.") } - HDfprintf(file_ptr, "### HDF5 metadata cache trace file version 1 ###\n"); + HDfprintf(file_ptr, "### HDF5 metadata cache trace file version 2 ###\n"); if ( H5C2_set_trace_file_ptr(cache_ptr, file_ptr) < 0 ) { @@ -3678,7 +3692,10 @@ done: * * Modifications: * - * None. + * Updated function for flash cache increment fields. + * + * JRM -- 1/2/08 + * * *------------------------------------------------------------------------- */ @@ -3721,6 +3738,10 @@ H5AC2_ext_config_2_int_config(H5AC2_cache_config_t * ext_conf_ptr, int_conf_ptr->increment = ext_conf_ptr->increment; int_conf_ptr->apply_max_increment = ext_conf_ptr->apply_max_increment; int_conf_ptr->max_increment = ext_conf_ptr->max_increment; + int_conf_ptr->flash_incr_mode = ext_conf_ptr->flash_incr_mode; + int_conf_ptr->flash_multiple = ext_conf_ptr->flash_multiple; + int_conf_ptr->flash_threshold = ext_conf_ptr->flash_threshold; + int_conf_ptr->decr_mode = ext_conf_ptr->decr_mode; int_conf_ptr->upper_hr_threshold = ext_conf_ptr->upper_hr_threshold; diff --git a/src/H5AC2private.h b/src/H5AC2private.h index de76b40..ca2522f 100644 --- a/src/H5AC2private.h +++ b/src/H5AC2private.h @@ -202,6 +202,10 @@ extern hid_t H5AC2_ind_dxpl_id; /* double increment = */ 2.0, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ + /* enum H5C2_cache_flash_incr_mode */ \ + /* flash_incr_mode = */ H5C2_flash_incr__add_space, \ + /* double flash_multiple = */ 1.0, \ + /* double flash_threshold = */ 0.25, \ /* enum H5C2_cache_decr_mode decr_mode = */ \ H5C2_decr__age_out_with_threshold, \ /* double upper_hr_threshold = */ 0.999, \ diff --git a/src/H5AC2public.h b/src/H5AC2public.h index 3c88ef1..a16ad2a 100644 --- a/src/H5AC2public.h +++ b/src/H5AC2public.h @@ -15,7 +15,7 @@ /*------------------------------------------------------------------------- * - * Created: H5ACpublic.h + * Created: H5AC2public.h * Jul 10 1997 * Robb Matzke <matzke@llnl.gov> * @@ -208,6 +208,60 @@ extern "C" { * above, this field contains the maximum number of bytes by which the * cache size can be increased in a single re-size. * + * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by which algorithm we should + * make flash increases in the size of the cache to accomodate insertion + * of large entries and large increases in the size of a single entry. + * + * The addition of the flash increment mode was occasioned by performance + * problems that appear when a local heap is increased to a size in excess + * of the current cache size. While the existing re-size code dealt with + * this eventually, performance was very bad for the remainder of the + * epoch. + * + * At present, there are two possible values for the flash_incr_mode: + * + * H5C_flash_incr__off: Don't perform flash increases in the size of + * the cache. + * + * H5C_flash_incr__add_space: Let x be either the size of a newly + * newly inserted entry, or the number of bytes by which the + * size of an existing entry has been increased. + * + * If + * x > flash_threshold * current max cache size, + * + * increase the current maximum cache size by x * flash_multiple + * less any free space in the cache, and star a new epoch. For + * now at least, pay no attention to the maximum increment. + * + * In both of the above cases, the flash increment pays no attention to + * the maximum increment (at least in this first incarnation), but DOES + * stay within max_size. + * + * With a little thought, it should be obvious that the above flash + * cache size increase algorithm is not sufficient for all circumstances + * -- for example, suppose the user round robins through + * (1/flash_threshold) +1 groups, adding one data set to each on each + * pass. Then all will increase in size at about the same time, requiring + * the max cache size to at least double to maintain acceptable + * performance, however the above flash increment algorithm will not be + * triggered. + * + * Hopefully, the add space algorithms detailed above will be sufficient + * for the performance problems encountered to date. However, we should + * expect to revisit the issue. + * + * flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. This field is ignored unless flash_incr_mode + * is H5C_flash_incr__add_space. + * + * flash_threshold: Double containing the factor by which current max cache + * size is multiplied to obtain the size threshold for the add_space flash + * increment algorithm. The field is ignored unless flash_incr_mode is + * H5C_flash_incr__add_space. + * * * Cache size decrease control fields: * @@ -364,6 +418,10 @@ typedef struct H5AC2_cache_config_t hbool_t apply_max_increment; size_t max_increment; + enum H5C2_cache_flash_incr_mode flash_incr_mode; + double flash_multiple; + double flash_threshold; + /* size decrease control fields: */ enum H5C2_cache_decr_mode decr_mode; diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 628a269..bbbcf11 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -213,6 +213,10 @@ extern hid_t H5AC_ind_dxpl_id; /* double increment = */ 2.0, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ + /* enum H5C_cache_flash_incr_mode */ \ + /* flash_incr_mode = */ H5C_flash_incr__add_space, \ + /* double flash_multiple = */ 1.0, \ + /* double flash_threshold = */ 0.25, \ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\ /* double upper_hr_threshold = */ 0.999, \ /* double decrement = */ 0.9, \ diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 0ddef92..0e75117 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -15,7 +15,7 @@ /*------------------------------------------------------------------------- * - * Created: H5ACproto.h + * Created: H5ACpublic.h * Jul 10 1997 * Robb Matzke <matzke@llnl.gov> * @@ -208,6 +208,61 @@ extern "C" { * above, this field contains the maximum number of bytes by which the * cache size can be increased in a single re-size. * + * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by which algorithm we should + * make flash increases in the size of the cache to accomodate insertion + * of large entries and large increases in the size of a single entry. + * + * The addition of the flash increment mode was occasioned by performance + * problems that appear when a local heap is increased to a size in excess + * of the current cache size. While the existing re-size code dealt with + * this eventually, performance was very bad for the remainder of the + * epoch. + * + * At present, there are two possible values for the flash_incr_mode: + * + * H5C_flash_incr__off: Don't perform flash increases in the size of + * the cache. + * + * H5C_flash_incr__add_space: Let x be either the size of a newly + * newly inserted entry, or the number of bytes by which the + * size of an existing entry has been increased. + * + * If + * x > flash_threshold * current max cache size, + * + * increase the current maximum cache size by x * flash_multiple + * less any free space in the cache, and star a new epoch. For + * now at least, pay no attention to the maximum increment. + * + * In both of the above cases, the flash increment pays no attention to + * the maximum increment (at least in this first incarnation), but DOES + * stay within max_size. + * + * With a little thought, it should be obvious that the above flash + * cache size increase algorithm is not sufficient for all circumstances -- + * for example, suppose the user round robins through + * (1/flash_threshold) +1 groups, adding one data set to each on each + * pass. Then all will increase in size at about the same time, requiring + * the max cache size to at least double to maintain acceptable + * performance, however the above flash increment algorithm will not be + * triggered. + * + * Hopefully, the add space algorithms detailed above will be sufficient + * for the performance problems encountered to date. However, we should + * expect to revisit the issue. + * + * flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. This field is ignored unless flash_incr_mode + * is H5C_flash_incr__add_space. + * + * flash_threshold: Double containing the factor by which current max cache size + * is multiplied to obtain the size threshold for the add_space flash + * increment algorithm. The field is ignored unless flash_incr_mode is + * H5C_flash_incr__add_space. + * + * * * Cache size decrease control fields: * @@ -364,6 +419,10 @@ typedef struct H5AC_cache_config_t hbool_t apply_max_increment; size_t max_increment; + enum H5C_cache_flash_incr_mode flash_incr_mode; + double flash_multiple; + double flash_threshold; + /* size decrease control fields: */ enum H5C_cache_decr_mode decr_mode; @@ -2596,6 +2596,10 @@ static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr); static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr); +static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, + size_t old_entry_size, + size_t new_entry_size); + static herr_t H5C_flush_single_entry(H5F_t * f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, @@ -2836,8 +2840,12 @@ done: * ro_ref_count fields. * * JRM -- 7/27/07 -* Added initialization for the new evictions_enabled -* field of H5C_t. + * Added initialization for the new evictions_enabled + * field of H5C_t. + * + * JRM -- 12/31/07 + * Added initialization for the new flash cache size increase + * related fields of H5C_t. * *------------------------------------------------------------------------- */ @@ -2954,6 +2962,8 @@ H5C_create(size_t max_cache_size, cache_ptr->dLRU_tail_ptr = NULL; cache_ptr->size_increase_possible = FALSE; + cache_ptr->flash_size_increase_possible = FALSE; + cache_ptr->flash_size_increase_threshold = 0; cache_ptr->size_decrease_possible = FALSE; cache_ptr->resize_enabled = FALSE; cache_ptr->cache_full = FALSE; @@ -2974,6 +2984,11 @@ H5C_create(size_t max_cache_size, (cache_ptr->resize_ctl).apply_max_increment = TRUE; (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT; + (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off; + (cache_ptr->resize_ctl).flash_multiple = 1.0; + (cache_ptr->resize_ctl).flash_threshold = 0.25; + + (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; (cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD; (cache_ptr->resize_ctl).decrement = H5C__DEF_AR_DECREMENT; @@ -2993,7 +3008,10 @@ H5C_create(size_t max_cache_size, for ( i = 0; i < H5C__MAX_EPOCH_MARKERS; i++ ) { (cache_ptr->epoch_marker_active)[i] = FALSE; - +#ifndef NDEBUG + ((cache_ptr->epoch_markers)[i]).magic = + H5C__H5C_CACHE_ENTRY_T_MAGIC; +#endif /* NDEBUG */ ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i; ((cache_ptr->epoch_markers)[i]).size = (size_t)0; ((cache_ptr->epoch_markers)[i]).type = &epoch_marker_class; @@ -3079,6 +3097,9 @@ done: * Updated function for display the new prefix field of * H5C_t in output. * + * JRM 12/31/07 + * Updated function to handle flash size increases. + * *------------------------------------------------------------------------- */ void @@ -3125,6 +3146,24 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, new_min_clean_size); break; + case flash_increase: + HDassert( old_max_cache_size < new_max_cache_size ); + + HDfprintf(stdout, + "%sflash cache resize(%d) -- size threshold = %Zu.\n", + cache_ptr->prefix, + (int)((cache_ptr->resize_ctl).flash_incr_mode), + cache_ptr->flash_size_increase_threshold); + + HDfprintf(stdout, + "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", + cache_ptr->prefix, + old_max_cache_size, + old_min_clean_size, + new_max_cache_size, + new_min_clean_size); + break; + case decrease: HDassert( old_max_cache_size > new_max_cache_size ); @@ -3537,6 +3576,21 @@ done: * callbacks. As a result, we may have to make multiple * passes through the skip list before the cache is flushed. * + * JRM -- 10/13/07 + * Added code to detect and manage the case in which a + * flush callback changes the s-list out from under + * the function. The only way I can think of in which this + * can happen is if a flush function loads an entry + * into the cache that isn't there already. Quincey tells + * me that this will never happen, but I'm not sure I + * believe him. + * + * Note that this is a pretty bad scenario if it ever + * happens. The code I have added should allow us to + * handle the situation under all but the worst conditions, + * but one can argue that I should just scream and die if I + * ever detect the condidtion. + * *------------------------------------------------------------------------- */ herr_t @@ -3558,6 +3612,7 @@ H5C_flush_cache(H5F_t * f, int32_t protected_entries = 0; H5SL_node_t * node_ptr = NULL; H5C_cache_entry_t * entry_ptr = NULL; + H5C_cache_entry_t * next_entry_ptr = NULL; #if H5C_DO_SANITY_CHECKS int64_t flushed_entries_count; size_t flushed_entries_size; @@ -3620,6 +3675,28 @@ H5C_flush_cache(H5F_t * f, { flushed_entries_last_pass = FALSE; node_ptr = H5SL_first(cache_ptr->slist_ptr); + + if ( node_ptr != NULL ) { + + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + if ( next_entry_ptr == NULL ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL 1 ?!?!"); + } +#ifndef NDEBUG + HDassert( next_entry_ptr->magic == + H5C__H5C_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ + HDassert( next_entry_ptr->is_dirty ); + HDassert( next_entry_ptr->in_slist ); + + } else { + + next_entry_ptr = NULL; + + } HDassert( node_ptr != NULL ); @@ -3667,13 +3744,76 @@ H5C_flush_cache(H5F_t * f, while ( node_ptr != NULL ) { - entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + entry_ptr = next_entry_ptr; + + /* With the advent of the fractal heap, it is possible + * that the flush callback will dirty and/or resize + * other entries in the cache. In particular, while + * Quincey has promised me that this will never happen, + * it is possible that the flush callback for an + * entry may protect an entry that is not in the cache, + * perhaps causing the cache to flush and possibly + * evict the entry associated with node_ptr to make + * space for the new entry. + * + * Thus we do a bit of extra sanity checking on entry_ptr, + * and break out of this scan of the skip list if we + * detect minor problems. We have a bit of leaway on the + * number of passes though the skip list, so this shouldn't + * be an issue in the flush in and of itself, as it should + * be all but impossible for this to happen more than once + * in any flush. + * + * Observe that that breaking out of the scan early + * shouldn't break the sanity checks just after the end + * of this while loop. + * + * If an entry has merely been marked clean and removed from + * the s-list, we simply break out of the scan. + * + * If the entry has been evicted, we flag an error and + * exit. + */ +#ifndef NDEBUG + if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "entry_ptr->magic invalid ?!?!"); + + } else +#endif /* NDEBUG */ + if ( ( ! entry_ptr->is_dirty ) || + ( ! entry_ptr->in_slist ) ) { + + /* the s-list has been modified out from under us. + * set node_ptr to NULL and break out of the loop. + */ + node_ptr = NULL; + break; + } /* increment node pointer now, before we delete its target * from the slist. */ node_ptr = H5SL_next(node_ptr); + if ( node_ptr != NULL ) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + if ( next_entry_ptr == NULL ) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL 2 ?!?!"); + } +#ifndef NDEBUG + HDassert( next_entry_ptr->magic == + H5C__H5C_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ + HDassert( next_entry_ptr->is_dirty ); + HDassert( next_entry_ptr->in_slist ); + } else { + next_entry_ptr = NULL; + } + HDassert( entry_ptr != NULL ); HDassert( entry_ptr->in_slist ); @@ -3689,6 +3829,40 @@ H5C_flush_cache(H5F_t * f, tried_to_flush_protected_entry = TRUE; protected_entries++; + } else if ( entry_ptr->is_pinned ) { + /* Test to see if we are can flush the entry now. + * If we can, go ahead and flush. Note that we + * aren't trying to do a destroy here, so that + * is not an issue. + */ + if ( TRUE ) { /* When we get to multithreaded cache, + * we will need either locking code, + * and/or a test to see if the entry + * is in flushable condition here. + */ +#if H5C_DO_SANITY_CHECKS + flushed_entries_count++; + flushed_entries_size += entry_ptr->size; +#endif /* H5C_DO_SANITY_CHECKS */ + status = H5C_flush_single_entry(f, + primary_dxpl_id, + secondary_dxpl_id, + cache_ptr, + NULL, + entry_ptr->addr, + flags, + &first_flush, + FALSE); + if ( status < 0 ) { + + /* This shouldn't happen -- if it does, we are + * toast so just scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "dirty pinned entry flush failed.") + } + flushed_entries_last_pass = TRUE; + } } else { #if H5C_DO_SANITY_CHECKS flushed_entries_count++; @@ -4434,6 +4608,9 @@ done: * Added code to disable evictions when the new * evictions_enabled field is FALSE. * + * JRM -- 12/31/07 + * Added code supporting flash cache size increases. + * *------------------------------------------------------------------------- */ @@ -4447,6 +4624,7 @@ H5C_insert_entry(H5F_t * f, void * thing, unsigned int flags) { + /* const char * fcn_name = "H5C_insert_entry()"; */ herr_t result; herr_t ret_value = SUCCEED; /* Return value */ hbool_t first_flush = TRUE; @@ -4486,7 +4664,9 @@ H5C_insert_entry(H5F_t * f, insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); entry_ptr = (H5C_cache_entry_t *)thing; - +#ifndef NDEBUG + entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; +#endif /* NDEBUG */ entry_ptr->addr = addr; entry_ptr->type = type; @@ -4524,6 +4704,18 @@ H5C_insert_entry(H5F_t * f, H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) + if ( ( cache_ptr->flash_size_increase_possible ) && + ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { + + result = H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + if ( ( cache_ptr->evictions_enabled ) && ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size ) ) { @@ -4999,7 +5191,9 @@ done: * * Modifications: * - * None + * Added code to do a flash cache size increase if + * appropriate. + * JRM -- 1/11/08 * *------------------------------------------------------------------------- */ @@ -5010,6 +5204,8 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, size_t new_size) { herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + size_t size_increase; H5C_cache_entry_t * entry_ptr; FUNC_ENTER_NOAPI(H5C_mark_pinned_entry_dirty, FAIL) @@ -5039,6 +5235,29 @@ H5C_mark_pinned_entry_dirty(H5C_t * cache_ptr, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected entry list */ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ (cache_ptr->pel_size), \ @@ -5371,7 +5590,9 @@ done: * * Modifications: * - * None + * Added code to apply a flash cache size increment if + * appropriate. + * JRM -- 1/11/08 * *------------------------------------------------------------------------- */ @@ -5380,8 +5601,11 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, void * thing, size_t new_size) { + /* const char * fcn_name = "H5C_resize_pinned_entry()"; */ herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; H5C_cache_entry_t * entry_ptr; + size_t size_increase; FUNC_ENTER_NOAPI(H5C_resize_pinned_entry, FAIL) @@ -5417,6 +5641,29 @@ H5C_resize_pinned_entry(H5C_t * cache_ptr, /* update for change in entry size if necessary */ if ( entry_ptr->size != new_size ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected entry list */ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ (cache_ptr->pel_size), \ @@ -5604,9 +5851,13 @@ done: * of cache entries. * * JRM -- 7/27/07 - * Added code supporting the new evictions_enabled fieled + * Added code supporting the new evictions_enabled field * in H5C_t. * + * JRM -- 1/3/08 + * Added to do a flash cache size increase if appropriate + * when a large entry is loaded. + * *------------------------------------------------------------------------- */ @@ -5621,6 +5872,7 @@ H5C_protect(H5F_t * f, void * udata2, unsigned flags) { + /* const char * fcn_name = "H5C_protect()"; */ hbool_t hit; hbool_t first_flush; hbool_t have_write_permitted = FALSE; @@ -5678,7 +5930,25 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; - /* try to free up some space if necessary and if evictions are permitted */ + /* If the entry is very large, and we are configured to allow it, + * we may wish to perform a flash cache size increase. + */ + if ( ( cache_ptr->flash_size_increase_possible ) && + ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { + + result = H5C__flash_increase_cache_size(cache_ptr, 0, + entry_ptr->size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ + "H5C__flash_increase_cache_size failed.") + } + } + + /* try to free up some space if necessary and if evictions are + * permitted + */ if ( ( cache_ptr->evictions_enabled ) && ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size ) ) { @@ -5978,6 +6248,10 @@ done: * if the new configuration forces an immediate reduction * in cache size. * + * JRM -- 12/31/07 + * Added code supporting the new flash cache size increase + * code. + * *------------------------------------------------------------------------- */ @@ -5985,6 +6259,7 @@ herr_t H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr) { + /* const char *fcn_name = "H5C_set_cache_auto_resize_config()"; */ herr_t ret_value = SUCCEED; /* Return value */ herr_t result; size_t new_max_cache_size; @@ -6039,8 +6314,10 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, "conflicting threshold fields in new config.") } - cache_ptr->size_increase_possible = TRUE; /* will set to FALSE if needed */ - cache_ptr->size_decrease_possible = TRUE; /* will set to FALSE if needed */ + /* will set the increase possible fields to FALSE later if needed */ + cache_ptr->size_increase_possible = TRUE; + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->size_decrease_possible = TRUE; switch ( config_ptr->incr_mode ) { @@ -6062,6 +6339,11 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?.") } + /* logically, this is were configuration for flash cache size increases + * should go. However, this configuration depends on max_cache_size, so + * we wait until the end of the function, when this field is set. + */ + switch ( config_ptr->decr_mode ) { case H5C_decr__off: @@ -6106,9 +6388,13 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, if ( config_ptr->max_size == config_ptr->min_size ) { cache_ptr->size_increase_possible = FALSE; + cache_ptr->flash_size_increase_possible = FALSE; cache_ptr->size_decrease_possible = FALSE; } + /* flash_size_increase_possible is intentionally omitted from the + * following: + */ cache_ptr->resize_enabled = cache_ptr->size_increase_possible || cache_ptr->size_decrease_possible; @@ -6196,6 +6482,37 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, } } + /* configure flash size increase facility. We wait until the + * end of the function, as we need the max_cache_size set before + * we start to keep things simple. + * + * If we haven't already ruled out flash cache size increases above, + * go ahead and configure it. + */ + + if ( cache_ptr->flash_size_increase_possible ) { + + switch ( config_ptr->flash_incr_mode ) + { + case H5C_flash_incr__off: + cache_ptr->flash_size_increase_possible = FALSE; + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + } + done: FUNC_LEAVE_NOAPI(ret_value) @@ -7095,6 +7412,9 @@ done: * Also added sanity checks using the new is_read_only and * ro_ref_count parameters. * + * JRM -- 12/31/07 + * Modified funtion to support flash cache resizes. + * *------------------------------------------------------------------------- */ herr_t @@ -7108,6 +7428,7 @@ H5C_unprotect(H5F_t * f, unsigned int flags, size_t new_size) { + /* const char * fcn_name = "H5C_unprotect()"; */ hbool_t deleted; hbool_t dirtied; hbool_t set_flush_marker; @@ -7118,6 +7439,8 @@ H5C_unprotect(H5F_t * f, hbool_t clear_entry = FALSE; #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + size_t size_increase = 0; H5C_cache_entry_t * entry_ptr; H5C_cache_entry_t * test_entry_ptr; @@ -7265,6 +7588,29 @@ H5C_unprotect(H5F_t * f, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected list */ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), \ (cache_ptr->pl_size), \ @@ -7458,7 +7804,9 @@ done: * * Modifications: * - * None. + * Added validation for the flash increment fields. + * + * JRM -- 12/31/07 * *------------------------------------------------------------------------- */ @@ -7560,7 +7908,7 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, ( config_ptr->apply_max_increment != FALSE ) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_max_increment must be either TRUE or FALSE"); + "apply_max_increment must be either TRUE or FALSE"); } /* no need to check max_increment, as it is a size_t, @@ -7568,6 +7916,33 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, */ } /* H5C_incr__threshold */ + switch ( config_ptr->flash_incr_mode ) + { + case H5C_flash_incr__off: + /* nothing to do here */ + break; + + case H5C_flash_incr__add_space: + if ( ( config_ptr->flash_multiple < 0.1 ) || + ( config_ptr->flash_multiple > 10.0 ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "flash_multiple must be in the range [0.1, 10.0]"); + } + + if ( ( config_ptr->flash_threshold < 0.1 ) || + ( config_ptr->flash_threshold > 1.0 ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "flash_threshold must be in the range [0.1, 1.0]"); + } + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "Invalid flash_incr_mode"); + break; + } } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */ @@ -7707,6 +8082,9 @@ done: * reduction, and to adjust to changes in the * H5C_auto_size_ctl_t structure. * + * JRM -- 1/5/08 + * Added support for flash cache size increases. + * *------------------------------------------------------------------------- */ @@ -7990,6 +8368,30 @@ H5C__auto_adjust_cache_size(H5C_t * cache_ptr, cache_ptr->size_decreased = TRUE; } + + /* update flash cache size increase fields as appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + } } if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { @@ -8308,7 +8710,20 @@ done: * * Modifications: * - * None. + * JRM -- 10/13/07 + * Added code to detect and manage the case in which a + * flush callback changes the LRU-list out from under + * the function. The only way I can think of in which this + * can happen is if a flush function loads an entry + * into the cache that isn't there already. Quincey tells + * me that this will never happen, but I'm not sure I + * believe him. + * + * Note that this is a pretty bad scenario if it ever + * happens. The code I have added should allow us to + * handle the situation under all but the worst conditions, + * but one can argue that I should just scream and die if I + * ever detect the condidtion. * *------------------------------------------------------------------------- */ @@ -8325,7 +8740,9 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, herr_t result; size_t eviction_size_limit; size_t bytes_evicted = 0; + hbool_t prev_is_dirty = FALSE; H5C_cache_entry_t * entry_ptr; + H5C_cache_entry_t * next_ptr; H5C_cache_entry_t * prev_ptr; FUNC_ENTER_NOAPI_NOINIT(H5C__autoadjust__ageout__evict_aged_out_entries) @@ -8358,8 +8775,14 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, { HDassert( ! (entry_ptr->is_protected) ); + next_ptr = entry_ptr->next; prev_ptr = entry_ptr->prev; + if ( prev_ptr != NULL ) { + + prev_is_dirty = prev_ptr->is_dirty; + } + if ( entry_ptr->is_dirty ) { result = H5C_flush_single_entry(f, @@ -8392,8 +8815,41 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, "unable to flush entry") } - entry_ptr = prev_ptr; + if ( prev_ptr != NULL ) { +#ifndef NDEBUG + if ( prev_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { + + /* something horrible has happened to *prev_ptr -- + * scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "*prev_ptr corrupt") + + } else +#endif /* NDEBUG */ + if ( ( prev_ptr->is_dirty != prev_is_dirty ) + || + ( prev_ptr->next != next_ptr ) + || + ( prev_ptr->is_protected ) + || + ( prev_ptr->is_pinned ) ) { + + /* something has happened to the LRU -- start over + * from the tail. + */ + entry_ptr = cache_ptr->LRU_tail_ptr; + + } else { + + entry_ptr = prev_ptr; + } + } else { + + entry_ptr = NULL; + + } } /* end while */ /* for now at least, don't bother to maintain the minimum clean size, @@ -8741,6 +9197,173 @@ done: } /* H5C__autoadjust__ageout__remove_excess_markers() */ +/*------------------------------------------------------------------------- + * + * Function: H5C__flash_increase_cache_size + * + * Purpose: If there is not at least new_entry_size - old_entry_size + * bytes of free space in the cache and the current + * max_cache_size is less than (cache_ptr->resize_ctl).max_size, + * perform a flash increase in the cache size and then reset + * the full cache hit rate statistics, and exit. + * + * Return: Non-negative on success/Negative on failure. + * + * Programmer: John Mainzer, 12/31/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5C__flash_increase_cache_size(H5C_t * cache_ptr, + size_t old_entry_size, + size_t new_entry_size) +{ + /* const char * fcn_name = "H5C__flash_increase_cache_size()";*/ + herr_t ret_value = SUCCEED; /* Return value */ + size_t new_max_cache_size = 0; + size_t old_max_cache_size = 0; + size_t new_min_clean_size = 0; + size_t old_min_clean_size = 0; + size_t space_needed; + enum H5C_resize_status status = flash_increase; /* may change */ + double hit_rate; + + FUNC_ENTER_NOAPI_NOINIT(H5C__flash_increase_cache_size) + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); + HDassert( cache_ptr->flash_size_increase_possible ); + HDassert( new_entry_size > cache_ptr->flash_size_increase_threshold ); + HDassert( old_entry_size < new_entry_size ); + + if ( old_entry_size >= new_entry_size ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "old_entry_size >= new_entry_size") + } + + space_needed = new_entry_size - old_entry_size; + + if ( ( (cache_ptr->index_size + space_needed) > + cache_ptr->max_cache_size ) && + ( cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size ) ) { + + /* we have work to do */ + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; + + case H5C_flash_incr__add_space: + if ( cache_ptr->index_size < cache_ptr->max_cache_size ) { + + HDassert( (cache_ptr->max_cache_size - cache_ptr->index_size) + < space_needed ); + space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size; + } + space_needed = + (size_t)(((double)space_needed) * + (cache_ptr->resize_ctl).flash_multiple); + + new_max_cache_size = cache_ptr->max_cache_size + space_needed; + + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + + if ( new_max_cache_size > (cache_ptr->resize_ctl).max_size ) { + + new_max_cache_size = (cache_ptr->resize_ctl).max_size; + } + + HDassert( new_max_cache_size > cache_ptr->max_cache_size ); + + new_min_clean_size = (size_t) + ((double)new_max_cache_size * + ((cache_ptr->resize_ctl).min_clean_fraction)); + + HDassert( new_min_clean_size <= new_max_cache_size ); + + old_max_cache_size = cache_ptr->max_cache_size; + old_min_clean_size = cache_ptr->min_clean_size; + + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; + + /* update flash cache size increase fields as appropriate */ + HDassert ( cache_ptr->flash_size_increase_possible ); + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + + /* note that we don't cycle the epoch markers. We can + * argue either way as to whether we should, but for now + * we don't. + */ + + if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { + + /* get the hit rate for the reporting function. Should still + * be good as we havent reset the hit rate statistics. + */ + if ( H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate.") + } + + (*((cache_ptr->resize_ctl).rpt_fcn)) + (cache_ptr, + H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, + hit_rate, + status, + old_max_cache_size, + new_max_cache_size, + old_min_clean_size, + new_min_clean_size); + } + + if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { + + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5C_reset_cache_hit_rate_stats failed.") + } + } + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C__flash_increase_cache_size() */ + /*------------------------------------------------------------------------- * Function: H5C_flush_invalidate_cache @@ -8779,12 +9402,28 @@ done: * * Modifications: * - * To support the fractal heap, the cache must now deal with - * entries being dirtied, resized, and/or renamed inside - * flush callbacks. Updated function to support this. + * To support the fractal heap, the cache must now deal with + * entries being dirtied, resized, and/or renamed inside + * flush callbacks. Updated function to support this. * * -- JRM 8/27/06 * + * Added code to detect and manage the case in which a + * flush callback changes the s-list out from under + * the function. The only way I can think of in which this + * can happen is if a flush function loads an entry + * into the cache that isn't there already. Quincey tells + * me that this will never happen, but I'm not sure I + * believe him. + * + * Note that this is a pretty bad scenario if it ever + * happens. The code I have added should allow us to + * handle the situation under all but the worst conditions, + * but one can argue that I should just scream and die if I + * ever detect the condidtion. + * + * -- JRM 10/13/07 + * *------------------------------------------------------------------------- */ herr_t @@ -8895,6 +9534,23 @@ H5C_flush_invalidate_cache(H5F_t * f, node_ptr = H5SL_first(cache_ptr->slist_ptr); + if ( node_ptr == NULL ) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "slist_len != 0 && node_ptr == NULL"); + } + + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + if ( next_entry_ptr == NULL ) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL 1 ?!?!"); + } +#ifndef NDEBUG + HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ + HDassert( next_entry_ptr->is_dirty ); + HDassert( next_entry_ptr->in_slist ); + } #if H5C_DO_SANITY_CHECKS /* Depending on circumstances, H5C_flush_single_entry() will @@ -8927,23 +9583,88 @@ H5C_flush_invalidate_cache(H5F_t * f, while ( node_ptr != NULL ) { - /* Note that we now remove nodes from the slist as we flush - * the associated entries, instead of leaving them there - * until we are done, and then destroying all nodes in - * the slist. + entry_ptr = next_entry_ptr; + + /* With the advent of the fractal heap, it is possible + * that the flush callback will dirty and/or resize + * other entries in the cache. In particular, while + * Quincey has promised me that this will never happen, + * it is possible that the flush callback for an + * entry may protect an entry that is not in the cache, + * perhaps causing the cache to flush and possibly + * evict the entry associated with node_ptr to make + * space for the new entry. * - * While this optimization used to be easy, with the possibility - * of new entries being added to the slist in the midst of the - * flush, we must keep the slist in cannonical form at all - * times. + * Thus we do a bit of extra sanity checking on entry_ptr, + * and break out of this scan of the skip list if we + * detect major problems. We have a bit of leaway on the + * number of passes though the skip list, so this shouldn't + * be an issue in the flush in and of itself, as it should + * be all but impossible for this to happen more than once + * in any flush. + * + * Observe that that breaking out of the scan early + * shouldn't break the sanity checks just after the end + * of this while loop. + * + * If an entry has merely been marked clean and removed from + * the s-list, we simply break out of the scan. + * + * If the entry has been evicted, we flag an error and + * exit. */ +#ifndef NDEBUG + if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "entry_ptr->magic is invalid ?!?!"); + + } else +#endif /* NDEBUG */ + if ( ( ! entry_ptr->is_dirty ) || + ( ! entry_ptr->in_slist ) ) { - entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + /* the s-list has been modified out from under us. + * break out of the loop. + */ + break; + } /* increment node pointer now, before we delete its target * from the slist. */ + node_ptr = H5SL_next(node_ptr); + if ( node_ptr != NULL ) { + + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + if ( next_entry_ptr == NULL ) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr == NULL 2 ?!?!"); + } +#ifndef NDEBUG + HDassert( next_entry_ptr->magic == + H5C__H5C_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ + HDassert( next_entry_ptr->is_dirty ); + HDassert( next_entry_ptr->in_slist ); + + } else { + + next_entry_ptr = NULL; + } + + /* Note that we now remove nodes from the slist as we flush + * the associated entries, instead of leaving them there + * until we are done, and then destroying all nodes in + * the slist. + * + * While this optimization used to be easy, with the possibility + * of new entries being added to the slist in the midst of the + * flush, we must keep the slist in cannonical form at all + * times. + */ HDassert( entry_ptr != NULL ); HDassert( entry_ptr->in_slist ); @@ -9030,12 +9751,19 @@ H5C_flush_invalidate_cache(H5F_t * f, /* It is possible that entries were added to the slist during * the scan, either before or after scan pointer. The following * asserts take this into account. - */ + * + * Don't bother with the sanity checks if node_ptr != NULL, as + * in this case we broke out of the loop because it got changed + * out from under us. + */ + + if ( node_ptr == NULL ) { - HDassert( (actual_slist_len + cache_ptr->slist_len) == - (initial_slist_len + cache_ptr->slist_len_increase) ); - HDassert( (actual_slist_size + cache_ptr->slist_size) == - (initial_slist_size + cache_ptr->slist_size_increase) ); + HDassert( (actual_slist_len + cache_ptr->slist_len) == + (initial_slist_len + cache_ptr->slist_len_increase) ); + HDassert( (actual_slist_size + cache_ptr->slist_size) == + (initial_slist_size + cache_ptr->slist_size_increase) ); + } #endif /* H5C_DO_SANITY_CHECKS */ /* Since we are doing a destroy, we must make a pass through @@ -9056,8 +9784,13 @@ H5C_flush_invalidate_cache(H5F_t * f, while ( next_entry_ptr != NULL ) { entry_ptr = next_entry_ptr; - next_entry_ptr = entry_ptr->ht_next; + next_entry_ptr = entry_ptr->ht_next; +#ifndef NDEBUG + HDassert ( ( next_entry_ptr == NULL ) || + ( next_entry_ptr->magic == + H5C__H5C_CACHE_ENTRY_T_MAGIC ) ); +#endif /* NDEBUG */ if ( entry_ptr->is_protected ) { /* we have major problems -- but lets flush and destroy @@ -9099,6 +9832,28 @@ H5C_flush_invalidate_cache(H5F_t * f, * of pinned entries from pass to pass. If it stops * shrinking before it hits zero, we scream and die. */ + /* if the flush function on the entry we last evicted + * loaded an entry into cache (as Quincey has promised me + * it never will), and if the cache was full, it is + * possible that *next_entry_ptr was flushed or evicted. + * + * Test to see if this happened here. Note that if this + * test is triggred, we are accessing a deallocated piece + * of dynamically allocated memory, so we just scream and + * die. + */ +#ifndef NDEBUG + if ( ( next_entry_ptr != NULL ) && + ( next_entry_ptr->magic != + H5C__H5C_CACHE_ENTRY_T_MAGIC ) ) { + + /* Something horrible has happened to + * *next_entry_ptr -- scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "next_entry_ptr->magic is invalid?!?!?.") + } +#endif /* NDEBUG */ } /* end while loop scanning hash table bin */ } /* end for loop scanning hash table */ @@ -9541,6 +10296,17 @@ H5C_flush_single_entry(H5F_t * f, /* Clear the dirty flag only, if requested */ if ( clear_only ) { +#ifndef NDEBUG + if ( destroy ) { + /* we are about to call the clear callback with the + * destroy flag set -- this will result in *entry_ptr + * being freed. Set the magic field to bad magic + * so we can detect a freed cache entry if we see + * one. + */ + entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; + } +#endif /* NDEBUG */ /* Call the callback routine to clear all dirty flags for object */ if ( (entry_ptr->type->clear)(f, entry_ptr, destroy) < 0 ) { @@ -9558,6 +10324,18 @@ H5C_flush_single_entry(H5F_t * f, } #endif /* H5C_DO_SANITY_CHECKS */ +#ifndef NDEBUG + if ( destroy ) { + /* we are about to call the flush callback with the + * destroy flag set -- this will result in *entry_ptr + * being freed. Set the magic field to bad magic + * so we can detect a freed cache entry if we see + * one. + */ + entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; + } +#endif /* NDEBUG */ + /* Only block for all the processes on the first piece of metadata */ @@ -9816,7 +10594,9 @@ H5C_load_entry(H5F_t * f, */ HDassert( ( entry_ptr->is_dirty == FALSE ) || ( type->id == 4 ) ); - +#ifndef NDEBUG + entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; +#endif /* NDEBUG */ entry_ptr->addr = addr; entry_ptr->type = type; entry_ptr->is_protected = FALSE; @@ -9914,6 +10694,21 @@ done: * Added sanity checks using the new is_read_only and * ro_ref_count fields. * + * JRM -- 10/13/07 + * Added code to detect and manage the case in which a + * flush callback changes the LRU-list out from under + * the function. The only way I can think of in which this + * can happen is if a flush function loads an entry + * into the cache that isn't there already. Quincey tells + * me that this will never happen, but I'm not sure I + * believe him. + * + * Note that this is a pretty bad scenario if it ever + * happens. The code I have added should allow us to + * handle the situation under all but the worst conditions, + * but one can argue that I should just scream and die if I + * ever detect the condidtion. + * *------------------------------------------------------------------------- */ @@ -9933,7 +10728,10 @@ H5C_make_space_in_cache(H5F_t * f, #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS size_t empty_space; #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + hbool_t prev_is_dirty = FALSE; + hbool_t entry_is_epoch_maker = FALSE; H5C_cache_entry_t * entry_ptr; + H5C_cache_entry_t * next_ptr; H5C_cache_entry_t * prev_ptr; FUNC_ENTER_NOAPI_NOINIT(H5C_make_space_in_cache) @@ -9962,10 +10760,18 @@ H5C_make_space_in_cache(H5F_t * f, HDassert( ! (entry_ptr->is_read_only) ); HDassert( (entry_ptr->ro_ref_count) == 0 ); - prev_ptr = entry_ptr->prev; + next_ptr = entry_ptr->next; + prev_ptr = entry_ptr->prev; + + if ( prev_ptr != NULL ) { + + prev_is_dirty = prev_ptr->is_dirty; + } if ( (entry_ptr->type)->id != H5C__EPOCH_MARKER_TYPE ) { + entry_is_epoch_maker = FALSE; + if ( entry_ptr->is_dirty ) { result = H5C_flush_single_entry(f, @@ -9994,6 +10800,7 @@ H5C_make_space_in_cache(H5F_t * f, /* Skip epoch markers. Set result to SUCCEED to avoid * triggering the error code below. */ + entry_is_epoch_maker = TRUE; result = SUCCEED; } @@ -10003,11 +10810,54 @@ H5C_make_space_in_cache(H5F_t * f, "unable to flush entry") } - entry_ptr = prev_ptr; - } + if ( prev_ptr != NULL ) { +#ifndef NDEBUG + if ( prev_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) { + + /* something horrible has happened to *prev_ptr -- + * scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "*prev_ptr corrupt 1") + + } +#endif /* NDEBUG */ + if ( entry_is_epoch_maker ) { + + entry_ptr = prev_ptr; + + } else if ( ( prev_ptr->is_dirty != prev_is_dirty ) + || + ( prev_ptr->next != next_ptr ) + || + ( prev_ptr->is_protected ) + || + ( prev_ptr->is_pinned ) ) { + + /* something has happened to the LRU -- start over + * from the tail. + */ + + entry_ptr = cache_ptr->LRU_tail_ptr; + + } else { + + entry_ptr = prev_ptr; + + } + } else { + + entry_ptr = NULL; + + } + + entries_examined++; + + } #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + entries_examined = 0; initial_list_len = cache_ptr->dLRU_list_len; entry_ptr = cache_ptr->dLRU_tail_ptr; @@ -10034,6 +10884,13 @@ H5C_make_space_in_cache(H5F_t * f, prev_ptr = entry_ptr->aux_prev; + next_ptr = entry_ptr->aux_next; + + if ( prev_ptr != NULL ) { + + HDassert( prev_ptr->is_dirty ); + } + result = H5C_flush_single_entry(f, primary_dxpl_id, secondary_dxpl_id, @@ -10050,7 +10907,66 @@ H5C_make_space_in_cache(H5F_t * f, "unable to flush entry") } - entry_ptr = prev_ptr; + if ( prev_ptr != NULL ) { +#ifndef NDEBUG + if (prev_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC) { + + /* something horrible has happened to *prev_ptr -- + * scream and die. + */ + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "*prev_ptr corrupt 2") + + } else +#endif /* #ifndef NDEBUG */ + if ( ( ! ( prev_ptr->is_dirty ) ) + || + ( prev_ptr->aux_next != next_ptr ) + || + ( prev_ptr->is_protected ) + || + ( prev_ptr->is_pinned ) ) { + + /* something has happened to the dirty LRU -- start over + * from the tail. + */ + +#if 0 /* This debuging code may be useful in the future -- keep it for now. */ + if ( ! ( prev_ptr->is_dirty ) ) { + HDfprintf(stdout, "%s: ! prev_ptr->is_dirty\n", + fcn_name); + } + if ( prev_ptr->aux_next != next_ptr ) { + HDfprintf(stdout, "%s: prev_ptr->next != next_ptr\n", + fcn_name); + } + if ( prev_ptr->is_protected ) { + HDfprintf(stdout, "%s: prev_ptr->is_protected\n", + fcn_name); + } + if ( prev_ptr->is_pinned ) { + HDfprintf(stdout, "%s:prev_ptr->is_pinned\n", + fcn_name); + } + + HDfprintf(stdout, "%s: re-starting scan of dirty list\n", + fcn_name); +#endif /* JRM */ + entry_ptr = cache_ptr->dLRU_tail_ptr; + + } else { + + entry_ptr = prev_ptr; + + } + } else { + + entry_ptr = NULL; + + } + + entries_examined++; } #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ @@ -10096,6 +11012,7 @@ H5C_make_space_in_cache(H5F_t * f, } entry_ptr = prev_ptr; + entries_examined++; } } @@ -2588,6 +2588,10 @@ static herr_t H5C2__autoadjust__ageout__remove_all_markers(H5C2_t * cache_ptr); static herr_t H5C2__autoadjust__ageout__remove_excess_markers(H5C2_t * cache_ptr); +static herr_t H5C2__flash_increase_cache_size(H5C2_t * cache_ptr, + size_t old_entry_size, + size_t new_entry_size); + static herr_t H5C2_flush_single_entry(H5F_t * f, hid_t dxpl_id, H5C2_t * cache_ptr, @@ -2850,6 +2854,11 @@ done: * Added initialization for the new is_read_only and * ro_ref_count fields. * + * JRM -- 12/31/07 + * Added initialization for the new flash cache size increase + * related fields of H5C2_t. + * + * *------------------------------------------------------------------------- */ @@ -2969,6 +2978,8 @@ H5C2_create(const H5F_t * f, cache_ptr->dLRU_tail_ptr = NULL; cache_ptr->size_increase_possible = FALSE; + cache_ptr->flash_size_increase_possible = FALSE; + cache_ptr->flash_size_increase_threshold = 0; cache_ptr->size_decrease_possible = FALSE; cache_ptr->resize_enabled = FALSE; cache_ptr->cache_full = FALSE; @@ -2989,6 +3000,10 @@ H5C2_create(const H5F_t * f, (cache_ptr->resize_ctl).apply_max_increment = TRUE; (cache_ptr->resize_ctl).max_increment = H5C2__DEF_AR_MAX_INCREMENT; + (cache_ptr->resize_ctl).flash_incr_mode = H5C2_flash_incr__off; + (cache_ptr->resize_ctl).flash_multiple = 1.0; + (cache_ptr->resize_ctl).flash_threshold = 0.25; + (cache_ptr->resize_ctl).decr_mode = H5C2_decr__off; (cache_ptr->resize_ctl).upper_hr_threshold = H5C2__DEF_AR_UPPER_THRESHHOLD; (cache_ptr->resize_ctl).decrement = H5C2__DEF_AR_DECREMENT; @@ -3008,9 +3023,10 @@ H5C2_create(const H5F_t * f, for ( i = 0; i < H5C2__MAX_EPOCH_MARKERS; i++ ) { (cache_ptr->epoch_marker_active)[i] = FALSE; - +#ifndef NDEBUG ((cache_ptr->epoch_markers)[i]).magic = H5C2__H5C2_CACHE_ENTRY_T_MAGIC; +#endif /* NDEBUG */ ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i; ((cache_ptr->epoch_markers)[i]).size = (size_t)0; ((cache_ptr->epoch_markers)[i]).type = &epoch_marker_class_2; @@ -3096,6 +3112,9 @@ done: * Updated function for display the new prefix field of * H5C2_t in output. * + * JRM 12/31/07 + * Updated function to handle flash size increases. + * *------------------------------------------------------------------------- */ void @@ -3142,6 +3161,25 @@ H5C2_def_auto_resize_rpt_fcn(H5C2_t * cache_ptr, new_min_clean_size); break; + case flash_increase2: + HDassert( old_max_cache_size < new_max_cache_size ); + + HDfprintf(stdout, + "%sflash cache resize(%d) -- size threshold = %Zu.\n", + cache_ptr->prefix, + (int)((cache_ptr->resize_ctl).flash_incr_mode), + cache_ptr->flash_size_increase_threshold); + + HDfprintf(stdout, + "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", + cache_ptr->prefix, + old_max_cache_size, + old_min_clean_size, + new_max_cache_size, + new_min_clean_size); + break; + + case decrease2: HDassert( old_max_cache_size > new_max_cache_size ); @@ -3571,6 +3609,21 @@ done: * handle the situation, but one can argue that I should * just scream and die if I ever detect the condidtion. * + * JRM -- 10/13/07 + * Added code to detect and manage the case in which a + * flush callback changes the s-list out from under + * the function. The only way I can think of in which this + * can happen is if a flush function loads an entry + * into the cache that isn't there already. Quincey tells + * me that this will never happen, but I'm not sure I + * believe him. + * + * Note that this is a pretty bad scenario if it ever + * happens. The code I have added should allow us to + * handle the situation under all but the worst conditions, + * but one can argue that I should just scream and die if I + * ever detect the condidtion. + * *------------------------------------------------------------------------- */ herr_t @@ -3651,19 +3704,27 @@ H5C2_flush_cache(H5C2_t * cache_ptr, { flushed_entries_last_pass = FALSE; node_ptr = H5SL_first(cache_ptr->slist_ptr); + if ( node_ptr != NULL ) { + next_entry_ptr = (H5C2_cache_entry_t *)H5SL_item(node_ptr); if ( next_entry_ptr == NULL ) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "next_entry_ptr == NULL 1 ?!?!"); } +#ifndef NDEBUG HDassert( next_entry_ptr->magic == H5C2__H5C2_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); + } else { + next_entry_ptr = NULL; + } HDassert( node_ptr != NULL ); @@ -3742,14 +3803,16 @@ H5C2_flush_cache(H5C2_t * cache_ptr, * If the entry has been evicted, we flag an error and * exit. */ - +#ifndef NDEBUG if ( entry_ptr->magic != H5C2__H5C2_CACHE_ENTRY_T_MAGIC ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "entry_ptr->magic invalid ?!?!"); - } else if ( ( ! entry_ptr->is_dirty ) || - ( ! entry_ptr->in_slist ) ) { + } else +#endif /* NDEBUG */ + if ( ( ! entry_ptr->is_dirty ) || + ( ! entry_ptr->in_slist ) ) { /* the s-list has been modified out from under us. * set node_ptr to NULL and break out of the loop. @@ -3762,15 +3825,20 @@ H5C2_flush_cache(H5C2_t * cache_ptr, * from the slist. */ node_ptr = H5SL_next(node_ptr); + if ( node_ptr != NULL ) { + next_entry_ptr = (H5C2_cache_entry_t *)H5SL_item(node_ptr); if ( next_entry_ptr == NULL ) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "next_entry_ptr == NULL 2 ?!?!"); } +#ifndef NDEBUG HDassert( next_entry_ptr->magic == H5C2__H5C2_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); } else { @@ -3823,6 +3891,7 @@ H5C2_flush_cache(H5C2_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ "dirty pinned entry flush failed.") } + flushed_entries_last_pass = TRUE; } } else { #if H5C2_DO_SANITY_CHECKS @@ -4580,6 +4649,9 @@ done: * JRM -- 10/12/07 * Added initialization for the new magic field. * + * JRM -- 12/31/07 + * Added code supporting flash cache size increases. + * *------------------------------------------------------------------------- */ @@ -4592,6 +4664,7 @@ H5C2_insert_entry(H5C2_t * cache_ptr, void * thing, unsigned int flags) { + /* const char * fcn_name = "H5C2_insert_entry()"; */ herr_t result; herr_t ret_value = SUCCEED; /* Return value */ hbool_t insert_pinned; @@ -4628,9 +4701,9 @@ H5C2_insert_entry(H5C2_t * cache_ptr, insert_pinned = ( (flags & H5C2__PIN_ENTRY_FLAG) != 0 ); entry_ptr = (H5C2_cache_entry_t *)thing; - +#ifndef NDEBUG entry_ptr->magic = H5C2__H5C2_CACHE_ENTRY_T_MAGIC; - +#endif /* NDEBUG */ entry_ptr->addr = addr; entry_ptr->type = type; @@ -4664,6 +4737,19 @@ H5C2_insert_entry(H5C2_t * cache_ptr, H5C2__RESET_CACHE_ENTRY_STATS(entry_ptr) + if ( ( cache_ptr->flash_size_increase_possible ) && + ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { + + result = H5C2__flash_increase_cache_size(cache_ptr, 0, + entry_ptr->size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ + "H5C2__flash_increase_cache_size failed.") + } + } + if ( ( cache_ptr->evictions_enabled ) && ( (cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size ) ) { @@ -5151,10 +5237,13 @@ done: * * Modifications: * - * None + * Added code to do a flash cache size increase if + * appropriate. + * JRM -- 1/11/08 * *------------------------------------------------------------------------- */ + herr_t H5C2_mark_pinned_entry_dirty(H5C2_t * cache_ptr, void * thing, @@ -5162,6 +5251,8 @@ H5C2_mark_pinned_entry_dirty(H5C2_t * cache_ptr, size_t new_size) { herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + size_t size_increase; H5C2_cache_entry_t * entry_ptr; FUNC_ENTER_NOAPI(H5C2_mark_pinned_entry_dirty, FAIL) @@ -5191,10 +5282,33 @@ H5C2_mark_pinned_entry_dirty(H5C2_t * cache_ptr, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C2__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C2__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected entry list */ H5C2__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ - (cache_ptr->pel_size), \ - (entry_ptr->size), (new_size)); + (cache_ptr->pel_size), \ + (entry_ptr->size), (new_size)); /* update the hash table */ H5C2__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\ @@ -5528,7 +5642,9 @@ done: * * Modifications: * - * None + * Added code to apply a flash cache size increment if + * appropriate. + * JRM -- 1/11/08 * *------------------------------------------------------------------------- */ @@ -5537,8 +5653,11 @@ H5C2_resize_pinned_entry(H5C2_t * cache_ptr, void * thing, size_t new_size) { + /* const char * fcn_name = "H5C2_resize_pinned_entry()"; */ herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; H5C2_cache_entry_t * entry_ptr; + size_t size_increase; FUNC_ENTER_NOAPI(H5C2_resize_pinned_entry, FAIL) @@ -5574,6 +5693,29 @@ H5C2_resize_pinned_entry(H5C2_t * cache_ptr, /* update for change in entry size if necessary */ if ( entry_ptr->size != new_size ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C2__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C2__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected entry list */ H5C2__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \ (cache_ptr->pel_size), \ @@ -5761,7 +5903,7 @@ done: * of cache entries. * * JRM -- 7/27/07 - * Added code supporting the new evictions_enabled fieled + * Added code supporting the new evictions_enabled field * in H5C2_t. * * JRM -- 7/11/07 @@ -5771,6 +5913,10 @@ done: * fields. Gained the len parameter. Also internal * changes supporting the revised API. * + * JRM -- 1/3/08 + * Added to do a flash cache size increase if appropriate + * when a large entry is loaded. + * *------------------------------------------------------------------------- */ @@ -5848,6 +5994,22 @@ H5C2_protect(H5C2_t * cache_ptr, entry_ptr = (H5C2_cache_entry_t *)thing; + /* If the entry is very large, and we are configured to allow it, + * we may wish to perform a flash cache size increase. + */ + if ( ( cache_ptr->flash_size_increase_possible ) && + ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { + + result = H5C2__flash_increase_cache_size(cache_ptr, 0, + entry_ptr->size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ + "H5C2__flash_increase_cache_size failed.") + } + } + /* try to free up some space if necessary and if * evictions are permitted */ @@ -6149,6 +6311,10 @@ done: * if the new configuration forces an immediate reduction * in cache size. * + * JRM -- 12/31/07 + * Added code supporting the new flash cache size increase + * code. + * *------------------------------------------------------------------------- */ @@ -6156,6 +6322,7 @@ herr_t H5C2_set_cache_auto_resize_config(H5C2_t * cache_ptr, H5C2_auto_size_ctl_t *config_ptr) { + /* const char *fcn_name = "H5C2_set_cache_auto_resize_config()"; */ herr_t ret_value = SUCCEED; /* Return value */ herr_t result; size_t new_max_cache_size; @@ -6210,8 +6377,10 @@ H5C2_set_cache_auto_resize_config(H5C2_t * cache_ptr, "conflicting threshold fields in new config.") } - cache_ptr->size_increase_possible = TRUE; /* will set to FALSE if needed */ - cache_ptr->size_decrease_possible = TRUE; /* will set to FALSE if needed */ + /* will set the increase possible fields to FALSE later if needed */ + cache_ptr->size_increase_possible = TRUE; + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->size_decrease_possible = TRUE; switch ( config_ptr->incr_mode ) { @@ -6233,6 +6402,11 @@ H5C2_set_cache_auto_resize_config(H5C2_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?.") } + /* logically, this is were configuration for flash cache size increases + * should go. However, this configuration depends on max_cache_size, so + * we wait until the end of the function, when this field is set. + */ + switch ( config_ptr->decr_mode ) { case H5C2_decr__off: @@ -6277,9 +6451,14 @@ H5C2_set_cache_auto_resize_config(H5C2_t * cache_ptr, if ( config_ptr->max_size == config_ptr->min_size ) { cache_ptr->size_increase_possible = FALSE; + cache_ptr->flash_size_increase_possible = FALSE; cache_ptr->size_decrease_possible = FALSE; } + /* flash_size_increase_possible is intentionally omitted from the + * following: + */ + cache_ptr->resize_enabled = cache_ptr->size_increase_possible || cache_ptr->size_decrease_possible; @@ -6367,6 +6546,37 @@ H5C2_set_cache_auto_resize_config(H5C2_t * cache_ptr, } } + /* configure flash size increase facility. We wait until the + * end of the function, as we need the max_cache_size set before + * we start to keep things simple. + * + * If we haven't already ruled out flash cache size increases above, + * go ahead and configure it. + */ + + if ( cache_ptr->flash_size_increase_possible ) { + + switch ( config_ptr->flash_incr_mode ) + { + case H5C2_flash_incr__off: + cache_ptr->flash_size_increase_possible = FALSE; + break; + + case H5C2_flash_incr__add_space: + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + } + done: FUNC_LEAVE_NOAPI(ret_value) @@ -7272,6 +7482,9 @@ done: * *cache_ptr), and one of its dxpl ids. Also internal * changes supporting the revised API. * + * JRM -- 12/31/07 + * Modified funtion to support flash cache resizes. + * *------------------------------------------------------------------------- */ herr_t @@ -7294,6 +7507,8 @@ H5C2_unprotect(H5C2_t * cache_ptr, hbool_t clear_entry = FALSE; #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + size_t size_increase = 0; H5C2_cache_entry_t * entry_ptr; H5C2_cache_entry_t * test_entry_ptr; @@ -7439,6 +7654,29 @@ H5C2_unprotect(H5C2_t * cache_ptr, /* update for change in entry size if necessary */ if ( ( size_changed ) && ( entry_ptr->size != new_size ) ) { + /* do a flash cache size increase if appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + if ( new_size > entry_ptr->size ) { + + size_increase = new_size - entry_ptr->size; + + if ( size_increase >= + cache_ptr->flash_size_increase_threshold ) { + + result = H5C2__flash_increase_cache_size(cache_ptr, + entry_ptr->size, + new_size); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, \ + "H5C2__flash_increase_cache_size failed.") + } + } + } + } + /* update the protected list */ H5C2__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), \ (cache_ptr->pl_size), \ @@ -7614,7 +7852,9 @@ done: * * Modifications: * - * None. + * Added validation for the flash increment fields. + * + * JRM -- 12/31/07 * *------------------------------------------------------------------------- */ @@ -7724,6 +7964,33 @@ H5C2_validate_resize_config(H5C2_auto_size_ctl_t * config_ptr, */ } /* H5C2_incr__threshold */ + switch ( config_ptr->flash_incr_mode ) + { + case H5C2_flash_incr__off: + /* nothing to do here */ + break; + + case H5C2_flash_incr__add_space: + if ( ( config_ptr->flash_multiple < 0.1 ) || + ( config_ptr->flash_multiple > 10.0 ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "flash_multiple must be in the range [0.1, 10.0]"); + } + + if ( ( config_ptr->flash_threshold < 0.1 ) || + ( config_ptr->flash_threshold > 1.0 ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "flash_threshold must be in the range [0.1, 1.0]"); + } + break; + + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "Invalid flash_incr_mode"); + break; + } } /* H5C2_RESIZE_CFG__VALIDATE_INCREMENT */ @@ -7870,6 +8137,9 @@ done: * passed through to other calls, and are no longer * needed. * + * JRM -- 1/5/08 + * Added support for flash cache size increases. + * *------------------------------------------------------------------------- */ @@ -8147,6 +8417,31 @@ H5C2__auto_adjust_cache_size(H5C2_t * cache_ptr, cache_ptr->size_decreased = TRUE; } + + /* update flash cache size increase fields as appropriate */ + if ( cache_ptr->flash_size_increase_possible ) { + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C2_flash_incr__off: + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C2_flash_incr__off?!") + break; + + case H5C2_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + } } if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { @@ -8568,7 +8863,7 @@ H5C2__autoadjust__ageout__evict_aged_out_entries(hid_t dxpl_id, } if ( prev_ptr != NULL ) { - +#ifndef NDEBUG if ( prev_ptr->magic != H5C2__H5C2_CACHE_ENTRY_T_MAGIC ) { /* something horrible has happened to *prev_ptr -- @@ -8577,13 +8872,15 @@ H5C2__autoadjust__ageout__evict_aged_out_entries(hid_t dxpl_id, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "*prev_ptr corrupt") - } else if ( ( prev_ptr->is_dirty != prev_is_dirty ) - || - ( prev_ptr->next != next_ptr ) - || - ( prev_ptr->is_protected ) - || - ( prev_ptr->is_pinned ) ) { + } else +#endif /* NDEBUG */ + if ( ( prev_ptr->is_dirty != prev_is_dirty ) + || + ( prev_ptr->next != next_ptr ) + || + ( prev_ptr->is_protected ) + || + ( prev_ptr->is_pinned ) ) { /* something has happened to the LRU -- start over * from the tail. @@ -8951,6 +9248,177 @@ done: /*------------------------------------------------------------------------- + * + * Function: H5C2__flash_increase_cache_size + * + * Purpose: If there is not at least new_entry_size - old_entry_size + * bytes of free space in the cache and the current + * max_cache_size is less than (cache_ptr->resize_ctl).max_size, + * perform a flash increase in the cache size and then reset + * the full cache hit rate statistics, and exit. + * + * Return: Non-negative on success/Negative on failure. + * + * Programmer: John Mainzer, 12/31/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5C2__flash_increase_cache_size(H5C2_t * cache_ptr, + size_t old_entry_size, + size_t new_entry_size) +{ + /* const char * fcn_name = "H5C2__flash_increase_cache_size()";*/ + herr_t ret_value = SUCCEED; /* Return value */ + size_t new_max_cache_size = 0; + size_t old_max_cache_size = 0; + size_t new_min_clean_size = 0; + size_t old_min_clean_size = 0; + size_t space_needed; + enum H5C2_resize_status status = flash_increase2; /* may change */ + double hit_rate; + + FUNC_ENTER_NOAPI_NOINIT(H5C2__flash_increase_cache_size) + HDassert( cache_ptr ); + HDassert( cache_ptr->magic == H5C2__H5C2_T_MAGIC ); + HDassert( cache_ptr->flash_size_increase_possible ); + HDassert( new_entry_size > cache_ptr->flash_size_increase_threshold ); + HDassert( old_entry_size < new_entry_size ); + + if ( old_entry_size >= new_entry_size ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "old_entry_size >= new_entry_size") + } + + space_needed = new_entry_size - old_entry_size; + + if ( ( (cache_ptr->index_size + space_needed) > + cache_ptr->max_cache_size ) && + ( cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size ) ) { + + /* we have work to do */ + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C2_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C2_flash_incr__off?!") + break; + + case H5C2_flash_incr__add_space: + if ( cache_ptr->index_size < cache_ptr->max_cache_size ) { + + HDassert( (cache_ptr->max_cache_size - + cache_ptr->index_size) + < space_needed ); + space_needed -= cache_ptr->max_cache_size - + cache_ptr->index_size; + } + space_needed = + (size_t)(((double)space_needed) * + (cache_ptr->resize_ctl).flash_multiple); + + new_max_cache_size = cache_ptr->max_cache_size + space_needed; + + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + + if ( new_max_cache_size > (cache_ptr->resize_ctl).max_size ) { + + new_max_cache_size = (cache_ptr->resize_ctl).max_size; + } + + HDassert( new_max_cache_size > cache_ptr->max_cache_size ); + + new_min_clean_size = (size_t) + ((double)new_max_cache_size * + ((cache_ptr->resize_ctl).min_clean_fraction)); + + HDassert( new_min_clean_size <= new_max_cache_size ); + + old_max_cache_size = cache_ptr->max_cache_size; + old_min_clean_size = cache_ptr->min_clean_size; + + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; + + /* update flash cache size increase fields as appropriate */ + HDassert ( cache_ptr->flash_size_increase_possible ); + + switch ( (cache_ptr->resize_ctl).flash_incr_mode ) + { + case H5C2_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "flash_size_increase_possible but H5C2_flash_incr__off?!") + break; + + case H5C2_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t) + (((double)(cache_ptr->max_cache_size)) * + ((cache_ptr->resize_ctl).flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Unknown flash_incr_mode?!?!?.") + break; + } + + /* note that we don't cycle the epoch markers. We can + * argue either way as to whether we should, but for now + * we don't. + */ + + if ( (cache_ptr->resize_ctl).rpt_fcn != NULL ) { + + /* get the hit rate for the reporting function. Should still + * be good as we havent reset the hit rate statistics. + */ + if ( H5C2_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate.") + } + + (*((cache_ptr->resize_ctl).rpt_fcn)) + (cache_ptr, + H5C2__CURR_AUTO_RESIZE_RPT_FCN_VER, + hit_rate, + status, + old_max_cache_size, + new_max_cache_size, + old_min_clean_size, + new_min_clean_size); + } + + if ( H5C2_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) { + + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5C2_reset_cache_hit_rate_stats failed.") + } + } + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C2__flash_increase_cache_size() */ + + + +/*------------------------------------------------------------------------- * Function: H5C2_flush_invalidate_cache * * Purpose: Flush and destroy the entries contained in the target @@ -8991,12 +9459,27 @@ done: * entries being dirtied, resized, and/or renamed inside * flush callbacks. Updated function to support this. * - * -- JRM 8/27/06 - * * Reworked argument list and code to reflect the * removal of the secondary dxpl id, and the decision * to store f in H5C2_t, removing the need to pass it * in all the time. + * -- JRM 8/27/06 + * + * Added code to detect and manage the case in which a + * flush callback changes the s-list out from under + * the function. The only way I can think of in which this + * can happen is if a flush function loads an entry + * into the cache that isn't there already. Quincey tells + * me that this will never happen, but I'm not sure I + * believe him. + * + * Note that this is a pretty bad scenario if it ever + * happens. The code I have added should allow us to + * handle the situation under all but the worst conditions, + * but one can argue that I should just scream and die if I + * ever detect the condidtion. + * + * -- JRM 10/13/07 * *------------------------------------------------------------------------- */ @@ -9112,8 +9595,10 @@ H5C2_flush_invalidate_cache(hid_t dxpl_id, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "next_entry_ptr == NULL 1 ?!?!"); } - - HDassert( next_entry_ptr->magic == H5C2__H5C2_CACHE_ENTRY_T_MAGIC ); +#ifndef NDEBUG + HDassert( next_entry_ptr->magic == + H5C2__H5C2_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); @@ -9180,14 +9665,16 @@ H5C2_flush_invalidate_cache(hid_t dxpl_id, * If the entry has been evicted, we flag an error and * exit. */ - +#ifndef NDEBUG if ( entry_ptr->magic != H5C2__H5C2_CACHE_ENTRY_T_MAGIC ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "entry_ptr->magic is invalid ?!?!"); - } else if ( ( ! entry_ptr->is_dirty ) || - ( ! entry_ptr->in_slist ) ) { + } else +#endif /* NDEBUG */ + if ( ( ! entry_ptr->is_dirty ) || + ( ! entry_ptr->in_slist ) ) { /* the s-list has been modified out from under us. * break out of the loop. @@ -9208,9 +9695,10 @@ H5C2_flush_invalidate_cache(hid_t dxpl_id, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "next_entry_ptr == NULL 2 ?!?!"); } - +#ifndef NDEBUG HDassert( next_entry_ptr->magic == H5C2__H5C2_CACHE_ENTRY_T_MAGIC ); +#endif /* NDEBUG */ HDassert( next_entry_ptr->is_dirty ); HDassert( next_entry_ptr->in_slist ); @@ -9345,15 +9833,15 @@ H5C2_flush_invalidate_cache(hid_t dxpl_id, while ( next_entry_ptr != NULL ) { entry_ptr = next_entry_ptr; - +#ifndef NDEBUG HDassert( entry_ptr->magic == H5C2__H5C2_CACHE_ENTRY_T_MAGIC ); - +#endif /* NDEBUG */ next_entry_ptr = entry_ptr->ht_next; - +#ifndef NDEBUG HDassert ( ( next_entry_ptr == NULL ) || ( next_entry_ptr->magic == H5C2__H5C2_CACHE_ENTRY_T_MAGIC ) ); - +#endif /* NDEBUG */ if ( entry_ptr->is_protected ) { /* we have major problems -- but lets flush and destroy @@ -9405,6 +9893,7 @@ H5C2_flush_invalidate_cache(hid_t dxpl_id, * we are accessing a deallocated piece of dynamically * allocated memory, so we just scream and die. */ +#ifndef NDEBUG if ( ( next_entry_ptr != NULL ) && ( next_entry_ptr->magic != H5C2__H5C2_CACHE_ENTRY_T_MAGIC ) ) { @@ -9415,6 +9904,7 @@ H5C2_flush_invalidate_cache(hid_t dxpl_id, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "next_entry_ptr->magic is invalid?!?!?.") } +#endif /* NDEBUG */ } /* end while loop scanning hash table bin */ } /* end for loop scanning hash table */ @@ -10203,8 +10693,9 @@ H5C2_flush_single_entry(H5F_t * f, * set the magic field to bad magic so we can detect a * freed entry if we see one. */ +#ifndef NDEBUG entry_ptr->magic = H5C2__H5C2_CACHE_ENTRY_T_BAD_MAGIC; - +#endif /* NDEBUG */ if ( type_ptr->free_icr(entry_ptr->addr, entry_ptr->size, (void *)entry_ptr) != SUCCEED ) { @@ -10423,8 +10914,9 @@ H5C2_load_entry(H5F_t * f, HDassert( ( dirty == FALSE ) || ( type->id == 4 ) ); HDassert( entry_ptr->size < H5C2_MAX_ENTRY_SIZE ); - +#ifndef NDEBUG entry_ptr->magic = H5C2__H5C2_CACHE_ENTRY_T_MAGIC; +#endif /* NDEBUG */ entry_ptr->addr = addr; entry_ptr->size = len; entry_ptr->image_ptr = image_ptr; @@ -10547,6 +11039,7 @@ H5C2_make_space_in_cache(hid_t dxpl_id, size_t empty_space; #endif /* H5C2_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ hbool_t prev_is_dirty = FALSE; + hbool_t entry_is_epoch_maker = FALSE; H5C2_cache_entry_t * entry_ptr; H5C2_cache_entry_t * prev_ptr; H5C2_cache_entry_t * next_ptr; @@ -10585,6 +11078,8 @@ H5C2_make_space_in_cache(hid_t dxpl_id, if ( (entry_ptr->type)->id != H5C2__EPOCH_MARKER_TYPE ) { + entry_is_epoch_maker = FALSE; + if ( entry_ptr->is_dirty ) { result = H5C2_flush_single_entry(cache_ptr->f, @@ -10610,6 +11105,7 @@ H5C2_make_space_in_cache(hid_t dxpl_id, /* Skip epoch markers. Set result to SUCCEED to avoid * triggering the error code below. */ + entry_is_epoch_maker = TRUE; result = SUCCEED; } @@ -10620,7 +11116,7 @@ H5C2_make_space_in_cache(hid_t dxpl_id, } if ( prev_ptr != NULL ) { - +#ifndef NDEBUG if ( prev_ptr->magic != H5C2__H5C2_CACHE_ENTRY_T_MAGIC ) { /* something horrible has happened to *prev_ptr -- @@ -10629,6 +11125,16 @@ H5C2_make_space_in_cache(hid_t dxpl_id, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "*prev_ptr corrupt 1") + } else +#endif /* NDEBUG */ + if ( entry_is_epoch_maker ) { + + /* epoch markers don't get flushed, so the sanity checks + * on normal entries will fail -- thus just set entry_ptr + * to prev_ptr and go on. + */ + entry_ptr = prev_ptr; + } else if ( ( prev_ptr->is_dirty != prev_is_dirty ) || ( prev_ptr->next != next_ptr ) @@ -10659,6 +11165,7 @@ H5C2_make_space_in_cache(hid_t dxpl_id, #if H5C2_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + entries_examined = 0; initial_list_len = cache_ptr->dLRU_list_len; entry_ptr = cache_ptr->dLRU_tail_ptr; @@ -10707,7 +11214,7 @@ H5C2_make_space_in_cache(hid_t dxpl_id, } if ( prev_ptr != NULL ) { - +#ifndef NDEBUG if (prev_ptr->magic != H5C2__H5C2_CACHE_ENTRY_T_MAGIC) { /* something horrible has happened to *prev_ptr -- @@ -10717,13 +11224,15 @@ H5C2_make_space_in_cache(hid_t dxpl_id, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "*prev_ptr corrupt 2") - } else if ( ( ! ( prev_ptr->is_dirty ) ) - || - ( prev_ptr->aux_next != next_ptr ) - || - ( prev_ptr->is_protected ) - || - ( prev_ptr->is_pinned ) ) { + } else +#endif /* #ifndef NDEBUG */ + if ( ( ! ( prev_ptr->is_dirty ) ) + || + ( prev_ptr->aux_next != next_ptr ) + || + ( prev_ptr->is_protected ) + || + ( prev_ptr->is_pinned ) ) { /* something has happened to the dirty LRU -- start over * from the tail. diff --git a/src/H5C2journal.c b/src/H5C2journal.c new file mode 100644 index 0000000..bb64f7f --- /dev/null +++ b/src/H5C2journal.c @@ -0,0 +1,519 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5C2journal.c + * Dec 6 2007 + * John Mainzer + * + * Purpose: This file is a general catchall for functions supporting + * metadata journaling. Note that journaling must be tighly + * integrated with the metadata cache, and thus this file only + * contains only that code that can be easily separated from + * the rest of the cache code. + * + * Observe also that to minimize overhead, it is quite possible + * that many of the functions in this file will be converted + * into macros at some point in the future. + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5C2_PACKAGE /*suppress error about including H5C2pkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Opkg.h" /* Object headers */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5C2pkg.h" /* Cache */ + +/**************************************************************************/ +/********************** super block message support ***********************/ +/**************************************************************************/ + +static void * H5O_mdj_conf_decode(H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, + unsigned UNUSED mesg_flags, + const uint8_t *p); + +static herr_t H5O_mdj_conf_encode(H5F_t *f, + hbool_t UNUSED disable_shared, + uint8_t *p, + const void *_mesg); + +static void * H5O_mdj_conf_copy(const void *_mesg, + void *_dest); + +static size_t H5O_mdj_conf_size(const H5F_t UNUSED *f, + hbool_t UNUSED disable_shared, + const void *_mesg); + +static herr_t H5O_mdj_conf_reset(void *_mesg); + +static herr_t H5O_mdj_conf_debug(H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, + const void *_mesg, + FILE *stream, + int indent, + int fwidth); + + +/* This message derives from H5O message class */ +const H5O_msg_class_t H5O_MSG_MDJ_CONF[1] = {{ + H5O_MDJ_CONF_ID, /* message id number */ + "metadata journaling config", /* message name for debugging */ + sizeof(H5O_mdj_conf_t), /* native message size */ + 0, /* messages are sharable? */ + H5O_mdj_conf_decode, /* decode message */ + H5O_mdj_conf_encode, /* encode message */ + H5O_mdj_conf_copy, /* copy the native value */ + H5O_mdj_conf_size, /* raw message size */ + H5O_mdj_conf_reset, /* free internal memory */ + NULL, /* free method */ + NULL, /* file delete method */ + NULL, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + NULL, /* pre copy native value to file */ + NULL, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O_mdj_conf_debug /* debug the message */ +}}; + + +/* Current version of the metadata journaling configuration information */ +#define H5O_MDJ_CONF_VERSION 0 + +#define MDJ_CONF__JOURNALING_ENABLED_FLAG 0x0001 +#define MDJ_CONF__JOURNAL_IS_EXTERNAL_FLAG 0x0002 + + +/*------------------------------------------------------------------------- + * Function: H5O_mdj_conf_decode + * + * Purpose: Decode a journaling configuration message and return a + * pointer to a newly allocated H5O_mdj_conf_t struct. + * + * Return: Success: Ptr to new message in native struct. + * Failure: NULL + * + * Programmer: John Mainzer + * Dec. 14, 2007 + * + *------------------------------------------------------------------------- + */ + +static void * +H5O_mdj_conf_decode(H5F_t *f, + hid_t UNUSED dxpl_id, + unsigned UNUSED mesg_flags, + const uint8_t *p) +{ + const char * fcn_name = "H5O_mdj_conf_decode()"; + uint16_t flags = 0; /* packed boolean fields */ + H5O_mdj_conf_t *mesg; /* Native message */ + void *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5O_btreek_decode) + + HDfprintf(stdout, "%s: entering.\n", fcn_name); + + /* Sanity check */ + HDassert(f); + HDassert(p); + + /* Version of message */ + if ( *p++ != H5O_MDJ_CONF_VERSION ) { + + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, \ + "bad version number for message") + } + + /* Allocate space for message */ + + if( NULL == ( mesg = H5MM_calloc(sizeof(H5O_mdj_conf_t)))) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, \ + "memory allocation failed for metadata journaling config message."); + + } + + /* retrieve packed boolean flags, upack and load them. */ + UINT16DECODE(p, flags); + + if ( (flags & MDJ_CONF__JOURNALING_ENABLED_FLAG) != 0 ) { + + mesg->journaling_enabled = TRUE; + + } else { + + mesg->journaling_enabled = FALSE; + + } + + if ( (flags & MDJ_CONF__JOURNAL_IS_EXTERNAL_FLAG) != 0 ) { + + mesg->journal_is_external = TRUE; + + } else { + + mesg->journal_is_external = FALSE; + + } + + + /* retrieve the internal journal location */ + + H5F_addr_decode(f, &p, &(mesg->internal_journal_loc)); + + + /* retrieve the size of the external journal path buffer */ + + UINT16DECODE(p, mesg->path_len); + + if ( ( ! mesg->journal_is_external ) && + ( mesg->path_len != 0 ) ) { + + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, \ + "internal journal and positive path len?!?"); + + } + + if ( mesg->path_len > 0 ) { + + /* Allocate space for buffer */ + if ( NULL == + (mesg->external_journal_file_path_ptr = + H5MM_malloc(mesg->path_len + 1)) ) { + + mesg = H5MM_xfree(mesg); + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, \ + "memory allocation failed for journal file path buffer") + + } /* end if */ + + /* Copy encoded journal file path info into buffer */ + HDmemcpy(mesg->external_journal_file_path_ptr, p, mesg->path_len); + + } else { + + mesg->external_journal_file_path_ptr = NULL; + + } + + /* Set return value */ + ret_value = (void *)mesg; + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5O_mdj_conf_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_mdj_conf_encode + * + * Purpose: Encode metadata journaling configuration message. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * Dec. 6, 2007 + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5O_mdj_conf_encode(H5F_t *f, + hbool_t UNUSED disable_shared, + uint8_t *p, + const void *_mesg) +{ + const char * fcn_name = "H5O_mdj_conf_encode()"; + const H5O_mdj_conf_t *mesg = (const H5O_mdj_conf_t *)_mesg; + uint16_t flags = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mdj_conf_encode) + + HDfprintf(stdout, "%s: entering.\n", fcn_name); + + /* Sanity check */ + HDassert(f); + HDassert(p); + HDassert(mesg); + + /* setup the flags */ + if ( mesg->journaling_enabled ) { + + flags |= MDJ_CONF__JOURNALING_ENABLED_FLAG; + + } + + if ( mesg->journal_is_external ) { + + flags |= MDJ_CONF__JOURNAL_IS_EXTERNAL_FLAG; + + } + + /* Store version, flags, internal_loc, path_len, & path buffer */ + + *p++ = H5O_MDJ_CONF_VERSION; + + UINT16ENCODE(p, flags); + + H5F_addr_encode(f, &p, mesg->internal_journal_loc); + + HDassert(mesg->path_len <= 65535); + + UINT16ENCODE(p, mesg->path_len); + + if ( mesg->path_len > 0 ) { + + HDmemcpy(p, mesg->external_journal_file_path_ptr, mesg->path_len); + + } + + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* H5O_mdj_conf_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_mdj_conf_copy + * + * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if + * necessary. + * + * Return: Success: Ptr to _DEST + * Failure: NULL + * + * Programmer: Quincey Koziol + * Mar 1, 2007 + * + *------------------------------------------------------------------------- + */ + +static void * +H5O_mdj_conf_copy(const void *_mesg, void *_dest) +{ + const char * fcn_name = "H5O_mdj_conf_copy()"; + const H5O_mdj_conf_t *mesg = (const H5O_mdj_conf_t *)_mesg; + H5O_mdj_conf_t *dest = (H5O_mdj_conf_t *)_dest; + void *ret_value; + + FUNC_ENTER_NOAPI_NOINIT(H5O_mdj_conf_copy) + + HDfprintf(stdout, "%s: entering.\n", fcn_name); + + /* Sanity check */ + HDassert(mesg); + + if ( ( dest == NULL ) && + ( ( NULL == (dest = H5MM_malloc(sizeof(H5O_mdj_conf_t))) ) || + ( ( mesg->path_len > 0 ) && + ( ( NULL == (dest->external_journal_file_path_ptr = + H5MM_malloc(mesg->path_len + 1)) ) ) ) ) ) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, \ + "memory allocation failed for metadata journaling conf message") + + } + + /* now copy the message */ + dest->journaling_enabled = mesg->journaling_enabled; + dest->journal_is_external = mesg->journal_is_external; + dest->internal_journal_loc = mesg->internal_journal_loc; + dest->path_len = mesg->path_len; + + if ( dest->path_len > 0 ) { + + HDmemcpy(dest->external_journal_file_path_ptr, + mesg->external_journal_file_path_ptr, + mesg->path_len); + + } else { + + dest->external_journal_file_path_ptr = NULL; + } + + + /* Set return value */ + ret_value = dest; + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5O_mdj_conf_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_mdj_conf_size + * + * Purpose: Returns the size of the raw message in bytes not counting the + * message type or size fields, but only the data fields. + * + * Return: Success: Message data size in bytes w/o alignment. + * Failure: 0 + * + * Programmer: John Mainzer + * Dec. 12, 2007 + * + *------------------------------------------------------------------------- + */ +static size_t +H5O_mdj_conf_size(const H5F_t *f, + hbool_t UNUSED disable_shared, + const void *_mesg) +{ + const char * fcn_name = "H5O_mdj_conf_size()"; + const H5O_mdj_conf_t * mesg = (const H5O_mdj_conf_t *)_mesg; + size_t ret_value; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mdj_conf_size) + + HDfprintf(stdout, "%s: entering.\n", fcn_name); + + /* Sanity check */ + HDassert(f); + HDassert(mesg); + + ret_value = 1 + /* Version number */ + 2 + /* flags */ + H5F_SIZEOF_ADDR(f) + /* addr of internal journal */ + 2 + /* length of external journal path */ + mesg->path_len; /* external journal path buffer */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5O_mdj_conf_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_mdj_conf_reset + * + * Purpose: Frees internal pointers and resets the message to an + * initial state. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * Dec. 13, 2007 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5O_mdj_conf_reset(void *_mesg) +{ + const char * fcn_name = "H5O_mdj_conf_reset()"; + H5O_mdj_conf_t *mesg = (H5O_mdj_conf_t *) _mesg; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mdj_conf_reset); + + HDfprintf(stdout, "%s: entering.\n", fcn_name); + + /* check args */ + assert(mesg); + + /* reset */ + if ( mesg->external_journal_file_path_ptr != NULL ) + { + HDassert( mesg->path_len > 0 ); + HDassert( mesg->journal_is_external ); + mesg->external_journal_file_path_ptr = + H5MM_xfree(mesg->external_journal_file_path_ptr); + mesg->path_len = 0; + } + + FUNC_LEAVE_NOAPI(SUCCEED); + +} /* H5O_mdj_conf_reset() */ + + +/*------------------------------------------------------------------------- + * Function: H5O_mdj_conf_debug + * + * Purpose: Prints debugging info for the message. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * Dec. 7, 2007 + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5O_mdj_conf_debug(H5F_t UNUSED *f, + hid_t UNUSED dxpl_id, + const void *_mesg, + FILE *stream, + int indent, + int fwidth) +{ + const char * fcn_name = "H5O_mdj_conf_debug()"; + const H5O_mdj_conf_t *mesg = (const H5O_mdj_conf_t *)_mesg; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_btreek_debug) + + HDfprintf(stdout, "%s: entering.\n", fcn_name); + + /* Sanity check */ + HDassert(f); + HDassert(mesg); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + + HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, + "journaling_enabled:", + (int)(mesg->journaling_enabled)); + + HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, + "journal_is_external:", + (int)(mesg->journal_is_external)); + + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + "internal_journal_loc:", + mesg->internal_journal_loc); + + HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, + "path_len:", + (int)(mesg->path_len)); + + if ( mesg->path_len > 0 ) { + + HDfprintf(stream, "%*s%-*s \"%s\"\n", indent, "", fwidth, + "external_journal_file_path_ptr:", + (char *)(mesg->external_journal_file_path_ptr)); + + } + + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* end H5O_mdj_conf_debug() */ diff --git a/src/H5C2pkg.h b/src/H5C2pkg.h index a1753b4..71c8e15 100644 --- a/src/H5C2pkg.h +++ b/src/H5C2pkg.h @@ -471,6 +471,18 @@ * all the ways this can happen, we simply set this flag when * we receive a new configuration. * + * flash_size_increase_possible: Depending on the configuration data given + * in the resize_ctl field, it may or may not be possible + * for a flash size increase to occur. We set this flag + * whenever we receive a new configuration so as to avoid + * repeated calculations. + * + * flash_size_increase_threshold: If a flash cache size increase is possible, + * this field is used to store the minimum size of a new entry + * or size increase needed to trigger a flash cache size + * increase. Note that this field must be updated whenever + * the size of the cache is changed. + * * size_decrease_possible: Depending on the configuration data given * in the resize_ctl field, it may or may not be possible * to decrease the size of the cache. Rather than test for @@ -863,6 +875,8 @@ struct H5C2_t H5C2_cache_entry_t * dLRU_tail_ptr; hbool_t size_increase_possible; + hbool_t flash_size_increase_possible; + size_t flash_size_increase_threshold; hbool_t size_decrease_possible; hbool_t resize_enabled; hbool_t cache_full; diff --git a/src/H5C2private.h b/src/H5C2private.h index a949f6d..b70e968 100644 --- a/src/H5C2private.h +++ b/src/H5C2private.h @@ -804,12 +804,16 @@ typedef herr_t (*H5C2_log_flush_func_t)(H5C2_t * cache_ptr, * ****************************************************************************/ +#ifndef NDEBUG #define H5C2__H5C2_CACHE_ENTRY_T_MAGIC 0x005CAC0A #define H5C2__H5C2_CACHE_ENTRY_T_BAD_MAGIC 0xDeadBeef +#endif /* NDEBUG */ typedef struct H5C2_cache_entry_t { +#ifndef NDEBUG uint32_t magic; +#endif /* NDEBUG */ haddr_t addr; size_t size; void * image_ptr; @@ -954,6 +958,57 @@ typedef struct H5C2_cache_entry_t * above, this field contains the maximum number of bytes by which the * cache size can be increased in a single re-size. * + * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by what algorithm we should + * make flash increases in the size of the cache to accomodate insertion + * of large entries and large increases in the size of a single entry. + * + * The addition of the flash increment mode was occasioned by performance + * problems that appear when a local heap is increased to a size in excess + * of the current cache size. While the existing re-size code dealt with + * this eventually, performance was very bad for the remainder of the + * epoch. + * + * At present, there are two possible values for the flash_incr_mode: + * + * H5C_flash_incr__off: Don't perform flash increases in the size of + * the cache. + * + * H5C_flash_incr__add_space: Let x be either the size of a newly + * newly inserted entry, or the number of bytes by which the + * size of an existing entry has been increased. + * + * If + * x > flash_threshold * current max cache size, + * + * increase the current maximum cache size by x * flash_multiple + * less any free space in the cache, and start a new epoch. For + * now at least, pay no attention to the maximum increment. + * + * + * With a little thought, it should be obvious that the above flash + * cache size increase algorithm is not sufficient for all + * circumstances -- for example, suppose the user round robins through + * (1/flash_threshold) +1 groups, adding one data set to each on each + * pass. Then all will increase in size at about the same time, requiring + * the max cache size to at least double to maintain acceptable + * performance, however the above flash increment algorithm will not be + * triggered. + * + * Hopefully, the add space algorithm detailed above will be sufficient + * for the performance problems encountered to date. However, we should + * expect to revisit the issue. + * + * flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. This field is ignored unless flash_incr_mode + * is H5C_flash_incr__add_space. + * + * flash_threshold: Double containing the factor by which current max cache + * size is multiplied to obtain the size threshold for the add_space + * flash increment algorithm. The field is ignored unless + * flash_incr_mode is H5C2_flash_incr__add_space. + * * * Cache size decrease control fields: * @@ -1068,6 +1123,8 @@ typedef struct H5C2_cache_entry_t #define H5C2__DEF_AR_MIN_CLEAN_FRAC 0.5 #define H5C2__DEF_AR_INCREMENT 2.0 #define H5C2__DEF_AR_MAX_INCREMENT ((size_t)( 2 * 1024 * 1024)) +#define H5C2__DEF_AR_FLASH_MULTIPLE 1.0 +#define H5C2__DEV_AR_FLASH_THRESHOLD 0.25 #define H5C2__DEF_AR_DECREMENT 0.9 #define H5C2__DEF_AR_MAX_DECREMENT ((size_t)( 1 * 1024 * 1024)) #define H5C2__DEF_AR_EPCHS_B4_EVICT 3 @@ -1080,6 +1137,7 @@ enum H5C2_resize_status { in_spec2, increase2, + flash_increase2, decrease2, at_max_size2, at_min_size2, @@ -1100,45 +1158,49 @@ typedef void (*H5C2_auto_resize_rpt_fcn)(H5C2_t * cache_ptr, typedef struct H5C2_auto_size_ctl_t { /* general configuration fields: */ - int32_t version; - H5C2_auto_resize_rpt_fcn rpt_fcn; + int32_t version; + H5C2_auto_resize_rpt_fcn rpt_fcn; - hbool_t set_initial_size; - size_t initial_size; + hbool_t set_initial_size; + size_t initial_size; - double min_clean_fraction; + double min_clean_fraction; - size_t max_size; - size_t min_size; + size_t max_size; + size_t min_size; - int64_t epoch_length; + int64_t epoch_length; /* size increase control fields: */ - enum H5C2_cache_incr_mode incr_mode; + enum H5C2_cache_incr_mode incr_mode; + + double lower_hr_threshold; - double lower_hr_threshold; + double increment; - double increment; + hbool_t apply_max_increment; + size_t max_increment; - hbool_t apply_max_increment; - size_t max_increment; + enum H5C2_cache_flash_incr_mode flash_incr_mode; + double flash_multiple; + double flash_threshold; /* size decrease control fields: */ - enum H5C2_cache_decr_mode decr_mode; + enum H5C2_cache_decr_mode decr_mode; - double upper_hr_threshold; + double upper_hr_threshold; - double decrement; + double decrement; - hbool_t apply_max_decrement; - size_t max_decrement; + hbool_t apply_max_decrement; + size_t max_decrement; - int32_t epochs_before_eviction; + int32_t epochs_before_eviction; - hbool_t apply_empty_reserve; - double empty_reserve; + hbool_t apply_empty_reserve; + double empty_reserve; } H5C2_auto_size_ctl_t; diff --git a/src/H5C2public.h b/src/H5C2public.h index e1adff3..d293ccb 100644 --- a/src/H5C2public.h +++ b/src/H5C2public.h @@ -41,6 +41,13 @@ enum H5C2_cache_incr_mode H5C2_incr__threshold }; +enum H5C2_cache_flash_incr_mode +{ + H5C2_flash_incr__off, + H5C2_flash_incr__add_space +}; + + enum H5C2_cache_decr_mode { H5C2_decr__off, diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 949f923..7c04ea2 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -465,6 +465,18 @@ * all the ways this can happen, we simply set this flag when * we receive a new configuration. * + * flash_size_increase_possible: Depending on the configuration data given + * in the resize_ctl field, it may or may not be possible + * for a flash size increase to occur. We set this flag + * whenever we receive a new configuration so as to avoid + * repeated calculations. + * + * flash_size_increase_threshold: If a flash cache size increase is possible, + * this field is used to store the minimum size of a new entry + * or size increase needed to trigger a flash cache size + * increase. Note that this field must be updated whenever + * the size of the cache is changed. + * * size_decrease_possible: Depending on the configuration data given * in the resize_ctl field, it may or may not be possible * to decrease the size of the cache. Rather than test for @@ -580,10 +592,10 @@ * equal to the array index has not been in cache when * requested in the current epoch. * - * write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type id - * equal to the array index has been write protected in the - * current epoch. + * write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The + * cells are used to record the number of times an entry with + * type id equal to the array index has been write protected + * in the current epoch. * * Observe that (hits + misses) = (write_protects + read_protects). * @@ -855,6 +867,8 @@ struct H5C_t H5C_cache_entry_t * dLRU_tail_ptr; hbool_t size_increase_possible; + hbool_t flash_size_increase_possible; + size_t flash_size_increase_threshold; hbool_t size_decrease_possible; hbool_t resize_enabled; hbool_t cache_full; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index d365755..53dcf0d 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -202,6 +202,27 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t * cache_ptr, * * JRM - 4/26/04 * + * magic: Unsigned 32 bit integer that must always be set to + * H5C__H5C_CACHE_ENTRY_T_MAGIC when the entry is valid. + * The field must be set to H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC + * just before the entry is freed. + * + * This is necessary, as the LRU list can be changed out + * from under H5C_make_space_in_cache() by the flush + * callback which may change the size of an existing entry, + * and/or load a new entry while serializing the target entry. + * + * This in turn can cause a recursive call to + * H5C_make_space_in_cache() which may either flush or evict + * the next entry that the first invocation of that function + * was about to examine. + * + * The magic field allows H5C_make_space_in_cache() to + * detect this case, and re-start its scan from the bottom + * of the LRU when this situation occurs. + * + * This field is only compiled in debug mode. + * * addr: Base address of the cache entry on disk. * * size: Length of the cache entry on disk. Note that unlike normal @@ -442,8 +463,16 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t * cache_ptr, * ****************************************************************************/ +#ifndef NDEBUG +#define H5C__H5C_CACHE_ENTRY_T_MAGIC 0x005CAC0A +#define H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC 0xDeadBeef +#endif /* NDEBUG */ + typedef struct H5C_cache_entry_t { +#ifndef NDEBUG + uint32_t magic; +#endif /* NDEBUG */ haddr_t addr; size_t size; const H5C_class_t * type; @@ -587,7 +616,58 @@ typedef struct H5C_cache_entry_t * above, this field contains the maximum number of bytes by which the * cache size can be increased in a single re-size. * - * + * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated + * type whose value indicates whether and by what algorithm we should + * make flash increases in the size of the cache to accomodate insertion + * of large entries and large increases in the size of a single entry. + * + * The addition of the flash increment mode was occasioned by performance + * problems that appear when a local heap is increased to a size in excess + * of the current cache size. While the existing re-size code dealt with + * this eventually, performance was very bad for the remainder of the + * epoch. + * + * At present, there are two possible values for the flash_incr_mode: + * + * H5C_flash_incr__off: Don't perform flash increases in the size of + * the cache. + * + * H5C_flash_incr__add_space: Let x be either the size of a newly + * newly inserted entry, or the number of bytes by which the + * size of an existing entry has been increased. + * + * If + * x > flash_threshold * current max cache size, + * + * increase the current maximum cache size by x * flash_multiple + * less any free space in the cache, and start a new epoch. For + * now at least, pay no attention to the maximum increment. + * + * + * With a little thought, it should be obvious that the above flash + * cache size increase algorithm is not sufficient for all circumstances -- + * for example, suppose the user round robins through + * (1/flash_threshold) +1 groups, adding one data set to each on each + * pass. Then all will increase in size at about the same time, requiring + * the max cache size to at least double to maintain acceptable + * performance, however the above flash increment algorithm will not be + * triggered. + * + * Hopefully, the add space algorithm detailed above will be sufficient + * for the performance problems encountered to date. However, we should + * expect to revisit the issue. + * + * flash_multiple: Double containing the multiple described above in the + * H5C_flash_incr__add_space section of the discussion of the + * flash_incr_mode section. This field is ignored unless flash_incr_mode + * is H5C_flash_incr__add_space. + * + * flash_threshold: Double containing the factor by which current max cache size + * is multiplied to obtain the size threshold for the add_space flash + * increment algorithm. The field is ignored unless flash_incr_mode is + * H5C_flash_incr__add_space. + * + * * Cache size decrease control fields: * * decr_mode: Instance of the H5C_cache_decr_mode enumerated type whose @@ -701,6 +781,8 @@ typedef struct H5C_cache_entry_t #define H5C__DEF_AR_MIN_CLEAN_FRAC 0.5 #define H5C__DEF_AR_INCREMENT 2.0 #define H5C__DEF_AR_MAX_INCREMENT ((size_t)( 2 * 1024 * 1024)) +#define H5C__DEF_AR_FLASH_MULTIPLE 1.0 +#define H5C__DEV_AR_FLASH_THRESHOLD 0.25 #define H5C__DEF_AR_DECREMENT 0.9 #define H5C__DEF_AR_MAX_DECREMENT ((size_t)( 1 * 1024 * 1024)) #define H5C__DEF_AR_EPCHS_B4_EVICT 3 @@ -713,6 +795,7 @@ enum H5C_resize_status { in_spec, increase, + flash_increase, decrease, at_max_size, at_min_size, @@ -733,45 +816,48 @@ typedef void (*H5C_auto_resize_rpt_fcn)(H5C_t * cache_ptr, typedef struct H5C_auto_size_ctl_t { /* general configuration fields: */ - int32_t version; - H5C_auto_resize_rpt_fcn rpt_fcn; + int32_t version; + H5C_auto_resize_rpt_fcn rpt_fcn; - hbool_t set_initial_size; - size_t initial_size; + hbool_t set_initial_size; + size_t initial_size; - double min_clean_fraction; + double min_clean_fraction; - size_t max_size; - size_t min_size; + size_t max_size; + size_t min_size; - int64_t epoch_length; + int64_t epoch_length; /* size increase control fields: */ - enum H5C_cache_incr_mode incr_mode; + enum H5C_cache_incr_mode incr_mode; - double lower_hr_threshold; + double lower_hr_threshold; - double increment; + double increment; - hbool_t apply_max_increment; - size_t max_increment; + hbool_t apply_max_increment; + size_t max_increment; + enum H5C_cache_flash_incr_mode flash_incr_mode; + double flash_multiple; + double flash_threshold; /* size decrease control fields: */ - enum H5C_cache_decr_mode decr_mode; + enum H5C_cache_decr_mode decr_mode; - double upper_hr_threshold; + double upper_hr_threshold; - double decrement; + double decrement; - hbool_t apply_max_decrement; - size_t max_decrement; + hbool_t apply_max_decrement; + size_t max_decrement; - int32_t epochs_before_eviction; + int32_t epochs_before_eviction; - hbool_t apply_empty_reserve; - double empty_reserve; + hbool_t apply_empty_reserve; + double empty_reserve; } H5C_auto_size_ctl_t; diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h index 082d512..7ef959a 100644 --- a/src/H5Cpublic.h +++ b/src/H5Cpublic.h @@ -41,6 +41,12 @@ enum H5C_cache_incr_mode H5C_incr__threshold }; +enum H5C_cache_flash_incr_mode +{ + H5C_flash_incr__off, + H5C_flash_incr__add_space +}; + enum H5C_cache_decr_mode { H5C_decr__off, diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 3e13b0d..5c54fdd 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -113,6 +113,11 @@ typedef struct H5F_file_t { struct H5G_t *root_grp; /* Open root group */ H5FO_t *open_objs; /* Open objects in file */ H5RC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + hbool_t journaling_enabled; /* metadata journaling configuration */ + hbool_t journal_is_external; /* fields. All fields as per those */ + haddr_t internal_journal_loc;/* of the same name in M5O_mdj_conf_t. */ + size_t path_len; + uint8_t * external_journal_file_path_ptr; } H5F_file_t; /* A record of the mount table */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index cbc5f72..ed3395e 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -33,6 +33,8 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5MMprivate.h" /* Memory management */ + /****************/ @@ -226,6 +228,12 @@ done: * wendling@ncsa.uiuc.edu * Sept 12, 2003 * + * Changes: Johm Mainzer + * 12/14/07 + * Added code to read in the metadata journaling config + * if it is present, and to initialize + * f->shared->journaling_enabled to FALSE if it isn't. + * *------------------------------------------------------------------------- */ herr_t @@ -251,6 +259,14 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) shared = f->shared; lf = shared->lf; + /* initialize the metadata journaling configuration sections of the + * super block to indicate that journaling is not turned on at + * present. These initialization may be overridden shortly. + */ + shared->journaling_enabled = FALSE; + shared->path_len = 0; + shared->external_journal_file_path_ptr = NULL; + /* Get the shared file creation property list */ if(NULL == (c_plist = H5I_object(shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") @@ -553,6 +569,9 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) H5O_loc_t ext_loc; /* "Object location" for superblock extension */ H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */ H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */ + H5O_mdj_conf_t mdj_conf;/* metadata journaling config message + * from superblock extension + */ /* Sanity check - superblock extension should only be defined for * superblock version >= 2. @@ -617,6 +636,48 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); } /* end else */ + /* Read in the metadata journaling configuration message, + * if it exists. + */ + if(NULL == H5O_msg_read(&ext_loc, H5O_MDJ_CONF_ID, &mdj_conf, dxpl_id)) { + /* Reset error from "failed" message read */ + H5E_clear_stack(NULL); + } /* end if */ + else { + + shared->journaling_enabled = mdj_conf.journaling_enabled; + + if ( shared->journaling_enabled ) { + + shared->journal_is_external = mdj_conf.journal_is_external; + shared->internal_journal_loc = mdj_conf.internal_journal_loc; + shared->path_len = mdj_conf.path_len; + shared->external_journal_file_path_ptr = + mdj_conf.external_journal_file_path_ptr; + + /* for now at least, the journal file must always be + * external -- hence the following asserts. Remove them + * if we ever support an internal journal. + */ + HDassert( shared->journal_is_external ); + HDassert( shared->path_len > 0 ); + HDassert( shared->external_journal_file_path_ptr != NULL ); + + /* if there is a an external journal file, + * H5O_mdj_conf_decode() will allocate a buffer to + * store it in. Rather than allocate our own buffer, + * we will use the one created by H5O_mdj_conf_decode(), + * and modify mdj_conf so that H5O_mdj_conf_reset() will + * not discard it. + */ + mdj_conf.path_len = 0; + mdj_conf.external_journal_file_path_ptr = NULL; + } + + /* Reset metadata journaling config message */ + H5O_msg_reset(H5O_MDJ_CONF_ID, &mdj_conf); + } + /* Close the extension. Twiddle the number of open objects to avoid * closing the file (since this will be the only open object). */ @@ -645,6 +706,13 @@ done: * koziol@ncsa.uiuc.edu * Sept 15, 2003 * + * Changes: John Mainzer + * Dec. 14, 2007 + * Added initialization for the metadata journaling + * configuration fields. By default, these fields are + * initialized to indicate that we are not journaling + * metadata. + * *------------------------------------------------------------------------- */ herr_t @@ -802,6 +870,43 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") } /* end if */ + /* check for journaling config data to store */ + if ( f->shared->journaling_enabled ) { + + struct H5O_mdj_conf_t mdj_conf; + + mdj_conf.journaling_enabled = f->shared->journaling_enabled; + mdj_conf.journal_is_external = f->shared->journal_is_external; + mdj_conf.internal_journal_loc = f->shared->internal_journal_loc; + mdj_conf.path_len = f->shared->path_len; + + if ( f->shared->external_journal_file_path_ptr == NULL ) { + + mdj_conf.external_journal_file_path_ptr = NULL; + + } else { + + if ( ( NULL == (mdj_conf.external_journal_file_path_ptr = + H5MM_malloc(mdj_conf.path_len + 1)) ) ) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ + "memory alloc failed for mdj path") + + } + HDmemcpy(mdj_conf.external_journal_file_path_ptr, + f->shared->external_journal_file_path_ptr, + f->shared->path_len); + } + + if ( H5O_msg_create(&ext_loc, H5O_MDJ_CONF_ID, + H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, + H5O_UPDATE_TIME, &mdj_conf, dxpl_id) < 0 ) { + + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, \ + "unable to update metadata journal conf header message") + } + } + /* Twiddle the number of open objects to avoid closing the file * (since this will be the only open object currently). */ @@ -77,6 +77,10 @@ static herr_t H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type); /*********************/ /* Header message ID to class mapping */ + +/* Remember to increment H5O_MSG_TYPES in H5Opkg.h when adding a new + * message. + */ const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_NULL, /*0x0000 Null */ H5O_MSG_SDSPACE, /*0x0001 Dataspace */ @@ -105,9 +109,12 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_DRVINFO, /*0x0014 Driver info settings */ H5O_MSG_AINFO, /*0x0015 Attribute information */ H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ - H5O_MSG_UNKNOWN, /*0x0017 Placeholder for unknown message */ + H5O_MSG_MDJ_CONF, /*0x0017 Metadata journaling config */ + H5O_MSG_UNKNOWN, /*0x0018 Placeholder for unknown message */ }; +/* HDassert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); */ + /* Header object ID to class mapping */ /* * Initialize the object class info table. Begin with the most general types @@ -157,6 +164,10 @@ H5FL_EXTERN(time_t); * Programmer: Quincey Koziol * Thursday, January 18, 2007 * + * Changes: JRM -- 12/12/07 + * Added santity check verifying that H5O_msg_class_g + * is big enough. + * *------------------------------------------------------------------------- */ static herr_t @@ -168,6 +179,8 @@ H5O_init_interface(void) HDassert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g)); HDassert(sizeof(H5O_fheap_id_t) == H5O_FHEAP_ID_LEN); + HDassert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_init_interface() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index c90ff0a..94af802 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -30,7 +30,7 @@ #define H5O_NMESGS 8 /*initial number of messages */ #define H5O_NCHUNKS 2 /*initial number of chunks */ #define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */ -#define H5O_MSG_TYPES 24 /* # of types of messages */ +#define H5O_MSG_TYPES 25 /* # of types of messages */ #define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */ /* Versions of object header structure */ @@ -431,7 +431,10 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_AINFO[1]; /* Reference Count Message. (0x0016) */ H5_DLLVAR const H5O_msg_class_t H5O_MSG_REFCOUNT[1]; -/* Placeholder for unknown message. (0x0017) */ +/* Metadata Journaling Config Message. (0x0017) */ +H5_DLLVAR const H5O_msg_class_t H5O_MSG_MDJ_CONF[1]; + +/* Placeholder for unknown message. (0x0018) */ H5_DLLVAR const H5O_msg_class_t H5O_MSG_UNKNOWN[1]; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 31738a9..3188468 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -62,6 +62,8 @@ typedef struct H5O_t H5O_t; #define H5O_FHEAP_MAX_MAN_SIZE (4 * 1024) #define H5O_FHEAP_ID_LEN 8 +/* #define H5O_ENABLE_BOGUS 1 */ + /* Object header macros */ #define H5O_MESG_MAX_SIZE 65536 /*max obj header message size */ #define H5O_ALL (-1) /* Operate on all messages of type */ @@ -160,7 +162,8 @@ typedef struct H5O_copy_t { #define H5O_DRVINFO_ID 0x0014 /* Driver info message. */ #define H5O_AINFO_ID 0x0015 /* Attribute info message. */ #define H5O_REFCOUNT_ID 0x0016 /* Reference count message. */ -#define H5O_UNKNOWN_ID 0x0017 /* Placeholder message ID for unknown message. */ +#define H5O_MDJ_CONF_ID 0x0017 /* Metadata journaling config message */ +#define H5O_UNKNOWN_ID 0x0018 /* Placeholder message ID for unknown message. */ /* (this should never exist in a file) */ @@ -491,6 +494,60 @@ typedef struct H5O_ainfo_t { */ typedef uint32_t H5O_refcount_t; /* Contains # of links to object, if >1 */ + +/* + * Metadata journaling configuration message + * + * Information on whether and how metadata changes are being journaled, + * so as to reconstruct consistent metadata in the file in the event of + * a crash, stored in a superblock extension + * (Data structure in memory) + * + * The fields of the H5O_mdj_conf_t structure are discussed individually + * below: + * + * journaling_enabled: Boolean flag indicating whether metadata journaling + * is currently enabled. + * + * journal_is_external: Boolean flag indicating whether the journal is + * stored in an external file, or within the HDF5 file. + * + * If the field is TRUE, external_journal_file_path points to a + * buffer containing the path to the external journal file, and + * internal_journal_loc is undefined. + * + * If the field is FALSE, internal_journal_loc contains the base + * address of the journal within the hdf5 file, and + * external_journal_file_path_ptr must be NULL. + * + * At least for the initial implementation, journal_is_external + * will always be TRUE. + * + * internal_journal_loc: haddr_t containing the base address of the + * interal journal -- if there is one, or undefined if there + * isn't (see discussion of journal_is_external above). + * + * path_len: size_t containing the size of the buffer needed to + * contain the path to the external journal file. This field + * must contain 0 if the journal is internal. + * + * external_journal_file_path_ptr: Pointer to uint8_t. If the + * journal is stored in an external file, this field points to + * a buffer containing the path to this file. + * + * If the journal is internal, this field must be NULL. + */ +typedef struct H5O_mdj_conf_t { + + hbool_t journaling_enabled; + hbool_t journal_is_external; + haddr_t internal_journal_loc; + size_t path_len; + uint8_t * external_journal_file_path_ptr; + +} H5O_mdj_conf_t; + + /* * "Unknown" Message. * (Data structure in memory) diff --git a/src/Makefile.am b/src/Makefile.am index 7319c1c..19fde87 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,7 +45,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ H5AC.c H5AC2.c H5B.c H5Bcache.c \ H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2stat.c H5B2test.c \ - H5C.c H5C2.c H5CS.c \ + H5C.c H5C2.c H5C2journal.c H5CS.c \ H5D.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \ H5Dio.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 61bcbd8..a65324e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -82,43 +82,44 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5timer.lo H5trace.lo H5A.lo H5Abtree2.lo H5Adense.lo \ H5Adeprec.lo H5Aint.lo H5Atest.lo H5AC.lo H5AC2.lo H5B.lo \ H5Bcache.lo H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2int.lo \ - H5B2stat.lo H5B2test.lo H5C.lo H5C2.lo H5CS.lo H5D.lo \ - H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo H5Defl.lo \ - H5Dfill.lo H5Dint.lo H5Dio.lo H5Distore.lo H5Dmpio.lo H5Doh.lo \ - H5Dselect.lo H5Dtest.lo H5E.lo H5Edeprec.lo H5Eint.lo H5F.lo \ - H5Fdbg.lo H5Ffake.lo H5Fmount.lo H5Fsfile.lo H5Fsuper.lo \ - H5Ftest.lo H5FD.lo H5FDcore.lo H5FDdirect.lo H5FDfamily.lo \ - H5FDlog.lo H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \ - H5FDsec2.lo H5FDstdio.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo \ - H5FSdbg.lo H5FSsection.lo H5G.lo H5Gbtree2.lo H5Gcompact.lo \ - H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo \ - H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Gstab.lo \ - H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \ - H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \ - H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \ - H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \ - H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo H5L.lo \ - H5Lexternal.lo H5MF.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \ - H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \ - H5Obtreek.lo H5Ocache.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo \ - H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo \ - H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \ - H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ - H5Oshared.lo H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5Ounknown.lo \ - H5P.lo H5Pacpl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo \ - H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo \ - H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo \ - H5Ptest.lo H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo H5S.lo \ - H5Sall.lo H5Sdbg.lo H5Shyper.lo H5Smpio.lo H5Snone.lo \ - H5Spoint.lo H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo \ - H5SMbtree2.lo H5SMcache.lo H5SMtest.lo H5ST.lo H5T.lo \ - H5Tarray.lo H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo \ - H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo \ - H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo \ - H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo \ - H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo H5TS.lo H5V.lo H5WB.lo \ - H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ - H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo + H5B2stat.lo H5B2test.lo H5C.lo H5C2.lo H5C2journal.lo H5CS.lo \ + H5D.lo H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo \ + H5Defl.lo H5Dfill.lo H5Dint.lo H5Dio.lo H5Distore.lo \ + H5Dmpio.lo H5Doh.lo H5Dselect.lo H5Dtest.lo H5E.lo \ + H5Edeprec.lo H5Eint.lo H5F.lo H5Fdbg.lo H5Ffake.lo H5Fmount.lo \ + H5Fsfile.lo H5Fsuper.lo H5Ftest.lo H5FD.lo H5FDcore.lo \ + H5FDdirect.lo H5FDfamily.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \ + H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDstdio.lo H5FL.lo \ + H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo H5FSsection.lo H5G.lo \ + H5Gbtree2.lo H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo \ + H5Gint.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \ + H5Goh.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \ + H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \ + H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \ + H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \ + H5HFtiny.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo \ + H5I.lo H5L.lo H5Lexternal.lo H5MF.lo H5MM.lo H5MP.lo \ + H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \ + H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \ + H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo \ + H5Oefl.lo H5Ofill.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo \ + H5Olink.lo H5Omessage.lo H5Omtime.lo H5Oname.lo H5Onull.lo \ + H5Opline.lo H5Orefcount.lo H5Osdspace.lo H5Oshared.lo \ + H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5Ounknown.lo H5P.lo \ + H5Pacpl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo H5Pfapl.lo \ + H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo H5Plapl.lo \ + H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo \ + H5R.lo H5Rdeprec.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo \ + H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \ + H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo \ + H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo \ + H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo \ + H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo \ + H5Tnative.lo H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo \ + H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo \ + H5TS.lo H5V.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \ + H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \ + H5Ztrans.lo libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) libhdf5_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -402,7 +403,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ H5AC.c H5AC2.c H5B.c H5Bcache.c \ H5B2.c H5B2cache.c H5B2dbg.c H5B2int.c H5B2stat.c H5B2test.c \ - H5C.c H5C2.c H5CS.c \ + H5C.c H5C2.c H5C2journal.c H5CS.c \ H5D.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \ H5Dio.c \ @@ -601,6 +602,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Bcache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C2journal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5CS.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5D.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dcompact.Plo@am__quote@ diff --git a/test/cache.c b/test/cache.c index a0bc5b1..6ea92ef 100644 --- a/test/cache.c +++ b/test/cache.c @@ -965,6 +965,11 @@ smoke_check_5(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1200,6 +1205,11 @@ smoke_check_6(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1435,6 +1445,11 @@ smoke_check_7(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (8 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, @@ -1671,6 +1686,11 @@ smoke_check_8(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, @@ -17295,6 +17315,10 @@ check_check_evictions_enabled_err(void) * * Modifications: * + * John Mainzer 1/8/08 + * Added a basic set of tests for the flash cache size + * increment code. + * *------------------------------------------------------------------------- */ @@ -17304,7 +17328,7 @@ enum H5C_resize_status rpt_status; static void test_rpt_fcn(UNUSED H5C_t * cache_ptr, UNUSED int32_t version, UNUSED double hit_rate, - UNUSED enum H5C_resize_status status, + enum H5C_resize_status status, UNUSED size_t old_max_cache_size, UNUSED size_t new_max_cache_size, UNUSED size_t old_min_clean_size, @@ -17348,6 +17372,11 @@ check_auto_cache_resize(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -17708,7 +17737,7 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* the current cache configuration is unconvenient for testing cache + /* the current cache configuration is inconvenient for testing cache * size reduction, so lets change it some something easier to work * with. */ @@ -17738,6 +17767,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1000 * 1000); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -18088,6 +18121,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -18276,6 +18313,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -18699,6 +18740,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -19239,6 +19284,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -19663,6 +19712,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -19929,6 +19982,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -20465,6 +20522,1110 @@ check_auto_cache_resize(void) takedown_cache(cache_ptr, FALSE, FALSE); } + /* now test the flash cache size increment code. At least at present, + * there should be no interaction between the regular auto-resize + * code and the flash cache size increment code other than a reset + * of the counter and stats collection used by the regular auto-resize + * code. Thus we do only limited tests of the two pieces of code + * operating together. + * + * Start with simple test to verify that the flash cache increment + * code increases the cache size when and as expected. + */ + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* allocate a cache, enable the flash cache size increase code, and + * then force the flash size increase code through all its operational + * modes. Verify that all performs as expected. + */ + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* now repeat the above tests using the add space flash cache size + * increment algorithm. + */ + + if ( pass ) { + + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 64 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 1024 * 1024; + auto_size_ctl.min_size = 5 * 1024; + + auto_size_ctl.epoch_length = 100; + + + auto_size_ctl.incr_mode = H5C_incr__threshold; + + auto_size_ctl.lower_hr_threshold = 0.75; + + auto_size_ctl.increment = 2.0; + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (32 * 1024); + + auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.5; + + + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + + auto_size_ctl.decrement = 0.5; + + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1000 * 1024); + + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ + + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ + + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 12.\n"; + } + } + + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (0).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Load a huge entry into the cache */ + if ( pass ) { + + protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (1).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now load a monster entry. Since a monster entry is larger than + * half the size of the cache, and there is not sufficient space + * for a monster entry in the cache, we will add space to the + * cache to make room for the entry. + */ + if ( pass ) { + + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (80 * 1024) ) || + ( cache_ptr->min_clean_size != (40 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (HUGE_ENTRY_SIZE + + MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (2).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Load a second moster entry. Since the monster entry is larger + * than half the size of the cache yet again, and there is not + * sufficient space for the monster entry in the cache, we again + * add space to the cache to make space for the entry. + */ + if ( pass ) { + + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1); + + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != ((2 * MONSTER_ENTRY_SIZE) + + HUGE_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (3).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Load a third moster entry. Should be no cache size increase this + * time. + */ + if ( pass ) { + + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2); + + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 2 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (4).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* delete existing entries to prepare for next test, and reset + * the size of the cache. + */ + if ( pass ) { + + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 1); + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 2); + + if ( pass ) { + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; + } + } + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (5).\n"; + } + } + + /* repeat the above basic test, only this time, use inserts to add + * entries to the cache, not protects. + */ + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* insert a huge entry into the cache */ + if ( pass ) { + + insert_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, TRUE, + H5C__NO_FLAGS_SET); + /* protect and unprotect a couple times to increment cache_accesses */ + protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, + NO_CHANGE, H5C__NO_FLAGS_SET); + protect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, HUGE_ENTRY_TYPE, 1, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 2 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (6).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now insert a monster entry. Since a monster entry is larger than + * half the size of the cache, and there is not sufficient space + * for a monster entry in the cache, we will add space to the + * cache to make room for the entry. + */ + if ( pass ) { + + insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 4, TRUE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (80 * 1024) ) || + ( cache_ptr->min_clean_size != (40 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (7).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Insert a second monster entry. Cache size should increase again. + */ + if ( pass ) { + + insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 5, TRUE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != + 2 * MONSTER_ENTRY_SIZE + HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (8).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Insert a third monster entry. Should be no cache size increase this + * time. + */ + if ( pass ) { + + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6); + + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (9).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* delete existing entries to prepare for next test, and reset + * the size of the cache. We must also change the size of the needed + * variable entries before we run the test, so will protect and + * unprotect them now so as to get the correct initial size. + */ + if ( pass ) { + + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 5); + expunge_entry(cache_ptr, MONSTER_ENTRY_TYPE, 6); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 13, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1024); + + flush_cache(cache_ptr, TRUE, FALSE, FALSE); + + + if ( pass ) { + + auto_size_ctl.initial_size = 6 * 1024; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; + } + } + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (10).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now load the variable entries into the cache */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__NO_FLAGS_SET); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__NO_FLAGS_SET); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__NO_FLAGS_SET); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (11).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect a variable entry, and re-size it to 3K. Should be + * no effect on the size of the cache. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 3 * 1024); + + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 6 * 1024 ) || + ( cache_ptr->cache_accesses != 5 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (12).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect the variable entry again, and re-size it to 10K. Should + * resize the cache to 13 KB. Note that cache_accesses will be 0 + * in this case, since cache_accesses is incremented on the protect. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); + + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (13).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect a second variable entry, and re-size it to 10K. Should + * resize to 22 KB. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); + + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (14).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect a third variable entry, and re-size it to 10K. Should + * be no change in cache size. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 10 * 1024); + + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (15).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* re-size the variable entries back down to their initial size, and + * restore the cache to its initial size as well, in preparation + * for the next test. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + + if ( pass ) { + + auto_size_ctl.initial_size = 6 * 1024; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n"; + } + } + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (16).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now test flash cache resizes with pinned entries... + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 5 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (17).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (18).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (19).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (20).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Unpin the entries. Note that no entries are evicted as we don't + * load any entries. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (21).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* re-size the variable entries back down to their initial size, and + * restore the cache to its initial size as well, in preparation + * for the next test. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C__DIRTIED_FLAG|H5C__SIZE_CHANGED_FLAG, 1 * 1024); + + if ( pass ) { + + auto_size_ctl.initial_size = 6 * 1024; + result = H5C_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n"; + } + } + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (22).\n"; + } + } + + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 5 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (23).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (24).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (25).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__PIN_ENTRY_FLAG); + resize_pinned_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (26).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Unpin the entries. Note that no entries are evicted as we don't + * load any entries. + */ + if ( pass ) { + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); + + protect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C__UNPIN_ENTRY_FLAG); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (27).\n"; + } + } + + /* We have finished a basic check of the flash cache size increment + * code. Tidy up for a more extensive test... + */ + if ( pass ) { + + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + expunge_entry(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (28).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* ...and then reconfigure. Note that we change the flash_multiple + * and flash_threshold just to make sure that such changed perform + * as expected. + */ + if ( pass ) { + + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 4 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 20 * 1024; + auto_size_ctl.min_size = 4 * 1024; + + auto_size_ctl.epoch_length = 100; + + + auto_size_ctl.incr_mode = H5C_incr__threshold; + + auto_size_ctl.lower_hr_threshold = 0.75; + + auto_size_ctl.increment = 2.0; + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024); + + auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.4; + + + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + + auto_size_ctl.decrement = 0.5; + + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (2 * 1024); + + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ + + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ + + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 512) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) { + + pass = FALSE; + failure_mssg = "bad cache after initialization 15.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect and unprotect a large entry -- no change in cache size since + * a large entry will just fill the available space in the cache. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 512) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called == TRUE ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (29).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect and unprotect another a large entry -- should trigger a + * flash cache size increase to 12 KB (remember that flash_multiple is + * set to 2.0). + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 1, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (12 * 1024) ) || + ( cache_ptr->min_clean_size != (12 * 512) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != 2 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called != TRUE ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (30).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect and unprotect two more large entries -- shouldnt trigger a + * flash cache size increase. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 2, NO_CHANGE, + H5C__NO_FLAGS_SET); + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 3, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (12 * 1024) ) || + ( cache_ptr->min_clean_size != (12 * 512) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 3 ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (31).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* do many accesses of a single entry to talk the cache into reducing + * its size to the minimum. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 1000 ) ) + { + protect_entry(cache_ptr, TINY_ENTRY_TYPE, 0); + + if ( pass ) { + unprotect_entry(cache_ptr, TINY_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024) ) || + ( cache_ptr->index_size != (1 * TINY_ENTRY_SIZE) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (32).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Force another flash increase */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (4 * 1024 + 128) ) || + ( cache_ptr->min_clean_size != (2 * 1024 + 64) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + LARGE_ENTRY_SIZE + TINY_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called == FALSE ) || + ( rpt_status != flash_increase ) ) ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (33).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force regular size increase up to maximum */ + if ( pass ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass ) && ( i < 500 ) ) + { + protect_entry(cache_ptr, TINY_ENTRY_TYPE, i); + + if ( pass ) { + unprotect_entry(cache_ptr, TINY_ENTRY_TYPE, i, + NO_CHANGE, H5C__NO_FLAGS_SET); + } + i++; + } + + if ( ( cache_ptr->max_cache_size != (20 * 1024) ) || + ( cache_ptr->min_clean_size != (10 * 1024) ) || + ( rpt_fcn_called == FALSE ) || + ( rpt_status != at_max_size ) ) { + + pass = FALSE; + failure_mssg = "Unexpected cache config (34).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -20493,6 +21654,10 @@ check_auto_cache_resize(void) * * Modifications: * + * Added code to include the flash cache size increment + * code in this test. + * JRM -- 1/10/08 + * *------------------------------------------------------------------------- */ @@ -20530,6 +21695,11 @@ check_auto_cache_resize_disable(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 0.25, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -20621,6 +21791,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -20778,6 +21952,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -20935,6 +22113,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -21091,6 +22273,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -21247,6 +22433,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -21402,6 +22592,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__off; @@ -21559,6 +22753,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -21783,6 +22981,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -22014,6 +23216,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -22249,6 +23455,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22374,6 +23584,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22499,6 +23713,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22624,6 +23842,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22749,6 +23971,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22875,6 +24101,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__off; @@ -22976,6 +24206,175 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + /* Now test the flash cache size increment code to verify that it + * is disabled when it should be. + * + * Since the flash size increase code doesn't look at hit rate, or + * use epochs (other than to start a new epoch if a flash cache size + * increase is triggered), we go about these tests somewhat differently + * than the rest of the tests in this function. + * + * As of this writing, there is only one flash cache size increment + * mode (add space), which is triggered whenever the size of a newly + * loaded or inserted entry, or the delta between old and new entry + * sizes exceeds some fraction of the current maximum cache size, and + * the cache doesn't have enough free space to accomodate the new/ + * resize entry without performing evictions. The range of permissible + * values for the flash_threshold (0.1 to 1.0 as of this writing), and + * for the flash_multiple (0.1 to 10.0) do not permit the facility to + * be turned off by configuration. Thus, flash cache size increases + * can be disabled only via the flash_incr_mode, and by setting the + * current max_cache_size equal to max_size. + * + * We have already tested the latter in check_auto_cache_resize(), so + * we need only thest the former here. Do this by disabling flash + * cache size increments via the flash_incr_mode, and then creating + * situations that would trigger flash cache size increases were that + * code enabled. + */ + + + if ( pass ) { + + auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 64 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 256 * 1024; + auto_size_ctl.min_size = 32 * 1024; + + auto_size_ctl.epoch_length = 1000; + + + auto_size_ctl.incr_mode = H5C_incr__threshold; + + auto_size_ctl.lower_hr_threshold = 0.75; + + auto_size_ctl.increment = 2.0; + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024); + + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.25; + + + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; + + auto_size_ctl.upper_hr_threshold = 0.995; + + auto_size_ctl.decrement = 0.5; + + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024); + + auto_size_ctl.epochs_before_eviction = 3; + + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; + + + result = H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_cache_auto_resize_config failed 17.\n"; + } + } + + if ( pass ) { + + if ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) ) { + + pass = FALSE; + failure_mssg = "bad cache size after set resize re-config 16.\n"; + } + } + + /* We have reduced the max cache size to well below the current index + * size. Protect and unprotect an entry to allow the cache to evict + * entries and get within bounds + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, LARGE_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 46.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now protect and unprotect a monster entry. If the flash cache + * size increment code was active, this would trigger an increase. + * Verify that it doesn't. + * + * This finishes the additional tests needed for the flash cache + * size increase code. + */ + if ( pass ) { + + rpt_fcn_called = FALSE; + + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C__NO_FLAGS_SET); + + if ( ( pass ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != MONSTER_ENTRY_SIZE ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); + + pass = FALSE; + failure_mssg = "Unexpected cache size change results 47.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass ) { takedown_cache(cache_ptr, FALSE, FALSE); @@ -23047,6 +24446,11 @@ check_auto_cache_resize_epoch_markers(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -23129,6 +24533,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -23302,6 +24710,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -23420,6 +24832,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23495,6 +24911,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -23605,6 +25025,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C_decr__off; @@ -23692,6 +25116,11 @@ check_auto_cache_resize_epoch_markers(void) * * Modifications: * + * Added code to verify that errors in the flash cache size + * increment related fields are caught as well. + * + * JRM -- 1/17/08 + * *------------------------------------------------------------------------- */ @@ -23711,8 +25140,14 @@ check_auto_cache_resize_epoch_markers(void) ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decrement == (b).decrement ) && \ ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ ( (a).max_decrement == (b).max_decrement ) && \ @@ -23751,6 +25186,11 @@ check_auto_cache_resize_input_errs(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -23853,6 +25293,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23925,6 +25369,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23998,6 +25446,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24068,6 +25520,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24140,6 +25596,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24209,6 +25669,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24282,6 +25746,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24351,6 +25819,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24420,6 +25892,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24492,6 +25968,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24561,6 +26041,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24634,6 +26118,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24704,6 +26192,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24776,6 +26268,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24845,6 +26341,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24914,6 +26414,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24986,6 +26490,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25032,6 +26540,382 @@ check_auto_cache_resize_input_errs(void) } + /* test for bad flash_incr_mode rejection */ + + if ( pass ) { + + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + (enum H5C_cache_flash_incr_mode) -1; /* INVALID */ + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + + + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad flash_incr_mode.\n"; + } + } + + if ( pass ) { + + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 19."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 19."; + } + } + + /* test for bad flash_multiple rejection */ + + if ( pass ) { + + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 0.09; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; + + + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad flash_multiple(1).\n"; + } + } + + if ( pass ) { + + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 20."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 20."; + } + } + + if ( pass ) { + + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 10.01; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; + + + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad flash_multiple(2).\n"; + } + } + + if ( pass ) { + + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 21."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 21."; + } + } + + /* test for bad flash_threshold rejection */ + + if ( pass ) { + + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 0.09; /* INVALID */ + + + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad flash_threshold(1).\n"; + } + } + + if ( pass ) { + + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 22."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 22."; + } + } + + if ( pass ) { + + invalid_auto_size_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 1.001; /* INVALID */ + + + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass = FALSE; + failure_mssg = + "H5C_set_cache_auto_resize_config accepted bad flash_threshold(2).\n"; + } + } + + if ( pass ) { + + result = H5C_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_cache_auto_resize_config failed 23."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass = FALSE; + failure_mssg = "Unexpected auto resize config 23."; + } + } + /* test for bad decr_mode rejection */ if ( pass ) { @@ -25059,6 +26943,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode) -1; /* INVALID */ @@ -25094,13 +26982,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 19."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 24."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 19."; + failure_mssg = "Unexpected auto resize config 24."; } } @@ -25129,6 +27017,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = (enum H5C_cache_decr_mode) 4; /* INVALID */ @@ -25164,13 +27056,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 20."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 25."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 20."; + failure_mssg = "Unexpected auto resize config 25."; } } @@ -25202,6 +27094,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25236,13 +27132,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 21."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 26."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 21."; + failure_mssg = "Unexpected auto resize config 26."; } } @@ -25271,6 +27167,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25305,13 +27205,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 22."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 27."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 22."; + failure_mssg = "Unexpected auto resize config 27."; } } @@ -25343,6 +27243,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -25376,13 +27280,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 23."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 28."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 23."; + failure_mssg = "Unexpected auto resize config 28."; } } @@ -25411,6 +27315,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -25445,13 +27353,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 24."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 29."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 24."; + failure_mssg = "Unexpected auto resize config 29."; } } @@ -25483,6 +27391,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -25516,13 +27428,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 25."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 30."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 25."; + failure_mssg = "Unexpected auto resize config 30."; } } @@ -25551,6 +27463,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -25585,13 +27501,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass = FALSE; - failure_mssg = "H5C_get_cache_auto_resize_config failed 26."; + failure_mssg = "H5C_get_cache_auto_resize_config failed 31."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass = FALSE; - failure_mssg = "Unexpected auto resize config 26."; + failure_mssg = "Unexpected auto resize config 31."; } } @@ -25716,6 +27632,11 @@ check_auto_cache_resize_aux_fcns(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, diff --git a/test/cache2.c b/test/cache2.c index 118838b..32ca9b4 100644 --- a/test/cache2.c +++ b/test/cache2.c @@ -965,6 +965,11 @@ smoke_check_5(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, @@ -1200,6 +1205,11 @@ smoke_check_6(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, @@ -1435,6 +1445,11 @@ smoke_check_7(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (8 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, @@ -1671,6 +1686,11 @@ smoke_check_8(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, @@ -9343,7 +9363,7 @@ check_flush_cache__flush_op_test(H5C2_t * cache_ptr, int check_size, struct fo_flush_entry_check check[]) { - const char * fcn_name = "check_flush_cache__flush_op_test"; + /* const char * fcn_name = "check_flush_cache__flush_op_test"; */ static char msg[128]; herr_t result; int i; @@ -9836,7 +9856,7 @@ check_flush_cache__flush_op_test(H5C2_t * cache_ptr, static void check_flush_cache__flush_op_eviction_test(H5C2_t * cache_ptr) { - const char * fcn_name = "check_flush_cache__flush_op_eviction_test"; + /* const char * fcn_name = "check_flush_cache__flush_op_eviction_test"; */ int i; int num_variable_entries = 10; int num_monster_entries = 31; @@ -16856,7 +16876,7 @@ check_pin_entry_errs(void) * * Modifications: * - * - Modified call to H5C2_protect() to pass H5C2__NO_FLAGS_SET in the + * - Modified call to H5C2_protect() to pass2 H5C2__NO_FLAGS_SET in the * the new flags parameter. * * JRM -- 3/28/07 @@ -17747,6 +17767,10 @@ check_check_evictions_enabled_err(void) * * Modifications: * + * John Mainzer 1/8/08 + * Added a basic set of tests for the flash cache size + * increment code. + * *------------------------------------------------------------------------- */ @@ -17756,7 +17780,7 @@ enum H5C2_resize_status rpt_status; static void test_rpt_fcn(UNUSED H5C2_t * cache_ptr, UNUSED int32_t version, UNUSED double hit_rate, - UNUSED enum H5C2_resize_status status, + enum H5C2_resize_status status, UNUSED size_t old_max_cache_size, UNUSED size_t new_max_cache_size, UNUSED size_t old_min_clean_size, @@ -17800,6 +17824,11 @@ check_auto_cache_resize(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, @@ -18160,7 +18189,7 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); - /* the current cache configuration is unconvenient for testing cache + /* the current cache configuration is inconvenient for testing cache * size reduction, so lets change it some something easier to work * with. */ @@ -18190,6 +18219,9 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1000 * 1000); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -18540,6 +18572,9 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -18728,6 +18763,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -19000,7 +19039,7 @@ check_auto_cache_resize(void) } } - if ( show_progress ) HDfprintf(stderr, "*check point %d\n", checkpoint++); + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); /* now just bang on one entry -- after three epochs, this should * get all entries other than the one evicted, and the cache size @@ -19151,6 +19190,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -19691,6 +19734,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -20115,6 +20162,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; @@ -20381,6 +20432,10 @@ check_auto_cache_resize(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; @@ -20912,6 +20967,1105 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* now test the flash cache size increment code. At least at present, + * there should be no interaction between the regular auto-resize + * code and the flash cache size increment code other than a reset + * of the counter and stats collection used by the regular auto-resize + * code. Thus we do only limited tests of the two pieces of code + * operating together. + * + * Start with simple test to verify that the flash cache increment + * code increases the cache size when and as expected. + */ + + /* Place the cache in a know state via a flush destroy on the cache + * to clear out all entries, and then a reset on all the entries. + * Then configure the cache for the flash cache size increase tests, + * and force the flash size increase code through all its operational + * modes. Verify that all perform as expected. + */ + + if ( pass2 ) { + + flush_cache2(cache_ptr, TRUE, FALSE, FALSE); + + reset_entries2(); + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 64 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 1024 * 1024; + auto_size_ctl.min_size = 5 * 1024; + + auto_size_ctl.epoch_length = 100; + + + auto_size_ctl.incr_mode = H5C2_incr__threshold; + + auto_size_ctl.lower_hr_threshold = 0.75; + + auto_size_ctl.increment = 2.0; + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (32 * 1024); + + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__add_space; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.5; + + + auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; + + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + + auto_size_ctl.decrement = 0.5; + + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1000 * 1024); + + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ + + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ + + result = H5C2_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_set_cache_auto_resize_config failed 12.\n"; + } + } + + if ( pass2 ) { + + if ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (0).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Load a huge entry into the cache */ + if ( pass2 ) { + + protect_entry2(cache_ptr, HUGE_ENTRY_TYPE, 0); + + if ( pass2 ) { + unprotect_entry2(cache_ptr, HUGE_ENTRY_TYPE, 0, + NO_CHANGE, H5C2__NO_FLAGS_SET); + } + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (1).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now load a monster entry. Since a monster entry is larger than + * half the size of the cache, and there is not sufficient space + * for a monster entry in the cache, we will add space to the + * cache to make room for the entry. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 0); + + if ( pass2 ) { + unprotect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C2__NO_FLAGS_SET); + } + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (80 * 1024) ) || + ( cache_ptr->min_clean_size != (40 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (HUGE_ENTRY_SIZE + + MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (2).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Load a second monster entry. Since the monster entry is larger + * than half the size of the cache yet again, and there is not + * sufficient space for the monster entry in the cache, we again + * add space to the cache to make space for the entry. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 1); + + unprotect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 1, + NO_CHANGE, H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != ((2 * MONSTER_ENTRY_SIZE) + + HUGE_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (3).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Load a third moster entry. Should be no cache size increase this + * time. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 2); + + unprotect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 2, + NO_CHANGE, H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 2 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (4).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* delete existing entries to prepare for next test, and reset + * the size of the cache. + */ + if ( pass2 ) { + + expunge_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 1); + expunge_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 2); + + if ( pass2 ) { + + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config failed 13.\n"; + } + } + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (5).\n"; + } + } + + /* repeat the above basic test, only this time, use inserts to add + * entries to the cache, not protects. + */ + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* insert a huge entry into the cache */ + if ( pass2 ) { + + insert_entry2(cache_ptr, HUGE_ENTRY_TYPE, 1, TRUE, + H5C2__NO_FLAGS_SET); + /* protect and unprotect a couple times to increment cache_accesses */ + protect_entry2(cache_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry2(cache_ptr, HUGE_ENTRY_TYPE, 1, + NO_CHANGE, H5C2__NO_FLAGS_SET); + protect_entry2(cache_ptr, HUGE_ENTRY_TYPE, 1); + unprotect_entry2(cache_ptr, HUGE_ENTRY_TYPE, 1, + NO_CHANGE, H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 2 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (6).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now insert a monster entry. Since a monster entry is larger than + * half the size of the cache, and there is not sufficient space + * for a monster entry in the cache, we will add space to the + * cache to make room for the entry. + */ + if ( pass2 ) { + + insert_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 4, TRUE, + H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (80 * 1024) ) || + ( cache_ptr->min_clean_size != (40 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (7).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Insert a second monster entry. Cache size should increase again. + */ + if ( pass2 ) { + + insert_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 5, TRUE, + H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != + 2 * MONSTER_ENTRY_SIZE + HUGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (8).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Insert a third monster entry. Should be no cache size increase this + * time. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 6); + + unprotect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 6, + NO_CHANGE, H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (144 * 1024) ) || + ( cache_ptr->min_clean_size != ( 72 * 1024) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE) ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (9).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* delete existing entries to prepare for next test, and reset + * the size of the cache. We must also change the size of the needed + * variable entries before we run the test, so will protect and + * unprotect them now so as to get the correct initial size. + */ + if ( pass2 ) { + + expunge_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 5); + expunge_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 6); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1024); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1024); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1024); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 13, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1024); + + flush_cache2(cache_ptr, TRUE, FALSE, FALSE); + + + if ( pass2 ) { + + auto_size_ctl.initial_size = 6 * 1024; + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config failed 13.\n"; + } + } + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (10).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now load the variable entries into the cache */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 13, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (11).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect a variable entry, and re-size it to 3K. Should be + * no effect on the size of the cache. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 3 * 1024); + + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 6 * 1024 ) || + ( cache_ptr->cache_accesses != 5 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (12).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect the variable entry again, and re-size it to 10K. Should + * resize the cache to 13 KB. Note that cache_accesses will be 0 + * in this case, since cache_accesses is incremented on the protect. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 10 * 1024); + + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (13).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect a second variable entry, and re-size it to 10K. Should + * resize to 22 KB. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 10 * 1024); + + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (14).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect a third variable entry, and re-size it to 10K. Should + * be no change in cache size. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 10 * 1024); + + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (15).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* re-size the variable entries back down to their initial size, and + * restore the cache to its initial size as well, in preparation + * for the next test. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1 * 1024); + + if ( pass2 ) { + + auto_size_ctl.initial_size = 6 * 1024; + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config failed 14.\n"; + } + } + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (16).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now test flash cache resizes with pinned entries... + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C2__PIN_ENTRY_FLAG); + resize_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 5 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (17).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + resize_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (18).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C2__PIN_ENTRY_FLAG); + resize_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (19).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C2__PIN_ENTRY_FLAG); + resize_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (20).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Unpin the entries. Note that no entries are evicted as we don't + * load any entries. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C2__UNPIN_ENTRY_FLAG); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C2__UNPIN_ENTRY_FLAG); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C2__UNPIN_ENTRY_FLAG); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (21).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* re-size the variable entries back down to their initial size, and + * restore the cache to its initial size as well, in preparation + * for the next test. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1 * 1024); + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry_with_size_change2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, + H5C2__DIRTIED_FLAG|H5C2__SIZE_CHANGED_FLAG, 1 * 1024); + + if ( pass2 ) { + + auto_size_ctl.initial_size = 6 * 1024; + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config failed 15.\n"; + } + } + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (3 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 4 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (22).\n"; + } + } + + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C2__PIN_ENTRY_FLAG); + resize_pinned_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (6 * 1024) ) || + ( cache_ptr->min_clean_size != (6 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 5 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (23).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + resize_pinned_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (13 * 1024) ) || + ( cache_ptr->min_clean_size != (13 * 512) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 13 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (24).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C2__PIN_ENTRY_FLAG); + resize_pinned_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 22 * 1024 ) || + ( cache_ptr->cache_accesses != 0 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (25).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C2__PIN_ENTRY_FLAG); + resize_pinned_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 1 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (26).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Unpin the entries. Note that no entries are evicted as we don't + * load any entries. + */ + if ( pass2 ) { + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10, NO_CHANGE, + H5C2__UNPIN_ENTRY_FLAG); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11, NO_CHANGE, + H5C2__UNPIN_ENTRY_FLAG); + + protect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + unprotect_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12, NO_CHANGE, + H5C2__UNPIN_ENTRY_FLAG); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 4 ) || + ( cache_ptr->index_size != 31 * 1024 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (27).\n"; + } + } + + /* We have finished a basic check of the flash cache size increment + * code. Tidy up for a more extensive test... + */ + if ( pass2 ) { + + expunge_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 10); + expunge_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 11); + expunge_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 12); + expunge_entry2(cache_ptr, VARIABLE_ENTRY_TYPE, 13); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (22 * 1024) ) || + ( cache_ptr->min_clean_size != (11 * 1024) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 4 ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (28).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* ...and then reconfigure. Note that we change the flash_multiple + * and flash_threshold just to make sure that such changed perform + * as expected. + */ + if ( pass2 ) { + + auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 4 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 20 * 1024; + auto_size_ctl.min_size = 4 * 1024; + + auto_size_ctl.epoch_length = 100; + + + auto_size_ctl.incr_mode = H5C2_incr__threshold; + + auto_size_ctl.lower_hr_threshold = 0.75; + + auto_size_ctl.increment = 2.0; + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (4 * 1024); + + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__add_space; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.4; + + + auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; + + auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */ + + auto_size_ctl.decrement = 0.5; + + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (2 * 1024); + + auto_size_ctl.epochs_before_eviction = 1; /* for ease of testing */ + + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.5; /* for ease of testing */ + + result = H5C2_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_set_cache_auto_resize_config failed 15.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { + + if ( ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 512) ) || + ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->cache_accesses != 0 ) ) { + + pass2 = FALSE; + failure_mssg2 = "bad cache after initialization 15.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect and unprotect a large entry -- no change in cache size since + * a large entry will just fill the available space in the cache. + */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + + protect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (4 * 512) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called == TRUE ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (29).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect and unprotect another a large entry -- should trigger a + * flash cache size increase to 12 KB (remember that flash_multiple is + * set to 2.0). + */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + + protect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 1, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (12 * 1024) ) || + ( cache_ptr->min_clean_size != (12 * 512) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != 2 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called != TRUE ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (30).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* protect and unprotect two more large entries -- shouldnt trigger a + * flash cache size increase. + */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + + protect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 2, NO_CHANGE, + H5C2__NO_FLAGS_SET); + protect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 3); + unprotect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 3, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (12 * 1024) ) || + ( cache_ptr->min_clean_size != (12 * 512) ) || + ( cache_ptr->index_len != 3 ) || + ( cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 3 ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (31).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* do many accesses of a single entry to talk the cache into reducing + * its size to the minimum. + */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass2 ) && ( i < 1000 ) ) + { + protect_entry2(cache_ptr, TINY_ENTRY_TYPE, 0); + + if ( pass2 ) { + unprotect_entry2(cache_ptr, TINY_ENTRY_TYPE, 0, + NO_CHANGE, H5C2__NO_FLAGS_SET); + } + i++; + } + + if ( ( ! rpt_fcn_called ) || + ( cache_ptr->max_cache_size != (4 * 1024) ) || + ( cache_ptr->min_clean_size != (2 * 1024) ) || + ( cache_ptr->index_size != (1 * TINY_ENTRY_SIZE) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (32).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Force another flash increase */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + + protect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 0, NO_CHANGE, + H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (4 * 1024 + 128) ) || + ( cache_ptr->min_clean_size != (2 * 1024 + 64) ) || + ( cache_ptr->index_len != 2 ) || + ( cache_ptr->index_size != + LARGE_ENTRY_SIZE + TINY_ENTRY_SIZE ) || + ( cache_ptr->cache_accesses != 1 ) || + ( rpt_fcn_called == FALSE ) || + ( rpt_status != flash_increase ) ) ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (33).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* force regular size increase up to maximum */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + i = 0; + while ( ( pass2 ) && ( i < 500 ) ) + { + protect_entry2(cache_ptr, TINY_ENTRY_TYPE, i); + + if ( pass2 ) { + unprotect_entry2(cache_ptr, TINY_ENTRY_TYPE, i, + NO_CHANGE, H5C2__NO_FLAGS_SET); + } + i++; + } + + if ( ( cache_ptr->max_cache_size != (20 * 1024) ) || + ( cache_ptr->min_clean_size != (10 * 1024) ) || + ( rpt_fcn_called == FALSE ) || + ( rpt_status != at_max_size ) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache config (34).\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + if ( pass2 ) { takedown_cache2(cache_ptr, FALSE, FALSE); @@ -20945,6 +22099,10 @@ check_auto_cache_resize(void) * * Modifications: * + * Added code to include the flash cache size increment + * code in this test. + * JRM -- 1/10/08 + * *------------------------------------------------------------------------- */ @@ -20982,6 +22140,11 @@ check_auto_cache_resize_disable(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, @@ -21073,6 +22236,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -21230,11 +22397,14 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; auto_size_ctl.upper_hr_threshold = 0.995; - auto_size_ctl.decrement = 0.5; auto_size_ctl.apply_max_decrement = FALSE; @@ -21387,6 +22557,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -21543,6 +22717,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -21699,6 +22877,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -21854,6 +23036,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__off; @@ -22011,6 +23197,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -22235,6 +23425,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -22466,6 +23660,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; @@ -22701,6 +23899,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -22826,6 +24028,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -22951,6 +24157,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -23076,6 +24286,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -23201,6 +24415,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -23327,6 +24545,10 @@ check_auto_cache_resize_disable(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__off; @@ -23428,6 +24650,175 @@ check_auto_cache_resize_disable(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now test the flash cache size increment code to verify that it + * is disabled when it should be. + * + * Since the flash size increase code doesn't look at hit rate, or + * use epochs (other than to start a new epoch if a flash cache size + * increase is triggered), we go about these tests somewhat differently + * than the rest of the tests in this function. + * + * As of this writing, there is only one flash cache size increment + * mode (add space), which is triggered whenever the size of a newly + * loaded or inserted entry, or the delta between old and new entry + * sizes exceeds some fraction of the current maximum cache size, and + * the cache doesn't have enough free space to accomodate the new/ + * resize entry without performing evictions. The range of permissible + * values for the flash_threshold (0.1 to 1.0 as of this writing), and + * for the flash_multiple (0.1 to 10.0) do not permit the facility to + * be turned off by configuration. Thus, flash cache size increases + * can be disabled only via the flash_incr_mode, and by setting the + * current max_cache_size equal to max_size. + * + * We have already tested the latter in check_auto_cache_resize(), so + * we need only thest the former here. Do this by disabling flash + * cache size increments via the flash_incr_mode, and then creating + * situations that would trigger flash cache size increases were that + * code enabled. + */ + + if ( pass2 ) { + + auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + auto_size_ctl.rpt_fcn = test_rpt_fcn; + + auto_size_ctl.set_initial_size = TRUE; + auto_size_ctl.initial_size = 64 * 1024; + + auto_size_ctl.min_clean_fraction = 0.5; + + auto_size_ctl.max_size = 256 * 1024; + auto_size_ctl.min_size = 32 * 1024; + + auto_size_ctl.epoch_length = 1000; + + + auto_size_ctl.incr_mode = H5C2_incr__threshold; + + auto_size_ctl.lower_hr_threshold = 0.75; + + auto_size_ctl.increment = 2.0; + + auto_size_ctl.apply_max_increment = TRUE; + auto_size_ctl.max_increment = (2 * 1024); + + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 1.0; + auto_size_ctl.flash_threshold = 0.25; + + + auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; + + auto_size_ctl.upper_hr_threshold = 0.995; + + auto_size_ctl.decrement = 0.5; + + auto_size_ctl.apply_max_decrement = TRUE; + auto_size_ctl.max_decrement = (1 * 1024); + + auto_size_ctl.epochs_before_eviction = 3; + + auto_size_ctl.apply_empty_reserve = TRUE; + auto_size_ctl.empty_reserve = 0.05; + + + result = H5C2_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_set_cache_auto_resize_config failed 17.\n"; + } + } + + if ( pass2 ) { + + if ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) ) { + + pass2 = FALSE; + failure_mssg2 = "bad cache size after set resize re-config 16.\n"; + } + } + + /* We have reduced the max cache size to well below the current index + * size. Protect and unprotect an entry to allow the cache to evict + * entries and get within bounds + */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + + protect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 0); + unprotect_entry2(cache_ptr, LARGE_ENTRY_TYPE, 0, + NO_CHANGE, H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache size change results 46.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + + /* Now protect and unprotect a monster entry. If the flash cache + * size increment code was active, this would trigger an increase. + * Verify that it doesn't. + * + * This finishes the additional tests needed for the flash cache + * size increase code. + */ + if ( pass2 ) { + + rpt_fcn_called = FALSE; + + protect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 0); + unprotect_entry2(cache_ptr, MONSTER_ENTRY_TYPE, 0, + NO_CHANGE, H5C2__NO_FLAGS_SET); + + if ( ( pass2 ) && + ( ( ( cache_ptr->max_cache_size != (64 * 1024) ) || + ( cache_ptr->min_clean_size != (32 * 1024) ) || + ( cache_ptr->index_len != 1 ) || + ( cache_ptr->index_size != MONSTER_ENTRY_SIZE ) || + ( rpt_fcn_called != FALSE ) ) ) ) { + + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); + + pass2 = FALSE; + failure_mssg2 = "Unexpected cache size change results 47.\n"; + } + } + + if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if ( pass2 ) { takedown_cache2(cache_ptr, FALSE, FALSE); @@ -23499,6 +24890,11 @@ check_auto_cache_resize_epoch_markers(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, @@ -23581,6 +24977,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -23754,6 +25154,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -23872,6 +25276,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -23947,6 +25355,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; @@ -24057,6 +25469,10 @@ check_auto_cache_resize_epoch_markers(void) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); + auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0; + auto_size_ctl.flash_threshold = 0.5; + auto_size_ctl.decr_mode = H5C2_decr__off; @@ -24144,6 +25560,11 @@ check_auto_cache_resize_epoch_markers(void) * * Modifications: * + * Added code to verify that errors in the flash cache size + * increment related fields are caught as well. + * + * JRM -- 1/17/08 + * *------------------------------------------------------------------------- */ @@ -24163,6 +25584,9 @@ check_auto_cache_resize_epoch_markers(void) ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ ( (a).decrement == (b).decrement ) && \ @@ -24203,6 +25627,11 @@ check_auto_cache_resize_input_errs(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, @@ -24305,6 +25734,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24377,6 +25810,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24450,6 +25887,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24520,6 +25961,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24592,6 +26037,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24661,6 +26110,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24734,6 +26187,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24803,6 +26260,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24872,6 +26333,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -24944,6 +26409,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25013,6 +26482,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25086,6 +26559,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25156,6 +26633,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25228,6 +26709,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25297,6 +26782,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25366,6 +26855,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25438,6 +26931,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25483,6 +26980,382 @@ check_auto_cache_resize_input_errs(void) } } + /* test for bad flash_incr_mode rejection */ + + if ( pass2 ) { + + invalid_auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C2_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + (enum H5C2_cache_flash_incr_mode) -1; /* INVALID */ + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + + + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config accepted bad flash_incr_mode.\n"; + } + } + + if ( pass2 ) { + + result = H5C2_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 19."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected auto resize config 19."; + } + } + + /* test for bad flash_multiple rejection */ + + if ( pass2 ) { + + invalid_auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C2_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C2_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 0.09; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; + + + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config accepted bad flash_multiple(1).\n"; + } + } + + if ( pass2 ) { + + result = H5C2_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 20."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected auto resize config 20."; + } + } + + if ( pass2 ) { + + invalid_auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C2_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C2_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 10.01; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5; + + + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config accepted bad flash_multiple(2).\n"; + } + } + + if ( pass2 ) { + + result = H5C2_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 21."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected auto resize config 21."; + } + } + + /* test for bad flash_threshold rejection */ + + if ( pass2 ) { + + invalid_auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C2_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C2_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 0.09; /* INVALID */ + + + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config accepted bad flash_threshold(1).\n"; + } + } + + if ( pass2 ) { + + result = H5C2_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 22."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected auto resize config 22."; + } + } + + if ( pass2 ) { + + invalid_auto_size_ctl.version = H5C2__CURR_AUTO_SIZE_CTL_VER; + invalid_auto_size_ctl.rpt_fcn = NULL; + + invalid_auto_size_ctl.set_initial_size = TRUE; + invalid_auto_size_ctl.initial_size = 4 * 1024 * 1024; + + invalid_auto_size_ctl.min_clean_fraction = 0.1; + + invalid_auto_size_ctl.max_size = 16 * 1024 * 1024; + invalid_auto_size_ctl.min_size = 1 * 1024 * 1024; + + invalid_auto_size_ctl.epoch_length = 5000; + + + invalid_auto_size_ctl.incr_mode = H5C2_incr__threshold; + + invalid_auto_size_ctl.lower_hr_threshold = 0.75; + + invalid_auto_size_ctl.increment = 2.0; + + invalid_auto_size_ctl.apply_max_increment = TRUE; + invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + + invalid_auto_size_ctl.flash_incr_mode = + H5C2_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0; + invalid_auto_size_ctl.flash_threshold = 1.001; /* INVALID */ + + + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; + + invalid_auto_size_ctl.upper_hr_threshold = 0.999; + + invalid_auto_size_ctl.decrement = 0.9; + + invalid_auto_size_ctl.apply_max_decrement = TRUE; + invalid_auto_size_ctl.max_decrement = (1 * 1024 * 1024); + + invalid_auto_size_ctl.epochs_before_eviction = 3; + + invalid_auto_size_ctl.apply_empty_reserve = TRUE; + invalid_auto_size_ctl.empty_reserve = 0.05; + + result = H5C2_set_cache_auto_resize_config(cache_ptr, + &invalid_auto_size_ctl); + + if ( result != FAIL ) { + + pass2 = FALSE; + failure_mssg2 = + "H5C2_set_cache_auto_resize_config accepted bad flash_threshold(2).\n"; + } + } + + if ( pass2 ) { + + result = H5C2_get_cache_auto_resize_config(cache_ptr, + &test_auto_size_ctl); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 23."; + + } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ + ref_auto_size_ctl, FALSE) ) { + + pass2 = FALSE; + failure_mssg2 = "Unexpected auto resize config 23."; + } + } + /* test for bad decr_mode rejection */ @@ -25511,6 +27384,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = (enum H5C2_cache_decr_mode) -1; /* INVALID */ @@ -25546,13 +27423,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 19."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 24."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 19."; + failure_mssg2 = "Unexpected auto resize config 24."; } } @@ -25581,6 +27458,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = (enum H5C2_cache_decr_mode) 4; /* INVALID */ @@ -25616,13 +27497,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 20."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 25."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 20."; + failure_mssg2 = "Unexpected auto resize config 25."; } } @@ -25654,6 +27535,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25688,13 +27573,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 21."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 26."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 21."; + failure_mssg2 = "Unexpected auto resize config 26."; } } @@ -25723,6 +27608,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__threshold; @@ -25757,13 +27646,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 22."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 27."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 22."; + failure_mssg2 = "Unexpected auto resize config 27."; } } @@ -25795,6 +27684,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -25828,13 +27721,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 23."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 28."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 23."; + failure_mssg2 = "Unexpected auto resize config 28."; } } @@ -25863,6 +27756,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; @@ -25897,13 +27794,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 24."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 29."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 24."; + failure_mssg2 = "Unexpected auto resize config 29."; } } @@ -25935,6 +27832,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__age_out; @@ -25968,13 +27869,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 25."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 30."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 25."; + failure_mssg2 = "Unexpected auto resize config 30."; } } @@ -26003,6 +27904,10 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); + invalid_auto_size_ctl.flash_incr_mode = H5C2_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0; + invalid_auto_size_ctl.flash_threshold = 0.5; + invalid_auto_size_ctl.decr_mode = H5C2_decr__age_out_with_threshold; @@ -26037,13 +27942,13 @@ check_auto_cache_resize_input_errs(void) if ( result != SUCCEED ) { pass2 = FALSE; - failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 26."; + failure_mssg2 = "H5C2_get_cache_auto_resize_config failed 31."; } else if ( ! RESIZE_CONFIGS_ARE_EQUAL(test_auto_size_ctl, \ ref_auto_size_ctl, FALSE) ) { pass2 = FALSE; - failure_mssg2 = "Unexpected auto resize config 26."; + failure_mssg2 = "Unexpected auto resize config 31."; } } @@ -26168,7 +28073,12 @@ check_auto_cache_resize_aux_fcns(void) /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__off, /* double upper_hr_threshold = */ 0.995, @@ -26714,7 +28624,7 @@ main(void) run_full_test2 = FALSE; #endif /* NDEBUG */ -#if 0 +#if 1 run_full_test2 = TRUE; #endif diff --git a/test/cache2_api.c b/test/cache2_api.c index 31a836a..0e78e25 100644 --- a/test/cache2_api.c +++ b/test/cache2_api.c @@ -52,6 +52,9 @@ const char *FILENAMES[] = { ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ ( (a).decrement == (b).decrement ) && \ @@ -145,6 +148,9 @@ static void check_file_mdc_api_errs(void); ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ ( (a).decrement == (b).decrement ) && \ @@ -172,6 +178,9 @@ static void check_file_mdc_api_errs(void); (i).increment = (e).increment; \ (i).apply_max_increment = (e).apply_max_increment; \ (i).max_increment = (e).max_increment; \ + (i).flash_incr_mode = (e).flash_incr_mode; \ + (i).flash_multiple = (e).flash_multiple; \ + (i).flash_threshold = (e).flash_threshold; \ (i).decr_mode = (e).decr_mode; \ (i).upper_hr_threshold = (e).upper_hr_threshold; \ (i).decrement = (e).decrement; \ @@ -198,31 +207,35 @@ check_fapl_mdc_api_calls(void) { /* int version = */ H5AC2__CURR_CACHE_CONFIG_VERSION, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024 + 1), - /* double min_clean_fraction = */ 0.2, - /* size_t max_size = */ (16 * 1024 * 1024 + 1), - /* size_t min_size = */ ( 1 * 1024 * 1024 + 1), - /* long int epoch_length = */ 50001, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024 + 1), + /* double min_clean_fraction = */ 0.2, + /* size_t max_size = */ (16 * 1024 * 1024 + 1), + /* size_t min_size = */ ( 1 * 1024 * 1024 + 1), + /* long int epoch_length = */ 50001, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__threshold, - /* double lower_hr_threshold = */ 0.91, - /* double increment = */ 2.1, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* double lower_hr_threshold = */ 0.91, + /* double increment = */ 2.1, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out, - /* double upper_hr_threshold = */ 0.998, - /* double decrement = */ 0.91, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), - /* int epochs_before_eviction = */ 4, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.998, + /* double decrement = */ 0.91, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), + /* int epochs_before_eviction = */ 4, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05, + /* int dirty_bytes_threshold = */ (256 * 1024) }; H5AC2_cache_config_t scratch; H5C2_auto_size_ctl_t default_auto_size_ctl; @@ -732,7 +745,7 @@ validate_mdc_config(hid_t file_id, /* Recall that in any configuration supplied by the cache * at run time, the set_initial_size field will always * be FALSE, regardless of the value pass2ed in. Thus we - * always resume that this field need not match that of + * always presume that this field need not match that of * the supplied external configuration. * * The cache also sets the initial_size field to the current @@ -794,120 +807,136 @@ check_file_mdc_api_calls(void) H5AC2_cache_config_t default_config = H5AC2__DEFAULT_CACHE_CONFIG; H5AC2_cache_config_t mod_config_1 = { - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024 + 1), - /* double min_clean_fraction = */ 0.2, - /* size_t max_size = */ (16 * 1024 * 1024 + 1), - /* size_t min_size = */ ( 1 * 1024 * 1024 + 1), - /* long int epoch_length = */ 50001, + /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024 + 1), + /* double min_clean_fraction = */ 0.2, + /* size_t max_size = */ (16 * 1024 * 1024 + 1), + /* size_t min_size = */ ( 1 * 1024 * 1024 + 1), + /* long int epoch_length = */ 50001, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__threshold, - /* double lower_hr_threshold = */ 0.91, - /* double increment = */ 2.1, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* double lower_hr_threshold = */ 0.91, + /* double increment = */ 2.1, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out, - /* double upper_hr_threshold = */ 0.998, - /* double decrement = */ 0.91, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), - /* int epochs_before_eviction = */ 4, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.998, + /* double decrement = */ 0.91, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), + /* int epochs_before_eviction = */ 4, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05, + /* int dirty_bytes_threshold = */ (256 * 1024) }; H5AC2_cache_config_t mod_config_2 = { - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ TRUE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (512 * 1024), - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ ( 8 * 1024 * 1024), - /* size_t min_size = */ ( 512 * 1024), - /* long int epoch_length = */ 25000, + /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ TRUE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (512 * 1024), + /* double min_clean_fraction = */ 0.1, + /* size_t max_size = */ ( 8 * 1024 * 1024), + /* size_t min_size = */ ( 512 * 1024), + /* long int epoch_length = */ 25000, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (2 * 1024 * 1024), + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (2 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, - /* double upper_hr_threshold = */ 0.9995, - /* double decrement = */ 0.95, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (512 * 1024), - /* int epochs_before_eviction = */ 4, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.9995, + /* double decrement = */ 0.95, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (512 * 1024), + /* int epochs_before_eviction = */ 4, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05, + /* int dirty_bytes_threshold = */ (256 * 1024) }; H5AC2_cache_config_t mod_config_3 = { - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.2, - /* size_t max_size = */ (16 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 50000, + /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.2, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__off, - /* double lower_hr_threshold = */ 0.90, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (4 * 1024 * 1024), + /* double lower_hr_threshold = */ 0.90, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ FALSE, - /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ FALSE, + /* size_t max_decrement = */ (1 * 1024 * 1024 - 1), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ FALSE, + /* double empty_reserve = */ 0.05, + /* int dirty_bytes_threshold = */ (256 * 1024) }; H5AC2_cache_config_t mod_config_4 = { - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ (1 * 1024 * 1024), - /* double min_clean_fraction = */ 0.15, - /* size_t max_size = */ (20 * 1024 * 1024), - /* size_t min_size = */ ( 1 * 1024 * 1024), - /* long int epoch_length = */ 75000, + /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.15, + /* size_t max_size = */ (20 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 75000, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__threshold, - /* double lower_hr_threshold = */ 0.9, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ TRUE, - /* size_t max_increment = */ (2 * 1024 * 1024), + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (2 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ TRUE, - /* size_t max_decrement = */ (1 * 1024 * 1024), - /* int epochs_before_eviction = */ 3, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.1, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) }; TESTING("MDC/FILE related API calls"); @@ -1420,94 +1449,115 @@ mdc_api_call_smoke_check(void) H5AC2_cache_config_t default_config = H5AC2__DEFAULT_CACHE_CONFIG; H5AC2_cache_config_t mod_config_1 = { - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ 500000, - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ 16000000, - /* size_t min_size = */ 250000, - /* long int epoch_length = */ 50000, + /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ 500000, + /* double min_clean_fraction = */ 0.1, + /* size_t max_size = */ 16000000, + /* size_t min_size = */ 250000, + /* long int epoch_length = */ 50000, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__off, - /* double lower_hr_threshold = */ 0.95, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ FALSE, - /* size_t max_increment = */ 4000000, + /* double lower_hr_threshold = */ 0.95, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ FALSE, + /* size_t max_increment = */ 4000000, + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ 1000000, - /* int epochs_before_eviction = */ 2, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ FALSE, + /* size_t max_decrement = */ 1000000, + /* int epochs_before_eviction = */ 2, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05, + /* int dirty_bytes_threshold = */ (256 * 1024) }; H5AC2_cache_config_t mod_config_2 = { - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ 12000000, - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ 16000000, - /* size_t min_size = */ 250000, - /* long int epoch_length = */ 50000, + /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ 12000000, + /* double min_clean_fraction = */ 0.1, + /* size_t max_size = */ 16000000, + /* size_t min_size = */ 250000, + /* long int epoch_length = */ 50000, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__off, - /* double lower_hr_threshold = */ 0.95, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ FALSE, - /* size_t max_increment = */ 4000000, + /* double lower_hr_threshold = */ 0.95, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ FALSE, + /* size_t max_increment = */ 4000000, + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ 1000000, - /* int epochs_before_eviction = */ 2, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ FALSE, + /* size_t max_decrement = */ 1000000, + /* int epochs_before_eviction = */ 2, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05, + /* int dirty_bytes_threshold = */ (256 * 1024) }; H5AC2_cache_config_t mod_config_3 = { - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, - /* hbool_t rpt_fcn_enabled = */ FALSE, - /* hbool_t open_trace_file = */ FALSE, - /* hbool_t close_trace_file = */ FALSE, - /* char trace_file_name[] = */ "", - /* hbool_t evictions_enabled = */ TRUE, - /* hbool_t set_initial_size = */ TRUE, - /* size_t initial_size = */ 2000000, - /* double min_clean_fraction = */ 0.1, - /* size_t max_size = */ 16000000, - /* size_t min_size = */ 250000, - /* long int epoch_length = */ 50000, + /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ 2000000, + /* double min_clean_fraction = */ 0.1, + /* size_t max_size = */ 16000000, + /* size_t min_size = */ 250000, + /* long int epoch_length = */ 50000, /* enum H5C2_cache_incr_mode incr_mode = */ H5C2_incr__off, - /* double lower_hr_threshold = */ 0.95, - /* double increment = */ 2.0, - /* hbool_t apply_max_increment = */ FALSE, - /* size_t max_increment = */ 4000000, + /* double lower_hr_threshold = */ 0.95, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ FALSE, + /* size_t max_increment = */ 4000000, + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__off, - /* double upper_hr_threshold = */ 0.999, - /* double decrement = */ 0.9, - /* hbool_t apply_max_decrement = */ FALSE, - /* size_t max_decrement = */ 1000000, - /* int epochs_before_eviction = */ 2, - /* hbool_t apply_empty_reserve = */ TRUE, - /* double empty_reserve = */ 0.05, - /* int dirty_bytes_threshold = */ (256 * 1024) + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ FALSE, + /* size_t max_decrement = */ 1000000, + /* int epochs_before_eviction = */ 2, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.05, + /* int dirty_bytes_threshold = */ (256 * 1024) }; TESTING("MDC API smoke check"); + if ( express_test > 0 ) { + + SKIPPED(); + + HDfprintf(stdout, " Long tests disabled.\n"); + + return; + } + pass2 = TRUE; /* Open a file with the default FAPL. Verify that the cache is @@ -2145,7 +2195,7 @@ mdc_api_call_smoke_check(void) * used to test error rejection in the MDC related API calls. */ -#define NUM_INVALID_CONFIGS 36 +#define NUM_INVALID_CONFIGS 41 H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = { @@ -2168,6 +2218,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2197,6 +2251,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2226,6 +2284,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2255,6 +2317,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2284,6 +2350,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2313,6 +2383,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2342,6 +2416,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2371,6 +2449,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2400,6 +2482,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2429,6 +2515,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2458,6 +2548,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2487,6 +2581,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2516,6 +2614,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2545,6 +2647,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2574,6 +2680,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2603,6 +2713,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2632,6 +2746,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2661,6 +2779,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2690,6 +2812,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 0.999999999999, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2719,6 +2845,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ (hbool_t)-1, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2730,7 +2860,172 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 20 -- bad decr_mode */ + /* 20 -- invalid flash_incr_mode */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ -1, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 21 -- flash_multiple too small */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 0.09, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 22 -- flash_multiple too big */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 10.001, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 23 -- flash_threshold too small */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 0.099, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 24 -- flash_threshold too big */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 1.001, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 25 -- bad decr_mode */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2748,6 +3043,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ -1, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2759,7 +3058,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 21 -- upper_hr_threshold too big */ + /* 26 -- upper_hr_threshold too big */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2777,6 +3076,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, /* double upper_hr_threshold = */ 1.00001, /* double decrement = */ 0.9, @@ -2788,7 +3091,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 22 -- decrement too small */ + /* 27 -- decrement too small */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2806,6 +3109,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ -0.0000000001, @@ -2817,7 +3124,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 23 -- decrement too big */ + /* 28 -- decrement too big */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2835,6 +3142,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 1.0000000001, @@ -2846,7 +3157,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 24 -- epochs_before_eviction too small */ + /* 29 -- epochs_before_eviction too small */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2864,6 +3175,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2875,7 +3190,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 24 -- epochs_before_eviction too big */ + /* 30 -- epochs_before_eviction too big */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2893,6 +3208,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2904,7 +3223,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 26 -- invalid apply_empty_reserve */ + /* 31 -- invalid apply_empty_reserve */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2922,6 +3241,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2933,7 +3256,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 27 -- empty_reserve too small */ + /* 32 -- empty_reserve too small */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2951,6 +3274,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2962,7 +3289,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 28 -- empty_reserve too big */ + /* 33 -- empty_reserve too big */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2980,6 +3307,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2991,7 +3322,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 29 -- upper_hr_threshold too small */ + /* 34 -- upper_hr_threshold too small */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3009,6 +3340,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ -0.000000001, /* double decrement = */ 0.9, @@ -3020,7 +3355,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 30 -- upper_hr_threshold too big */ + /* 35 -- upper_hr_threshold too big */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3038,6 +3373,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 1.00000001, /* double decrement = */ 0.9, @@ -3049,7 +3388,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 31 -- upper_hr_threshold <= lower_hr_threshold */ + /* 36 -- upper_hr_threshold <= lower_hr_threshold */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3067,6 +3406,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3078,7 +3421,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 32 -- dirty_bytes_threshold too small */ + /* 37 -- dirty_bytes_threshold too small */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3096,6 +3439,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -3107,7 +3454,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (H5C2__MIN_MAX_CACHE_SIZE / 2) - 1 }, { - /* 33 -- dirty_bytes_threshold too big */ + /* 38 -- dirty_bytes_threshold too big */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3125,6 +3472,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3136,7 +3487,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (H5C2__MAX_MAX_CACHE_SIZE / 4) + 1 }, { - /* 34 -- attempt to disable evictions when auto incr enabled */ + /* 39 -- attempt to disable evictions when auto incr enabled */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3154,6 +3505,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__off, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3165,7 +3520,7 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 35 -- attempt to disable evictions when auto decr enabled */ + /* 40 -- attempt to disable evictions when auto decr enabled */ /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3183,6 +3538,10 @@ H5AC2_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C2_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C2_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C2_cache_decr_mode decr_mode = */ H5C2_decr__age_out, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3759,15 +4118,13 @@ check_file_mdc_api_errs(void) int main(void) { + int express_test; + H5open(); skip_long_tests2 = FALSE; -#ifdef NDEBUG - run_full_test2 = TRUE; -#else /* NDEBUG */ - run_full_test2 = FALSE; -#endif /* NDEBUG */ + express_test = GetTestExpress(); #if 1 check_fapl_mdc_api_calls(); diff --git a/test/cache2_common.c b/test/cache2_common.c index be9429b..2ac6dfd 100644 --- a/test/cache2_common.c +++ b/test/cache2_common.c @@ -2101,6 +2101,91 @@ resize_entry2(H5C2_t * cache_ptr, } /* resize_entry2() */ + /*------------------------------------------------------------------------- + * Function: resize_pinned_entry2 + * + * Purpose: Given a pointer to a cache, an entry type, an index, and + * a new size, change the size of the target pinned entry + * to match the supplied new size. + * + * Do nothing if pass is false on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 1/11/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +void +resize_pinned_entry2(H5C2_t * cache_ptr, + int32_t type, + int32_t idx, + size_t new_size) +{ + herr_t result; + test_entry_t * base_addr; + test_entry_t * entry_ptr; + + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= idx ) && ( idx <= max_indices2[type] ) ); + HDassert( type = VARIABLE_ENTRY_TYPE ) ; + HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes2[type] ) ); + + if ( pass2 ) { + + if ( ! entry_in_cache2(cache_ptr, type, idx) ) { + + pass2 = FALSE; + failure_mssg2 = "entry not in cache."; + + } else { + + base_addr = entries2[type]; + entry_ptr = &(base_addr[idx]); + + HDassert( entry_ptr->index == idx ); + HDassert( entry_ptr->type == type ); + HDassert( entry_ptr == entry_ptr->self ); + + if ( ! ( (entry_ptr->header).is_pinned ) ) { + + pass2 = FALSE; + failure_mssg2 = "entry to be resized is not pinned."; + + } else { + + entry_ptr->size = new_size; + + result = H5C2_resize_pinned_entry(cache_ptr, + (void *)entry_ptr, + new_size); + + if ( result != SUCCEED ) { + + pass2 = FALSE; + failure_mssg2 = "error(s) in H5C2_resize_pinned_entry()."; + + } else { + + HDassert( entry_ptr->size = (entry_ptr->header).size ); + + } + } + } + } + + return; + +} /* resize_pinned_entry() */ + + /*------------------------------------------------------------------------- * Function: verify_clean2 * @@ -3114,6 +3199,12 @@ mark_pinned_entry_dirty2(H5C2_t * cache_ptr, entry_ptr->is_dirty = TRUE; + if ( size_changed ) { + + /* update entry size now to keep the sanity checks happy */ + entry_ptr->size = new_size; + } + result = H5C2_mark_pinned_entry_dirty(cache_ptr, (void *)entry_ptr, size_changed, @@ -3126,6 +3217,22 @@ mark_pinned_entry_dirty2(H5C2_t * cache_ptr, ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { +#if 0 /* This is useful debugging code -- keep it around */ + HDfprintf(stdout, "result = %ld.\n", (long)result); + HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n", + (int)(entry_ptr->header.is_dirty)); + HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n", + (int)(entry_ptr->header.is_pinned)); + HDfprintf(stdout, + "(entry_ptr->header.type != &(types[type])) = %d.\n", + (int)(entry_ptr->header.type != &(types[type]))); + HDfprintf(stdout, + "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n", + (long)(entry_ptr->size), (long)(entry_ptr->header.size)); + HDfprintf(stdout, + "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n", + (long)(entry_ptr->addr), (long)(entry_ptr->header.addr)); +#endif pass2 = FALSE; failure_mssg2 = "error in H5C2_mark_pinned_entry_dirty()."; diff --git a/test/cache2_common.h b/test/cache2_common.h index 351f7e8..627b8c6 100644 --- a/test/cache2_common.h +++ b/test/cache2_common.h @@ -697,6 +697,11 @@ void resize_entry2(H5C2_t * cache_ptr, size_t new_size, hbool_t resize_pin); +void resize_pinned_entry2(H5C2_t * cache_ptr, + int32_t type, + int32_t idx, + size_t new_size); + H5C2_t * setup_cache2(size_t max_cache_size, size_t min_clean_size); void row_major_scan_forward2(H5C2_t * cache_ptr, diff --git a/test/cache_api.c b/test/cache_api.c index a1da62f..fcc4664 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -50,6 +50,9 @@ const char *FILENAME[] = { ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ ( (a).decrement == (b).decrement ) && \ @@ -84,7 +87,7 @@ static void check_and_validate_cache_size(hid_t file_id, int32_t * cur_num_entries_ptr, hbool_t dump_data); -static void mdc_api_call_smoke_check(void); +static void mdc_api_call_smoke_check(int express_test); static void check_fapl_mdc_api_errs(void); @@ -139,6 +142,9 @@ static void check_file_mdc_api_errs(void); ( (a).increment == (b).increment ) && \ ( (a).apply_max_increment == (b).apply_max_increment ) && \ ( (a).max_increment == (b).max_increment ) && \ + ( (a).flash_incr_mode == (b).flash_incr_mode ) && \ + ( (a).flash_multiple == (b).flash_multiple ) && \ + ( (a).flash_threshold == (b).flash_threshold ) && \ ( (a).decr_mode == (b).decr_mode ) && \ ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ ( (a).decrement == (b).decrement ) && \ @@ -166,8 +172,14 @@ static void check_file_mdc_api_errs(void); (i).increment = (e).increment; \ (i).apply_max_increment = (e).apply_max_increment; \ (i).max_increment = (e).max_increment; \ + (i).flash_incr_mode = (e).flash_incr_mode; \ + (i).flash_multiple = (e).flash_multiple; \ + (i).flash_threshold = (e).flash_threshold; \ (i).decr_mode = (e).decr_mode; \ (i).upper_hr_threshold = (e).upper_hr_threshold; \ + (i).flash_incr_mode = (e).flash_incr_mode; \ + (i).flash_multiple = (e).flash_multiple; \ + (i).flash_threshold = (e).flash_threshold; \ (i).decrement = (e).decrement; \ (i).apply_max_decrement = (e).apply_max_decrement; \ (i).max_decrement = (e).max_decrement; \ @@ -208,6 +220,10 @@ check_fapl_mdc_api_calls(void) /* double increment = */ 2.1, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.998, /* double decrement = */ 0.91, @@ -695,7 +711,7 @@ validate_mdc_config(hid_t file_id, /* Recall that in any configuration supplied by the cache * at run time, the set_initial_size field will always * be FALSE, regardless of the value passed in. Thus we - * always resume that this field need not match that of + * always presume that this field need not match that of * the supplied external configuration. * * The cache also sets the initial_size field to the current @@ -773,6 +789,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.1, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024 + 1), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.998, /* double decrement = */ 0.91, @@ -802,6 +822,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (2 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 1.5, + /* double flash_threshold = */ 0.4, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.9995, /* double decrement = */ 0.95, @@ -831,6 +855,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.1, + /* double flash_threshold = */ 0.6, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -860,6 +888,10 @@ check_file_mdc_api_calls(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (2 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 1.1, + /* double flash_threshold = */ 0.3, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, @@ -1344,7 +1376,7 @@ check_and_validate_cache_size(hid_t file_id, #define NUM_RANDOM_ACCESSES 200000 static void -mdc_api_call_smoke_check(void) +mdc_api_call_smoke_check(int express_test) { const char * fcn_name = "mdc_api_call_smoke_check()"; char filename[512]; @@ -1389,6 +1421,10 @@ mdc_api_call_smoke_check(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -1418,6 +1454,10 @@ mdc_api_call_smoke_check(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -1447,6 +1487,10 @@ mdc_api_call_smoke_check(void) /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ FALSE, /* size_t max_increment = */ 4000000, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -1460,6 +1504,15 @@ mdc_api_call_smoke_check(void) TESTING("MDC API smoke check"); + if ( express_test > 0 ) { + + SKIPPED(); + + HDfprintf(stdout, " Long tests disabled.\n"); + + return; + } + pass = TRUE; /* Open a file with the default FAPL. Verify that the cache is @@ -2092,7 +2145,7 @@ mdc_api_call_smoke_check(void) * used to test error rejection in the MDC related API calls. */ -#define NUM_INVALID_CONFIGS 36 +#define NUM_INVALID_CONFIGS 41 H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = { @@ -2115,6 +2168,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2143,6 +2200,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double lower_hr_threshold = */ 0.9, /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, @@ -2173,6 +2234,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2202,6 +2267,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2231,6 +2300,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2260,6 +2333,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2289,6 +2366,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2318,6 +2399,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2347,6 +2432,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2376,6 +2465,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2405,6 +2498,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2434,6 +2531,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2463,6 +2564,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2492,6 +2597,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2521,6 +2630,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2550,6 +2663,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2579,6 +2696,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2608,6 +2729,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2637,6 +2762,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 0.999999999999, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2666,6 +2795,142 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ (hbool_t)-1, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 20 -- invalid flash_incr_mode */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ -1, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 21 -- flash_multiple too small */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 0.09, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 22 -- flash_multiple too big */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 10.001, + /* double flash_threshold = */ 0.5, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 23 -- flash_threshold too small */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 0.099, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2677,7 +2942,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 20 -- bad decr_mode */ + /* 24 -- flash_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2695,6 +2960,43 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__add_space, + /* double flash_multiple = */ 1.0, + /* double flash_threshold = */ 1.001, + /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, + /* double upper_hr_threshold = */ 0.999, + /* double decrement = */ 0.9, + /* hbool_t apply_max_decrement = */ TRUE, + /* size_t max_decrement = */ (1 * 1024 * 1024), + /* int epochs_before_eviction = */ 3, + /* hbool_t apply_empty_reserve = */ TRUE, + /* double empty_reserve = */ 0.1, + /* int dirty_bytes_threshold = */ (256 * 1024) + }, + { + /* 25 -- bad decr_mode */ + /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, + /* hbool_t rpt_fcn_enabled = */ FALSE, + /* hbool_t open_trace_file = */ FALSE, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ TRUE, + /* hbool_t set_initial_size = */ TRUE, + /* size_t initial_size = */ (1 * 1024 * 1024), + /* double min_clean_fraction = */ 0.25, + /* size_t max_size = */ (16 * 1024 * 1024), + /* size_t min_size = */ ( 1 * 1024 * 1024), + /* long int epoch_length = */ 50000, + /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, + /* double lower_hr_threshold = */ 0.9, + /* double increment = */ 2.0, + /* hbool_t apply_max_increment = */ TRUE, + /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ -1, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2706,7 +3008,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 21 -- upper_hr_threshold too big */ + /* 26 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2724,6 +3026,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 1.00001, /* double decrement = */ 0.9, @@ -2735,7 +3041,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 22 -- decrement too small */ + /* 27 -- decrement too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2753,6 +3059,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ -0.0000000001, @@ -2764,7 +3074,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 23 -- decrement too big */ + /* 28 -- decrement too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2782,6 +3092,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 1.0000000001, @@ -2793,7 +3107,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 24 -- epochs_before_eviction too small */ + /* 29 -- epochs_before_eviction too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2811,6 +3125,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2822,7 +3140,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 24 -- epochs_before_eviction too big */ + /* 30 -- epochs_before_eviction too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2840,6 +3158,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2851,7 +3173,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 26 -- invalid apply_empty_reserve */ + /* 31 -- invalid apply_empty_reserve */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2869,6 +3191,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2880,7 +3206,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 27 -- empty_reserve too small */ + /* 32 -- empty_reserve too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2898,6 +3224,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2909,7 +3239,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 28 -- empty_reserve too big */ + /* 33 -- empty_reserve too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2927,6 +3257,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -2938,7 +3272,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 29 -- upper_hr_threshold too small */ + /* 34 -- upper_hr_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2956,6 +3290,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ -0.000000001, /* double decrement = */ 0.9, @@ -2967,7 +3305,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 30 -- upper_hr_threshold too big */ + /* 35 -- upper_hr_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -2985,6 +3323,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 1.00000001, /* double decrement = */ 0.9, @@ -2996,7 +3338,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 31 -- upper_hr_threshold <= lower_hr_threshold */ + /* 36 -- upper_hr_threshold <= lower_hr_threshold */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3014,6 +3356,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3025,7 +3371,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 32 -- dirty_bytes_threshold too small */ + /* 37 -- dirty_bytes_threshold too small */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3043,6 +3389,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.999, /* double decrement = */ 0.9, @@ -3054,7 +3404,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (H5C__MIN_MAX_CACHE_SIZE / 2) - 1 }, { - /* 33 -- dirty_bytes_threshold too big */ + /* 38 -- dirty_bytes_threshold too big */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3072,6 +3422,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3083,7 +3437,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (H5C__MAX_MAX_CACHE_SIZE / 4) + 1 }, { - /* 34 -- attempt to disable evictions when auto incr enabled */ + /* 39 -- attempt to disable evictions when auto incr enabled */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3101,6 +3455,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3112,7 +3470,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* int dirty_bytes_threshold = */ (256 * 1024) }, { - /* 35 -- attempt to disable evictions when auto decr enabled */ + /* 40 -- attempt to disable evictions when auto decr enabled */ /* int version = */ H5C__CURR_AUTO_SIZE_CTL_VER, /* hbool_t rpt_fcn_enabled = */ FALSE, /* hbool_t open_trace_file = */ FALSE, @@ -3130,6 +3488,10 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* double increment = */ 2.0, /* hbool_t apply_max_increment = */ TRUE, /* size_t max_increment = */ (4 * 1024 * 1024), + /* enum H5C_cache_flash_incr_mode */ + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0, + /* double flash_threshold = */ 0.5, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, /* double upper_hr_threshold = */ 0.9, /* double decrement = */ 0.9, @@ -3669,15 +4031,11 @@ check_file_mdc_api_errs(void) int main(void) { - H5open(); + int express_test; - skip_long_tests = FALSE; + H5open(); -#ifdef NDEBUG - run_full_test = TRUE; -#else /* NDEBUG */ - run_full_test = FALSE; -#endif /* NDEBUG */ + express_test = GetTestExpress(); #if 1 check_fapl_mdc_api_calls(); @@ -3685,8 +4043,8 @@ main(void) #if 1 check_file_mdc_api_calls(); #endif -#if 0 - mdc_api_call_smoke_check(); +#if 1 + mdc_api_call_smoke_check(express_test); #endif #if 1 check_fapl_mdc_api_errs(); diff --git a/test/cache_common.c b/test/cache_common.c index d2be959..25eb988 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -1722,6 +1722,91 @@ resize_entry(H5C_t * cache_ptr, /*------------------------------------------------------------------------- + * Function: resize_pinned_entry + * + * Purpose: Given a pointer to a cache, an entry type, an index, and + * a new size, change the size of the target pinned entry + * to match the supplied new size. + * + * Do nothing if pass is false on entry. + * + * Return: void + * + * Programmer: John Mainzer + * 1/11/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +void +resize_pinned_entry(H5C_t * cache_ptr, + int32_t type, + int32_t idx, + size_t new_size) +{ + herr_t result; + test_entry_t * base_addr; + test_entry_t * entry_ptr; + + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); + HDassert( type = VARIABLE_ENTRY_TYPE ) ; + HDassert( ( 0 < new_size ) && ( new_size <= entry_sizes[type] ) ); + + if ( pass ) { + + if ( ! entry_in_cache(cache_ptr, type, idx) ) { + + pass = FALSE; + failure_mssg = "entry not in cache."; + + } else { + + base_addr = entries[type]; + entry_ptr = &(base_addr[idx]); + + HDassert( entry_ptr->index == idx ); + HDassert( entry_ptr->type == type ); + HDassert( entry_ptr == entry_ptr->self ); + + if ( ! ( (entry_ptr->header).is_pinned ) ) { + + pass = FALSE; + failure_mssg = "entry to be resized is not pinned."; + + } else { + + entry_ptr->size = new_size; + + result = H5C_resize_pinned_entry(cache_ptr, + (void *)entry_ptr, + new_size); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "error(s) in H5C_resize_pinned_entry()."; + + } else { + + HDassert( entry_ptr->size = (entry_ptr->header).size ); + + } + } + } + } + + return; + +} /* resize_pinned_entry() */ + + +/*------------------------------------------------------------------------- * Function: verify_clean * * Purpose: Verify that all cache entries are marked as clean. If any @@ -2460,6 +2545,12 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, entry_ptr->is_dirty = TRUE; + if ( size_changed ) { + + /* update entry size now to keep the sanity checks happy */ + entry_ptr->size = new_size; + } + result = H5C_mark_pinned_entry_dirty(cache_ptr, (void *)entry_ptr, size_changed, @@ -2472,6 +2563,22 @@ mark_pinned_entry_dirty(H5C_t * cache_ptr, ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { +#if 0 /* This is useful debugging code -- keep it around */ + HDfprintf(stdout, "result = %ld.\n", (long)result); + HDfprintf(stdout, "entry_ptr->header.is_dirty = %d.\n", + (int)(entry_ptr->header.is_dirty)); + HDfprintf(stdout, "entry_ptr->header.is_pinned = %d.\n", + (int)(entry_ptr->header.is_pinned)); + HDfprintf(stdout, + "(entry_ptr->header.type != &(types[type])) = %d.\n", + (int)(entry_ptr->header.type != &(types[type]))); + HDfprintf(stdout, + "entry_ptr->size = %ld, entry_ptr->header.size = %ld.\n", + (long)(entry_ptr->size), (long)(entry_ptr->header.size)); + HDfprintf(stdout, + "entry_ptr->addr = %ld, entry_ptr->header.addr = %ld.\n", + (long)(entry_ptr->addr), (long)(entry_ptr->header.addr)); +#endif pass = FALSE; failure_mssg = "error in H5C_mark_pinned_entry_dirty()."; diff --git a/test/cache_common.h b/test/cache_common.h index 23832dc..e1d33f2 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -655,6 +655,11 @@ void resize_entry(H5C_t * cache_ptr, size_t new_size, hbool_t resize_pin); +void resize_pinned_entry(H5C_t * cache_ptr, + int32_t type, + int32_t idx, + size_t new_size); + H5C_t * setup_cache(size_t max_cache_size, size_t min_clean_size); void row_major_scan_forward(H5C_t * cache_ptr, diff --git a/test/tbogus.h5 b/test/tbogus.h5 Binary files differindex 2b8b1dd..6d6f15f 100644 --- a/test/tbogus.h5 +++ b/test/tbogus.h5 diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 243caa1..c5f8aae 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -5281,7 +5281,7 @@ trace_file_check(void) const char * expected_output[] = { "### HDF5 metadata cache trace file version 1 ###\n", - "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 1048576 0.500000 16777216 1048576 50000 1 0.900000 2.000000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0\n", + "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 1048576 0.500000 16777216 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0\n", "H5AC_set 0x0 15 0x0 2 0\n", "H5AC_set 0x2 15 0x0 2 0\n", "H5AC_set 0x4 15 0x0 4 0\n", diff --git a/testpar/t_cache2.c b/testpar/t_cache2.c index da527b1..aa64bea 100644 --- a/testpar/t_cache2.c +++ b/testpar/t_cache2.c @@ -5556,8 +5556,12 @@ smoke_check_5(void) * Modifications: * * JRM -- 7/11/06 - * Updated fro H5AC2_expunge_entry() and + * Updated for H5AC2_expunge_entry() and * H5AC2_resize_pinned_entry(). + * + * JRM -- 2/14/08 + * Updated for changes in H5AC2_set_cache_auto_resize_config + * to support the new flash cache size increment code. * *****************************************************************************/ @@ -5571,8 +5575,8 @@ trace_file_check(void) const char * fcn_name = "trace_file_check()"; const char * expected_output[] = { - "### HDF5 metadata cache trace file version 1 ###\n", - "H5AC2_set_cache_auto_resize_config 1 0 1 0 \"t_cache2_trace.txt\" 1 0 1048576 0.500000 16777216 1048576 50000 1 0.900000 2.000000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0\n", + "### HDF5 metadata cache trace file version 2 ###\n", + "H5AC2_set_cache_auto_resize_config 1 0 1 0 \"t_cache2_trace.txt\" 1 0 1048576 0.500000 16777216 1048576 50000 1 0.900000 2.000000 1 4194304 1 1.000000 0.250000 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0\n", "H5AC2_set 0x400 2 15 0x0 2 0\n", "H5AC2_set 0x402 2 15 0x0 2 0\n", "H5AC2_set 0x404 4 15 0x0 4 0\n", |