diff options
-rw-r--r-- | src/H5AC.c | 126 | ||||
-rw-r--r-- | src/H5ACprivate.h | 2 | ||||
-rw-r--r-- | src/H5ACpublic.h | 33 | ||||
-rw-r--r-- | src/H5C.c | 140 | ||||
-rw-r--r-- | src/H5Cpkg.h | 14 | ||||
-rw-r--r-- | src/H5Cprivate.h | 10 | ||||
-rw-r--r-- | test/cache.c | 1456 | ||||
-rw-r--r-- | test/cache_api.c | 155 | ||||
-rw-r--r-- | testpar/t_cache.c | 32 |
9 files changed, 1868 insertions, 100 deletions
@@ -2537,6 +2537,15 @@ done: * JRM - 6/8/06 * Added support for the new trace file related fields. * + * JRM - 7/28/07 + * Added support for the new evictions enabled related fields. + * + * Observe that H5AC_get_cache_auto_resize_config() and + * H5AC_set_cache_auto_resize_config() are becoming generic + * metadata cache configuration routines as they gain + * switches for functions that are only tenuously related + * to auto resize configuration. + * *------------------------------------------------------------------------- */ @@ -2546,6 +2555,7 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, { herr_t result; herr_t ret_value = SUCCEED; /* Return value */ + hbool_t evictions_enabled; H5C_auto_size_ctl_t internal_config; FUNC_ENTER_NOAPI(H5AC_get_cache_auto_resize_config, FAIL) @@ -2581,6 +2591,14 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, "H5C_get_cache_auto_resize_config() failed.") } + result = H5C_get_evictions_enabled((H5C_t *)cache_ptr, &evictions_enabled); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5C_get_resize_enabled() failed.") + } + if ( internal_config.rpt_fcn == NULL ) { config_ptr->rpt_fcn_enabled = FALSE; @@ -2593,6 +2611,8 @@ H5AC_get_cache_auto_resize_config(H5AC_t * cache_ptr, config_ptr->open_trace_file = FALSE; config_ptr->close_trace_file = FALSE; config_ptr->trace_file_name[0] = '\0'; + config_ptr->set_evictions_enabled = FALSE; + config_ptr->evictions_enabled = evictions_enabled; config_ptr->set_initial_size = internal_config.set_initial_size; config_ptr->initial_size = internal_config.initial_size; config_ptr->min_clean_fraction = internal_config.min_clean_fraction; @@ -2788,6 +2808,15 @@ done: * John Mainzer -- 6/7/06 * Added trace file support. * + * John Mainzer -- 7/28/07 + * Added support for the new evictions enabled related fields. + * + * Observe that H5AC_get_cache_auto_resize_config() and + * H5AC_set_cache_auto_resize_config() are becoming generic + * metadata cache configuration routines as they gain + * switches for functions that are only tenuously related + * to auto resize configuration. + * *------------------------------------------------------------------------- */ @@ -2835,56 +2864,11 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") } - if ( config_ptr == NULL ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") - } - - if ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") - } - - if ( ( config_ptr->rpt_fcn_enabled != TRUE ) && - ( config_ptr->rpt_fcn_enabled != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->rpt_fcn_enabled must be either TRUE or FALSE.") - } - - if ( ( config_ptr->open_trace_file != TRUE ) && - ( config_ptr->open_trace_file != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->open_trace_file must be either TRUE or FALSE.") - } - - if ( ( config_ptr->close_trace_file != TRUE ) && - ( config_ptr->close_trace_file != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->close_trace_file must be either TRUE or FALSE.") - } - - /* don't bother to test trace_file_name unless open_trace_file is TRUE */ - if ( config_ptr->open_trace_file ) { - - /* Can't really test the trace_file_name field without trying to - * open the file, so we will content ourselves with a couple of - * sanity checks on the length of the file name. - */ - name_len = HDstrlen(config_ptr->trace_file_name); - - if ( name_len <= 0 ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->trace_file_name is empty.") + result = H5AC_validate_config(config_ptr); - } else if ( name_len > H5AC__MAX_TRACE_FILE_NAME_LEN ) { + if ( result != SUCCEED ) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->trace_file_name too long.") - } + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad cache configuration"); } if ( config_ptr->open_trace_file ) { @@ -2957,6 +2941,18 @@ H5AC_set_cache_auto_resize_config(H5AC_t * cache_ptr, "H5C_set_cache_auto_resize_config() failed.") } + if ( config_ptr->set_evictions_enabled ) { + + result = H5C_set_evictions_enabled((H5C_t *)cache_ptr, + config_ptr->evictions_enabled); + + if ( result < 0 ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5C_set_evictions_enabled() failed.") + } + } + #ifdef H5_HAVE_PARALLEL if ( cache_ptr->aux_ptr != NULL ) { @@ -2977,13 +2973,15 @@ done: ( trace_file_ptr != NULL ) ) { HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %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 %d %f %d %d %ld %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), (int)(trace_config.open_trace_file), (int)(trace_config.close_trace_file), trace_config.trace_file_name, + (int)(trace_config.set_evictions_enabled), + (int)(trace_config.evictions_enabled), (int)(trace_config.set_initial_size), (int)(trace_config.initial_size), trace_config.min_clean_fraction, @@ -3041,6 +3039,13 @@ done: * are applied. * JRM - 5/15/06 * + * - Added code testing the evictions enabled field. At + * present this consists of verifying that if + * set_evictions_enabled is TRUE and evictions_enabled + * is FALSE, then automatic cache resizing in disabled. + * + * JRM - 7/28/07 + * *------------------------------------------------------------------------- */ @@ -3107,6 +3112,29 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr) } } + if ( ( config_ptr->set_evictions_enabled != TRUE ) && + ( config_ptr->set_evictions_enabled != FALSE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->set_evictions_enabled must be either TRUE or FALSE.") + } + + if ( ( config_ptr->evictions_enabled != TRUE ) && + ( config_ptr->evictions_enabled != FALSE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->evictions_enabled must be either TRUE or FALSE.") + } + + if ( ( config_ptr->set_evictions_enabled == TRUE ) && + ( config_ptr->evictions_enabled == FALSE ) && + ( ( config_ptr->incr_mode != H5C_incr__off ) || + ( config_ptr->incr_mode != H5C_decr__off ) ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "Can't disable evictions while auto-resize is enabled.") + } + if ( config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 34ca4ef..0d10c88 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -201,6 +201,8 @@ extern hid_t H5AC_ind_dxpl_id; /* hbool_t open_trace_file = */ FALSE, \ /* hbool_t close_trace_file = */ FALSE, \ /* char trace_file_name[] = */ "", \ + /* hbool_t set_evictions_enabled = */ FALSE, \ + /* hbool_t evictions_enabled = */ TRUE, \ /* hbool_t set_initial_size = */ TRUE, \ /* size_t initial_size = */ ( 1 * 1024 * 1024), \ /* double min_clean_fraction = */ 0.5, \ diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 362b14f..76e5530 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -107,6 +107,30 @@ extern "C" { * The length of the path must not exceed H5AC__MAX_TRACE_FILE_NAME_LEN * characters. * + * set_evictions_enabled: Boolean flag indicating whether the cache + * evictions_enabled flag is to be set to the value specified + * in the evictions_enabled field below. + * + * evictions_enabled: Boolean field used to either report the current + * evictions enabled status of the cache, or, when + * set_evictions_enabled is TRUE, to set the cache's evictions + * enabled status. + * + * In general, the metadata cache should always be allowed to + * evict entries. However, in some cases it is advantageous to + * disable evictions briefly, and thereby postpone metadata + * writes. However, this must be done with care, as the cache + * can grow quickly. If you do this, re-enable evictions as + * soon as possible and monitor cache size. + * + * At present, evictions can only be disabled if automatic + * cache resizing is also disabled (that is, ( incr_mode == + * H5C_incr__off ) && ( decr_mode == H5C_decr__off )). There + * is no logical reason why this should be so, but it simplifies + * implementation and testing, and I can't think of any reason + * why it would be desireable. If you can think of one, I'll + * revisit the issue. + * * set_initial_size: Boolean flag indicating whether the size of the * initial size of the cache is to be set to the value given in * the initial_size field. If set_initial_size is FALSE, the @@ -160,6 +184,9 @@ extern "C" { * at its maximum size, or if the cache is not already using * all available space. * + * Note that you must set decr_mode to H5C_incr__off if you + * disable metadata cache entry evictions. + * * lower_hr_threshold: Lower hit rate threshold. If the increment mode * (incr_mode) is H5C_incr__threshold and the hit rate drops below the * value supplied in this field in an epoch, increment the cache size by @@ -217,6 +244,9 @@ extern "C" { * over the last epoch exceeds the value provided in the * upper_hr_threshold field. * + * Note that you must set decr_mode to H5C_decr__off if you + * disable metadata cache entry evictions. + * * upper_hr_threshold: Upper hit rate threshold. The use of this field * varies according to the current decr_mode: * @@ -316,6 +346,9 @@ typedef struct H5AC_cache_config_t hbool_t close_trace_file; char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1]; + hbool_t set_evictions_enabled; + hbool_t evictions_enabled; + hbool_t set_initial_size; size_t initial_size; @@ -2835,6 +2835,10 @@ done: * Added initialization for the new is_read_only and * ro_ref_count fields. * + * JRM -- 7/27/07 +* Added initialization for the new evictions_enabled +* field of H5C_t. + * *------------------------------------------------------------------------- */ @@ -2906,6 +2910,8 @@ H5C_create(size_t max_cache_size, cache_ptr->log_flush = log_flush; + cache_ptr->evictions_enabled = TRUE; + cache_ptr->index_len = 0; cache_ptr->index_size = (size_t)0; @@ -4260,6 +4266,52 @@ done: /*------------------------------------------------------------------------- + * Function: H5C_get_evictions_enabled() + * + * Purpose: Copy the current value of cache_ptr->evictions_enabled into + * *evictions_enabled_ptr. + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Programmer: John Mainzer + * 7/27/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5C_get_evictions_enabled(H5C_t * cache_ptr, + hbool_t * evictions_enabled_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5C_get_evictions_enabled, FAIL) + + if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + } + + if ( evictions_enabled_ptr == NULL ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Bad evictions_enabled_ptr on entry.") + } + + *evictions_enabled_ptr = cache_ptr->evictions_enabled; + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_get_evictions_enabled() */ + + +/*------------------------------------------------------------------------- * Function: H5C_get_trace_file_ptr * * Purpose: Get the trace_file_ptr field from the cache. @@ -4378,6 +4430,10 @@ done: * Added initialization for the new is_read_only and * ro_ref_count fields. * + * JRM -- 8/1/07 + * Added code to disable evictions when the new + * evictions_enabled field is FALSE. + * *------------------------------------------------------------------------- */ @@ -4468,7 +4524,9 @@ H5C_insert_entry(H5F_t * f, H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) - if ((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) { + if ( ( cache_ptr->evictions_enabled ) && + ( (cache_ptr->index_size + entry_ptr->size) > + cache_ptr->max_cache_size ) ) { size_t space_needed; @@ -5545,6 +5603,10 @@ done: * Also added code to allow multiple read only protects * of cache entries. * + * JRM -- 7/27/07 + * Added code supporting the new evictions_enabled fieled + * in H5C_t. + * *------------------------------------------------------------------------- */ @@ -5616,9 +5678,10 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; - /* try to free up some space if necessary */ - if ( (cache_ptr->index_size + entry_ptr->size) > - cache_ptr->max_cache_size ) { + /* 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 ) ) { size_t space_needed; @@ -5754,10 +5817,11 @@ H5C_protect(H5F_t * f, ret_value = thing; - if ( ( cache_ptr->size_decreased ) || - ( ( cache_ptr->resize_enabled ) && - ( cache_ptr->cache_accesses >= - (cache_ptr->resize_ctl).epoch_length ) ) ) { + if ( ( cache_ptr->evictions_enabled ) && + ( ( cache_ptr->size_decreased ) || + ( ( cache_ptr->resize_enabled ) && + ( cache_ptr->cache_accesses >= + (cache_ptr->resize_ctl).epoch_length ) ) ) ) { if ( ! have_write_permitted ) { @@ -6140,6 +6204,66 @@ done: /*------------------------------------------------------------------------- + * Function: H5C_set_evictions_enabled() + * + * Purpose: Set cache_ptr->evictions_enabled to the value of the + * evictions enabled parameter. + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Programmer: John Mainzer + * 7/27/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5C_set_evictions_enabled(H5C_t * cache_ptr, + hbool_t evictions_enabled) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5C_set_evictions_enabled, FAIL) + + if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + } + + if ( ( evictions_enabled != TRUE ) && ( evictions_enabled != FALSE ) ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Bad evictions_enabled on entry.") + } + + /* There is no fundamental reason why we should not permit + * evictions to be disabled while automatic resize is enabled. + * However, I can't think of any good reason why one would + * want to, and allowing it would greatly complicate testing + * the feature. Hence the following: + */ + if ( ( evictions_enabled != TRUE ) && + ( ( cache_ptr->resize_ctl.incr_mode != H5C_incr__off ) || + ( cache_ptr->resize_ctl.decr_mode != H5C_decr__off ) ) ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Can't disable evictions when auto resize enabled.") + } + + cache_ptr->evictions_enabled = evictions_enabled; + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C_set_evictions_enabled() */ + + +/*------------------------------------------------------------------------- * Function: H5C_set_prefix * * Purpose: Set the values of the prefix field of H5C_t. This diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 3b8d650..949f923 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -176,6 +176,18 @@ * entry is flushed to disk. * * + * In cases where memory is plentiful, and performance is an issue, it + * is useful to disable all cache evictions, and thereby postpone metadata + * writes. The following field is used to implement this. + * + * evictions_enabled: Boolean flag that is initialized to TRUE. When + * this flag is set to FALSE, the metadata cache will not + * attempt to evict entries to make space for newly protected + * entries, and instead the will grow without limit. + * + * Needless to say, this feature must be used with care. + * + * * The cache requires an index to facilitate searching for entries. The * following fields support that index. * @@ -802,6 +814,8 @@ struct H5C_t H5C_log_flush_func_t log_flush; + hbool_t evictions_enabled; + int32_t index_len; size_t index_size; H5C_cache_entry_t * (index[H5C__HASH_TABLE_LEN]); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index d3fcbeb..e169bd6 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -37,7 +37,7 @@ #include "H5Fprivate.h" /* File access */ -#define H5C_DO_SANITY_CHECKS 0 +#define H5C_DO_SANITY_CHECKS 1 #define H5C_DO_EXTREME_SANITY_CHECKS 0 /* This sanity checking constant was picked out of the air. Increase @@ -51,7 +51,7 @@ /* H5C_COLLECT_CACHE_STATS controls overall collection of statistics * on cache activity. In general, this #define should be set to 0. */ -#define H5C_COLLECT_CACHE_STATS 0 +#define H5C_COLLECT_CACHE_STATS 1 /* H5C_COLLECT_CACHE_ENTRY_STATS controls collection of statistics * in individual cache entries. @@ -901,6 +901,9 @@ H5_DLL herr_t H5C_get_entry_status(H5C_t * cache_ptr, hbool_t * is_protected_ptr, hbool_t * is_pinned_ptr); +H5_DLL herr_t H5C_get_evictions_enabled(H5C_t * cache_ptr, + hbool_t * evictions_enabled_ptr); + H5_DLL herr_t H5C_get_trace_file_ptr(H5C_t * cache_ptr, FILE ** trace_file_ptr_ptr); @@ -955,6 +958,9 @@ H5_DLL herr_t H5C_resize_pinned_entry(H5C_t * cache_ptr, H5_DLL herr_t H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, H5C_auto_size_ctl_t *config_ptr); +H5_DLL herr_t H5C_set_evictions_enabled(H5C_t * cache_ptr, + hbool_t evictions_enabled); + H5_DLL herr_t H5C_set_prefix(H5C_t * cache_ptr, char * prefix); H5_DLL herr_t H5C_set_skip_flags(H5C_t * cache_ptr, diff --git a/test/cache.c b/test/cache.c index b4caa68..a0bc5b1 100644 --- a/test/cache.c +++ b/test/cache.c @@ -34,6 +34,8 @@ static void smoke_check_5(void); static void smoke_check_6(void); static void smoke_check_7(void); static void smoke_check_8(void); +static void smoke_check_9(void); +static void smoke_check_10(void); static void write_permitted_check(void); static void check_insert_entry(void); static void check_flush_cache(void); @@ -98,6 +100,7 @@ static void check_rename_entry__run_test(H5C_t * cache_ptr, int test_num, struct rename_entry_test_spec * spec_ptr); static void check_pin_protected_entry(void); static void check_resize_entry(void); +static void check_evictions_enabled(void); static void check_destroy_pinned_err(void); static void check_destroy_protected_err(void); static void check_duplicate_insert_err(void); @@ -112,6 +115,7 @@ static void check_expunge_entry_errs(void); static void check_resize_entry_errs(void); static void check_unprotect_ro_dirty_err(void); static void check_protect_ro_rw_err(void); +static void check_check_evictions_enabled_err(void); static void check_auto_cache_resize(void); static void check_auto_cache_resize_disable(void); static void check_auto_cache_resize_epoch_markers(void); @@ -1842,6 +1846,615 @@ smoke_check_8(void) /*------------------------------------------------------------------------- + * Function: smoke_check_9() + * + * Purpose: A repeat of smoke check 1, only with the cache corked + * part of the time. + * + * Recall that smoke check 1 is a basic functional test, + * with inserts, destroys, and renames in the mix, along + * with repeated protects and unprotects. All entries are + * marked as clean. + * + * Return: void + * + * Programmer: John Mainzer + * 8/1/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +smoke_check_9(void) +{ + const char * fcn_name = "smoke_check_9"; + herr_t result; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = FALSE; + int dirty_unprotects = FALSE; + int dirty_destroys = FALSE; + hbool_t display_stats = FALSE; + hbool_t display_detailed_stats = FALSE; + int32_t lag = 10; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; + + TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked"); + + if ( skip_long_tests ) { + + SKIPPED(); + + HDfprintf(stdout, " Long tests disabled.\n"); + + return; + } + + pass = TRUE; + + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + reset_entries(); + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + (size_t)(2 * 1024 * 1024)); + + /* disable evictions */ + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 1.\n"; + } + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", + fcn_name, mile_stone++, (int)pass); + + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* do_mult_ro_protects */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); + + /* enable evictions */ + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't enable evictions 1.\n"; + } + } + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", + fcn_name, mile_stone++, (int)pass); + + row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ TRUE, + /* do_destroys */ FALSE, + /* do_mult_ro_protects */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 2.\n"; + } + } + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled \n", + fcn_name, mile_stone++, (int)pass); + + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ FALSE, + /* do_mult_ro_protects */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't enable evictions 2.\n"; + } + } + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled \n", + fcn_name, mile_stone++, (int)pass); + + /* flush and destroy all entries in the cache: */ + + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); + + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 3.\n"; + } + } + + if ( show_progress ) /* 12 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", + fcn_name, mile_stone++, (int)pass); + + col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 13 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* flush all entries in the cache: */ + + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); + + if ( show_progress ) /* 14 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't enable evictions 3.\n"; + } + } + + if ( show_progress ) /* 15 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", + fcn_name, mile_stone++, (int)pass); + + col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 16 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 4.\n"; + } + } + + + if ( show_progress ) /* 17 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", + fcn_name, mile_stone++, (int)pass); + + takedown_cache(cache_ptr, display_stats, TRUE); + + if ( show_progress ) /* 18 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + verify_clean(); + verify_unprotected(); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* smoke_check_9() */ + + +/*------------------------------------------------------------------------- + * Function: smoke_check_10() + * + * Purpose: A repeat of smoke check 2, only with the cache corked + * part of the time. + * + * Recall that smoke check 2 is a basic functional test, + * with inserts, destroys, and renames in the mix, along + * with some repeated protects and unprotects. About half + * the entries are marked as dirty. + * + * Return: void + * + * Programmer: John Mainzer + * 8/1/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +smoke_check_10(void) +{ + const char * fcn_name = "smoke_check_10"; + herr_t result; + hbool_t show_progress = FALSE; + hbool_t dirty_inserts = TRUE; + int dirty_unprotects = TRUE; + int dirty_destroys = TRUE; + hbool_t display_stats = FALSE; + hbool_t display_detailed_stats = FALSE; + int32_t lag = 10; + int mile_stone = 1; + H5C_t * cache_ptr = NULL; + + TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked"); + + if ( skip_long_tests ) { + + SKIPPED(); + + HDfprintf(stdout, " Long tests disabled.\n"); + + return; + } + + pass = TRUE; + + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + reset_entries(); + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + cache_ptr = setup_cache((size_t)(4 * 1024 * 1024), + (size_t)(2 * 1024 * 1024)); + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", + fcn_name, mile_stone++, (int)pass); + + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ TRUE, + /* do_mult_ro_protects */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 1.\n"; + } + } + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", + fcn_name, mile_stone++, (int)pass); + + row_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ FALSE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ TRUE, + /* do_destroys */ FALSE, + /* do_mult_ro_protects */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't enable evictions 1.\n"; + } + } + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", + fcn_name, mile_stone++, (int)pass); + + row_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* do_renames */ TRUE, + /* rename_to_main_addr */ FALSE, + /* do_destroys */ FALSE, + /* do_mult_ro_protects */ TRUE, + /* dirty_destroys */ dirty_destroys, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 2.\n"; + } + } + + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", + fcn_name, mile_stone++, (int)pass); + + /* flush and destroy all entries in the cache: */ + + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ TRUE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't enable evictions 2.\n"; + } + } + + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", + fcn_name, mile_stone++, (int)pass); + + col_major_scan_forward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 12 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 3.\n"; + } + } + + if ( show_progress ) /* 13 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", + fcn_name, mile_stone++, (int)pass); + + /* flush all entries in the cache: */ + + flush_cache(/* cache_ptr */ cache_ptr, + /* destroy_entries */ FALSE, + /* dump_stats */ FALSE, + /* dump_detailed_stats */ FALSE); + + if ( show_progress ) /* 14 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't enable evictions 3.\n"; + } + } + + if ( show_progress ) /* 15 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions enabled\n", + fcn_name, mile_stone++, (int)pass); + + col_major_scan_backward(/* cache_ptr */ cache_ptr, + /* lag */ lag, + /* verbose */ FALSE, + /* reset_stats */ TRUE, + /* display_stats */ display_stats, + /* display_detailed_stats */ display_detailed_stats, + /* do_inserts */ TRUE, + /* dirty_inserts */ dirty_inserts, + /* dirty_unprotects */ dirty_unprotects); + + if ( show_progress ) /* 16 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result < 0 ) { + + pass = FALSE; + failure_mssg = "can't disable evictions 4.\n"; + } + } + + if ( show_progress ) /* 17 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d -- evictions disabled\n", + fcn_name, mile_stone++, (int)pass); + + takedown_cache(cache_ptr, display_stats, TRUE); + + if ( show_progress ) /* 18 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + verify_clean(); + verify_unprotected(); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* smoke_check_10() */ + + +/*------------------------------------------------------------------------- * Function: write_permitted_check() * * Purpose: A basic test of the write permitted function. In essence, @@ -14393,6 +15006,708 @@ check_resize_entry(void) /*------------------------------------------------------------------------- + * Function: check_evictions_enabled() + * + * Purpose: Verify that H5C_get_evictions_enabled() and + * H5C_set_evictions_enabled() functions perform as expected. + * + * Return: void + * + * Programmer: John Mainzer + * 8/2/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +check_evictions_enabled(void) +{ + const char * fcn_name = "check_evictions_enabled"; + static char msg[128]; + herr_t result; + hbool_t show_progress = FALSE; + hbool_t evictions_enabled; + hbool_t in_cache; + int i; + int mile_stone = 1; + size_t entry_size; + H5C_t * cache_ptr = NULL; + test_entry_t * base_addr; + test_entry_t * entry_ptr; + + TESTING("evictions enabled/disabled functionality"); + + /* Setup a cache and verify that it is empty. + * + * Use H5C_get_evictions_enabled() to determine if evictions are + * currently enabled -- they should be. + * + * Load entries until the cache is full. Load one more. Verify that + * this caused an entry to be evicted. + * + * Insert an entry. Verify that this cases and entry to be evicted. + * + * Used H5C_set_evictions_enabled() to disable evictions. Verify + * with a call to H5C_get_evictions_enabled(). + * + * Load another entry -- verify that this does not cause an entry + * to be evicted. + * + * Insert an entry -- verify that this does not cause an entry to + * be evicted. + * + * Use H5C_set_evictions_enabled() to re-enable evictions. Verify + * with a call to H5C_get_evictions_enabled(). + * + * Protect and unprotect some of the entries in the cache. Verify + * that there are no evictions (since we only try to make space + * when we either insert or load a new entry). + * + * Protect an entry not in the cache. Verify that this causes + * two evictions. + * + * Used H5C_set_evictions_enabled() to disable evictions again. + * Verify with a call to H5C_get_evictions_enabled(). + * + * Now flush and discard the cache -- should succeed. + */ + + pass = TRUE; + + if ( show_progress ) /* 1 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* create the cache */ + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(1 * 1024 * 1024), + (size_t)( 512 * 1024)); + + base_addr = entries[MONSTER_ENTRY_TYPE]; + entry_size = MONSTER_ENTRY_SIZE; + } + + if ( show_progress ) /* 2 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verivy that it is empty */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 0 ) || + ( cache_ptr->index_size != 0 ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 1."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 3 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that H5C_get_evictions_enabled() returns the expected value */ + if ( pass ) { + + result = H5C_get_evictions_enabled(cache_ptr, &evictions_enabled); + + if ( ( result != SUCCEED ) || ( evictions_enabled != TRUE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected evictions enabled 1."); + failure_mssg = msg; + } + } + + if ( show_progress ) /* 4 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* fill the cache */ + for ( i = 0; i < 16 ; i++ ) + { + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, i, + FALSE, H5C__NO_FLAGS_SET); + } + + if ( show_progress ) /* 5 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that the cache is full */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { + + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 2."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 6 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* protect and unprotect another entry */ + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 16); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 16, + FALSE, H5C__NO_FLAGS_SET); + + if ( show_progress ) /* 7 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that the an entry has been evicted */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 0 ) || + ( cache_ptr->slist_size != 0 ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 3."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 8 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + entry_ptr = &(base_addr[0]); + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + NULL, &in_cache, NULL, NULL, NULL); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 1."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 1."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( ! entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 1."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 9 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* insert an entry */ + insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 17, TRUE, H5C__NO_FLAGS_SET); + + if ( show_progress ) /* 10 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that another entry has been evicted */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 4."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 11 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + entry_ptr = &(base_addr[1]); + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + NULL, &in_cache, NULL, NULL, NULL); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 2."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 2."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( ! entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 12 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* disable evictions */ + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result != SUCCEED ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "can't disable evictions 1."); + failure_mssg = msg; + } + } + + if ( show_progress ) /* 13 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that evictions are disabled */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 5."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 14 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* protect and unprotect another entry */ + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 18); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 18, + FALSE, H5C__NO_FLAGS_SET); + + if ( show_progress ) /* 15 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that no entry has been evicted */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 17 ) || + ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 1 ) || + ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 6."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 16 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* insert another entry */ + insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 19, TRUE, H5C__NO_FLAGS_SET); + + if ( show_progress ) /* 17 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that no entry has been evicted */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 18 ) || + ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 7."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 18 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* re-enable evictions */ + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result != SUCCEED ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "can't enable evictions 1."); + failure_mssg = msg; + } + } + + if ( show_progress ) /* 19 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* protect and unprotect an entry that is in the cache */ + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 19); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 19, + FALSE, H5C__NO_FLAGS_SET); + + if ( show_progress ) /* 20 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that no entries have been evicted */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 18 ) || + ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 21 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* protect and unprotect an entry that isn't in the cache */ + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 20); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 20, + FALSE, H5C__NO_FLAGS_SET); + + if ( show_progress ) /* 22 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that the entries have been evicted to bring the + * cache back down to its normal size. + */ + + if ( pass ) { + + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 9."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 23 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + entry_ptr = &(base_addr[2]); + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + NULL, &in_cache, NULL, NULL, NULL); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 3."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 3."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( ! entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 24 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + entry_ptr = &(base_addr[3]); + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + NULL, &in_cache, NULL, NULL, NULL); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 4."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 4."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( ! entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 25 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* disable evictions again */ + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result != SUCCEED ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "can't disable evictions 2."); + failure_mssg = msg; + } + } + + if ( show_progress ) /* 26 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* protect and unprotect an entry that isn't in the cache, forcing + * the cache to grow. + */ + protect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 21); + unprotect_entry(cache_ptr, MONSTER_ENTRY_TYPE, 21, + FALSE, H5C__NO_FLAGS_SET); + + + if ( show_progress ) /* 27 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that the cache has grown */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 17 ) || + ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 2 ) || + ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != FALSE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 10."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 28 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* re-enable evictions again */ + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result != SUCCEED ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "can't enable evictions 2."); + failure_mssg = msg; + } + } + + if ( show_progress ) /* 29 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* insert an entry */ + insert_entry(cache_ptr, MONSTER_ENTRY_TYPE, 22, TRUE, H5C__NO_FLAGS_SET); + + if ( show_progress ) /* 30 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* verify that the cache has returned to its maximum size */ + if ( pass ) { + + if ( ( cache_ptr->index_len != 16 ) || + ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->slist_len != 3 ) || + ( cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE ) || + ( cache_ptr->evictions_enabled != TRUE ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected cache status 11."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 31 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + entry_ptr = &(base_addr[4]); + + result = H5C_get_entry_status(cache_ptr, entry_ptr->addr, + NULL, &in_cache, NULL, NULL, NULL); + + if ( result < 0 ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, + "H5AC_get_entry_status() reports failure 5."); + failure_mssg = msg; + + } else if ( in_cache ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected status 5."); + failure_mssg = msg; + + } else if ( ( ! entry_ptr->loaded ) || + ( entry_ptr->cleared ) || + ( ! entry_ptr->flushed ) || + ( ! entry_ptr->destroyed ) ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); + failure_mssg = msg; + + } + } + + if ( show_progress ) /* 32 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + /* disable evictions one last time before we shut down */ + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, FALSE); + + if ( result != SUCCEED ) { + + pass = FALSE; + HDsnprintf(msg, (size_t)128, "can't disable evictions 3."); + failure_mssg = msg; + } + } + + if ( show_progress ) /* 33 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + + if ( show_progress ) /* 34 */ + HDfprintf(stdout, "%s() - %0d -- pass = %d\n", + fcn_name, mile_stone++, (int)pass); + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s(): failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* check_evictions_enabled() */ + + +/*------------------------------------------------------------------------- * Function: check_flush_protected_err() * * Purpose: Verify that an attempt to flush the cache when it contains @@ -15829,6 +17144,143 @@ check_protect_ro_rw_err(void) /*------------------------------------------------------------------------- + * Function: check_evictions_enabled_err() + * + * Purpose: Verify that H5C_get_evictions_enabled() and + * H5C_set_evictions_enabled() generate errors as expected. + * + * Return: void + * + * Programmer: John Mainzer + * 8/3/07 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +static void +check_check_evictions_enabled_err(void) +{ + const char * fcn_name = "check_evictions_enabled_err()"; + herr_t result; + hbool_t evictions_enabled; + H5C_t * cache_ptr = NULL; + + TESTING("get/set evictions enabled errors"); + + pass = TRUE; + + /* allocate a cache. + * + * Call H5C_get_evictions_enabled(), passing it a NULL cache_ptr, + * should fail. + * + * Repeat with a NULL evictions_enabled_ptr, should fail as well. + * + * Configure the cache to use auto cache resize. Call + * H5C_set_evictions_enabled() to disable evictions. Should fail. + * + * Unprotect the entry and destroy the cache -- should succeed. + */ + + if ( pass ) { + + reset_entries(); + + cache_ptr = setup_cache((size_t)(2 * 1024), + (size_t)(1 * 1024)); + } + + if ( pass ) { + + result = H5C_get_evictions_enabled(NULL, &evictions_enabled); + + if ( result == SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_evictions_enabled succeeded() 1.\n"; + } + } + + if ( pass ) { + + result = H5C_get_evictions_enabled(cache_ptr, NULL); + + if ( result == SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_get_evictions_enabled succeeded() 2.\n"; + } + } + + if ( pass ) { + + result = H5C_set_evictions_enabled(cache_ptr, TRUE); + + if ( result != SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_evictions_enabled failed().\n"; + + } + } + + if ( pass ) { + + (cache_ptr->resize_ctl).incr_mode = H5C_incr__threshold; + + result = H5C_get_evictions_enabled(cache_ptr, FALSE); + + if ( result == SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_evictions_enabled succeeded() 1.\n"; + + } else if ( cache_ptr->evictions_enabled == TRUE ) { + + } + + (cache_ptr->resize_ctl).incr_mode = H5C_incr__off; + } + + if ( pass ) { + + (cache_ptr->resize_ctl).decr_mode = H5C_decr__threshold; + + result = H5C_get_evictions_enabled(cache_ptr, FALSE); + + if ( result == SUCCEED ) { + + pass = FALSE; + failure_mssg = "H5C_set_evictions_enabled succeeded() 2.\n"; + } + + (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; + } + + + if ( pass ) { + + takedown_cache(cache_ptr, FALSE, FALSE); + } + + if ( pass ) { PASSED(); } else { H5_FAILED(); } + + if ( ! pass ) { + + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", + fcn_name, failure_mssg); + } + + return; + +} /* check_evictions_enabled_err() */ + + +/*------------------------------------------------------------------------- * Function: check_auto_cache_resize() * * Purpose: Exercise the automatic cache resizing functionality. @@ -24823,6 +26275,8 @@ main(void) smoke_check_6(); smoke_check_7(); smoke_check_8(); + smoke_check_9(); + smoke_check_10(); #endif write_permitted_check(); @@ -24834,6 +26288,7 @@ main(void) check_rename_entry(); check_pin_protected_entry(); check_resize_entry(); + check_evictions_enabled(); check_flush_protected_err(); check_destroy_pinned_err(); check_destroy_protected_err(); @@ -24849,6 +26304,7 @@ main(void) check_resize_entry_errs(); check_unprotect_ro_dirty_err(); check_protect_ro_rw_err(); + check_check_evictions_enabled_err(); check_auto_cache_resize(); check_auto_cache_resize_disable(); check_auto_cache_resize_epoch_markers(); diff --git a/test/cache_api.c b/test/cache_api.c index fe42d0d..1b9a37e 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -118,29 +118,34 @@ static void check_file_mdc_api_errs(void); *------------------------------------------------------------------------- */ -#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ - ( ( (a).version == (b).version ) && \ - ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \ - ( ( ! cmp_set_init ) || \ - ( (a).set_initial_size == (b).set_initial_size ) ) && \ - ( ( ! cmp_init_size ) || \ - ( (a).initial_size == (b).initial_size ) ) && \ - ( (a).min_clean_fraction == (b).min_clean_fraction ) && \ - ( (a).max_size == (b).max_size ) && \ - ( (a).min_size == (b).min_size ) && \ - ( (a).epoch_length == (b).epoch_length ) && \ - ( (a).incr_mode == (b).incr_mode ) && \ - ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \ - ( (a).increment == (b).increment ) && \ - ( (a).apply_max_increment == (b).apply_max_increment ) && \ - ( (a).max_increment == (b).max_increment ) && \ - ( (a).decr_mode == (b).decr_mode ) && \ - ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ - ( (a).decrement == (b).decrement ) && \ - ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ - ( (a).max_decrement == (b).max_decrement ) && \ - ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ - ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ +#define CACHE_CONFIGS_EQUAL(a, b, cmp_set_init, cmp_init_size) \ + ( ( (a).version == (b).version ) && \ + ( (a).rpt_fcn_enabled == (b).rpt_fcn_enabled ) && \ + ( (a).open_trace_file == (b).open_trace_file ) && \ + ( (a).close_trace_file == (b).close_trace_file ) && \ + ( ( (a).open_trace_file == FALSE ) || \ + ( strcmp((a).trace_file_name, (b).trace_file_name) == 0 ) ) && \ + ( (a).evictions_enabled == (b).evictions_enabled ) && \ + ( ( ! cmp_set_init ) || \ + ( (a).set_initial_size == (b).set_initial_size ) ) && \ + ( ( ! cmp_init_size ) || \ + ( (a).initial_size == (b).initial_size ) ) && \ + ( (a).min_clean_fraction == (b).min_clean_fraction ) && \ + ( (a).max_size == (b).max_size ) && \ + ( (a).min_size == (b).min_size ) && \ + ( (a).epoch_length == (b).epoch_length ) && \ + ( (a).incr_mode == (b).incr_mode ) && \ + ( (a).lower_hr_threshold == (b).lower_hr_threshold ) && \ + ( (a).increment == (b).increment ) && \ + ( (a).apply_max_increment == (b).apply_max_increment ) && \ + ( (a).max_increment == (b).max_increment ) && \ + ( (a).decr_mode == (b).decr_mode ) && \ + ( (a).upper_hr_threshold == (b).upper_hr_threshold ) && \ + ( (a).decrement == (b).decrement ) && \ + ( (a).apply_max_decrement == (b).apply_max_decrement ) && \ + ( (a).max_decrement == (b).max_decrement ) && \ + ( (a).epochs_before_eviction == (b).epochs_before_eviction ) && \ + ( (a).apply_empty_reserve == (b).apply_empty_reserve ) && \ ( (a).empty_reserve == (b).empty_reserve ) ) #define XLATE_EXT_TO_INT_MDC_CONFIG(i, e) \ @@ -191,6 +196,7 @@ check_fapl_mdc_api_calls(void) /* 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, @@ -755,6 +761,7 @@ check_file_mdc_api_calls(void) /* 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, @@ -783,6 +790,7 @@ check_file_mdc_api_calls(void) /* 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, @@ -811,6 +819,7 @@ check_file_mdc_api_calls(void) /* 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, @@ -839,6 +848,7 @@ check_file_mdc_api_calls(void) /* 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, @@ -1367,6 +1377,7 @@ mdc_api_call_smoke_check(void) /* 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, @@ -1395,6 +1406,7 @@ mdc_api_call_smoke_check(void) /* 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, @@ -1423,6 +1435,7 @@ mdc_api_call_smoke_check(void) /* 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, @@ -2079,7 +2092,7 @@ mdc_api_call_smoke_check(void) * used to test error rejection in the MDC related API calls. */ -#define NUM_INVALID_CONFIGS 34 +#define NUM_INVALID_CONFIGS 36 H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = { @@ -2090,6 +2103,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2118,6 +2132,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2146,6 +2161,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t open_trace_file = */ (hbool_t)-1, /* 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, @@ -2174,6 +2190,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t open_trace_file = */ FALSE, /* hbool_t close_trace_file = */ (hbool_t)-1, /* 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, @@ -2202,6 +2219,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t open_trace_file = */ TRUE, /* 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, @@ -2230,6 +2248,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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 = */ 2, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2258,6 +2277,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2286,6 +2306,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2314,6 +2335,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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 = */ FALSE, /* size_t initial_size = */ (1 * 1024 * 1024), /* double min_clean_fraction = */ 0.25, @@ -2342,6 +2364,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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 = */ (16 * 1024 * 1024 + 1), /* double min_clean_fraction = */ 0.25, @@ -2370,6 +2393,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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.25, @@ -2398,6 +2422,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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 = */ 1.000001, @@ -2426,6 +2451,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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.00000001, @@ -2454,6 +2480,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2482,6 +2509,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2510,6 +2538,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2538,6 +2567,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2566,6 +2596,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2594,6 +2625,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2622,6 +2654,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2650,6 +2683,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2678,6 +2712,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2706,6 +2741,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2734,6 +2770,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2762,6 +2799,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2790,6 +2828,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2818,6 +2857,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2846,6 +2886,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2874,6 +2915,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2902,6 +2944,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2930,6 +2973,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2958,6 +3002,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -2986,6 +3031,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -3014,6 +3060,7 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* 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, @@ -3034,6 +3081,64 @@ H5AC_cache_config_t invalid_configs[NUM_INVALID_CONFIGS] = /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1, /* int dirty_bytes_threshold = */ (H5C__MAX_MAX_CACHE_SIZE / 4) + 1 + }, + { + /* 34 -- 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, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ FALSE, + /* 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_decr_mode decr_mode = */ H5C_decr__off, + /* double upper_hr_threshold = */ 0.9, + /* 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) + }, + { + /* 35 -- 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, + /* hbool_t close_trace_file = */ FALSE, + /* char trace_file_name[] = */ "", + /* hbool_t evictions_enabled = */ FALSE, + /* 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_decr_mode decr_mode = */ H5C_decr__age_out, + /* double upper_hr_threshold = */ 0.9, + /* 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) } }; @@ -3580,7 +3685,7 @@ main(void) #if 1 check_file_mdc_api_calls(); #endif -#if 1 +#if 0 mdc_api_call_smoke_check(); #endif #if 1 diff --git a/testpar/t_cache.c b/testpar/t_cache.c index b659e79..243caa1 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -5281,28 +5281,28 @@ 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\" 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 0x0 13 0x0 2 0\n", - "H5AC_set 0x2 13 0x0 2 0\n", - "H5AC_set 0x4 13 0x0 4 0\n", - "H5AC_set 0x8 13 0x0 6 0\n", - "H5AC_protect 0 13 2 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 0x0 15 0x0 2 0\n", + "H5AC_set 0x2 15 0x0 2 0\n", + "H5AC_set 0x4 15 0x0 4 0\n", + "H5AC_set 0x8 15 0x0 6 0\n", + "H5AC_protect 0 15 H5AC_WRITE 2 1\n", "H5AC_mark_pinned_or_protected_entry_dirty 0 0\n", - "H5AC_protect 0 13 0 0 0\n", - "H5AC_protect 2 13 2 1\n", + "H5AC_unprotect 0 15 0 0 0\n", + "H5AC_protect 2 15 H5AC_WRITE 2 1\n", "H5AC_pin_protected_entry 2 0\n", - "H5AC_protect 2 13 0 0 0\n", + "H5AC_unprotect 2 15 0 0 0\n", "H5AC_unpin_entry 2 0\n", - "H5AC_expunge_entry 2 13 0\n", - "H5AC_protect 4 13 4 1\n", + "H5AC_expunge_entry 2 15 0\n", + "H5AC_protect 4 15 H5AC_WRITE 4 1\n", "H5AC_pin_protected_entry 4 0\n", - "H5AC_protect 4 13 0 0 0\n", + "H5AC_unprotect 4 15 0 0 0\n", "H5AC_mark_pinned_entry_dirty 0x4 0 0 0\n", - "H5AC_resize_pinned_entry 0x4 2 0 0\n", - "H5AC_resize_pinned_entry 0x4 4 0 0\n", + "H5AC_resize_pinned_entry 0x4 2 0\n", + "H5AC_resize_pinned_entry 0x4 4 0\n", "H5AC_unpin_entry 4 0\n", - "H5AC_rename 0 8a65 13 0\n", - "H5AC_rename 8a65 0 13 0\n", + "H5AC_rename 0 8a65 15 0\n", + "H5AC_rename 8a65 0 15 0\n", "H5AC_flush 0x0 0\n", NULL }; |