diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5AC2.c | 439 | ||||
-rw-r--r-- | src/H5AC2private.h | 29 | ||||
-rw-r--r-- | src/H5AC2public.h | 146 | ||||
-rw-r--r-- | src/H5ACprivate.h | 12 | ||||
-rw-r--r-- | src/H5ACpublic.h | 19 | ||||
-rw-r--r-- | src/H5C2.c | 2 | ||||
-rw-r--r-- | src/H5C2journal.c | 52 | ||||
-rw-r--r-- | src/H5C2pkg.h | 2 | ||||
-rw-r--r-- | src/H5C2private.h | 1 | ||||
-rw-r--r-- | src/H5F.c | 152 | ||||
-rw-r--r-- | src/H5Fpkg.h | 5 | ||||
-rw-r--r-- | src/H5Fprivate.h | 1 | ||||
-rw-r--r-- | src/H5Fpublic.h | 5 | ||||
-rw-r--r-- | src/H5Pfapl.c | 136 | ||||
-rw-r--r-- | src/H5Ppublic.h | 5 |
15 files changed, 657 insertions, 349 deletions
diff --git a/src/H5AC2.c b/src/H5AC2.c index 78d96e2..7dc93b4 100644 --- a/src/H5AC2.c +++ b/src/H5AC2.c @@ -200,12 +200,8 @@ static herr_t H5AC2_log_renamed_entry(H5F_t * f, haddr_t new_addr); #endif /* H5_HAVE_PARALLEL */ -static herr_t H5AC2_set_non_journaling_cache_config(H5F_t * f, - hid_t dxpl_id, - H5AC2_cache_config_t *config_ptr); - -static herr_t H5AC2_validate_journaling_config( - H5AC2_cache_config_t * config_ptr); +static herr_t H5AC2_set_cache_config(H5F_t * f, + H5AC2_cache_config_t *config_ptr); /*------------------------------------------------------------------------- @@ -522,7 +518,6 @@ static const char * H5AC2_entry_type_names[H5AC2_NTYPES] = herr_t H5AC2_create(H5F_t * f, - hid_t dxpl_id, H5AC2_cache_config_t *config_ptr) { herr_t ret_value = SUCCEED; /* Return value */ @@ -707,9 +702,7 @@ H5AC2_create(H5F_t * f, } #endif /* H5_HAVE_PARALLEL */ - result = H5AC2_set_non_journaling_cache_config(f, - dxpl_id, - config_ptr); + result = H5AC2_set_cache_config(f, config_ptr); if ( result != SUCCEED ) { @@ -2945,6 +2938,11 @@ done: * JRM -- 4/12/08 * Added support for the new journaling control fields. * + * JRM - 8/1/08 + * Removed support for the new journaling control fields. + * This functionality is now handled through the + * H5AC2_jnl_config_t structure and the related calls. + * *------------------------------------------------------------------------- */ @@ -3051,8 +3049,68 @@ H5AC2_get_cache_auto_resize_config(H5AC2_t * cache_ptr, } #endif /* H5_HAVE_PARALLEL */ +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5AC2_get_cache_auto_resize_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC2_get_jnl_config + * + * Purpose: Get the current journaling configuration and load it into + * the supplied instance of H5AC2_jnl_config_t. + * + * For the moment, the only journaling we do is metadata + * journaling, so in effect this function is a wrapper + * function for H5C2_get_journal_config(). + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Programmer: John Mainzer + * 7/31/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5AC2_get_jnl_config(H5AC2_t * cache_ptr, + H5AC2_jnl_config_t * config_ptr) +{ + herr_t result; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5AC2_get_jnl_config, FAIL) + + if ( ( cache_ptr == NULL ) + || +#ifdef H5_HAVE_PARALLEL + ( ( cache_ptr->aux_ptr != NULL ) + && + ( ((H5AC2_aux_t *)(cache_ptr->aux_ptr))->magic + != + H5AC2__H5AC2_AUX_T_MAGIC + ) + ) + || +#endif /* H5_HAVE_PARALLEL */ + ( config_ptr == NULL ) + || + ( config_ptr->version != H5AC2__CURR_CACHE_CONFIG_VERSION ) + ) + { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "Bad cache_ptr or config_ptr on entry.") + + } + /* get the current journal configuration. Start by setting defaults, - * which may be changed shortly. + * which will typically be changed shortly. */ config_ptr->enable_journaling = FALSE; @@ -3065,7 +3123,6 @@ H5AC2_get_cache_auto_resize_config(H5AC2_t * cache_ptr, result = H5C2_get_journal_config(cache_ptr, &(config_ptr->enable_journaling), - NULL, &(config_ptr->journal_file_path[0]), &(config_ptr->jbrb_buf_size), &(config_ptr->jbrb_num_bufs), @@ -3082,7 +3139,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC2_get_cache_auto_resize_config() */ +} /* H5AC2_get_jnl_config() */ /*------------------------------------------------------------------------- @@ -3264,12 +3321,15 @@ done: * Added code to allow control of metadata journaling. * This required the addition of the dxpl_id parameter. * + * John Mainzer -- 8/1/08 + * Pulled journaling configuration back out of the + * function, and teh dxpl_id parameter with it. + * *------------------------------------------------------------------------- */ herr_t H5AC2_set_cache_auto_resize_config(H5F_t * f, - hid_t dxpl_id, H5AC2_cache_config_t *config_ptr) { /* const char * fcn_name = "H5AC2_set_cache_auto_resize_config"; */ @@ -3325,21 +3385,12 @@ H5AC2_set_cache_auto_resize_config(H5F_t * f, } - result = H5AC2_set_non_journaling_cache_config(f, dxpl_id, config_ptr); + result = H5AC2_set_cache_config(f, config_ptr); if ( result < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC2_set_non_journaling_cache_config() failed.") - } - - - result = H5AC2_set_cache_journaling_config(f, dxpl_id, config_ptr, FALSE); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC2_set_cache_journaling_config() failed.") + "H5AC2_set_cache_config() failed.") } done: @@ -3354,7 +3405,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 %f %f %d %d %d %d %f %d %d \"%s\" %d %d %d %d %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), @@ -3385,13 +3436,6 @@ done: (int)(trace_config.apply_empty_reserve), trace_config.empty_reserve, trace_config.dirty_bytes_threshold, - (int)(config_ptr->enable_journaling), - config_ptr->journal_file_path, - (int)(config_ptr->journal_recovered), - (int)(config_ptr->jbrb_buf_size), - config_ptr->jbrb_num_bufs, - (int)(config_ptr->jbrb_use_aio), - (int)(config_ptr->jbrb_human_readable), (int)ret_value); } #endif /* H5AC2__TRACE_FILE_ENABLED */ @@ -3402,20 +3446,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC2_set_cache_journaling_config + * Function: H5AC2_set_jnl_config * - * Purpose: Handle changes in journaling configuration. + * Purpose: Manage changes in journaling configuration. * - * This code used to reside in - * H5AC2_set_cache_auto_resize_config(), but it has been - * split out, as on startup, we need to be able to run - * it separately from the rest of the cache configuration - * code. + * At present, metadata journaling is the only journaling we + * do, so this function can be thought of as a wrapper for + * H5C2_begin_journaling() and H5C2_end_journaling(). * * Return: SUCCEED on success, and FAIL on failure. * * Programmer: John Mainzer - * 7/6/08 + * 7/31/08 * * Modifications: * @@ -3425,26 +3467,21 @@ done: */ herr_t -H5AC2_set_cache_journaling_config(H5F_t * f, - hid_t dxpl_id, - H5AC2_cache_config_t *config_ptr, -#if H5AC2__TRACE_FILE_ENABLED - hbool_t show_trace) -#else /* H5AC2__TRACE_FILE_ENABLED */ - hbool_t UNUSED show_trace) -#endif /* H5AC2__TRACE_FILE_ENABLED */ +H5AC2_set_jnl_config(H5F_t * f, + hid_t dxpl_id, + H5AC2_jnl_config_t *config_ptr) { - /* const char * fcn_name = "H5AC2_set_cache_journaling_config"; */ + /* const char * fcn_name = "H5AC2_set_jnl_config"; */ H5AC2_t * cache_ptr; herr_t result; herr_t ret_value = SUCCEED; /* Return value */ hbool_t mdj_enabled = FALSE; #if H5AC2__TRACE_FILE_ENABLED - H5AC2_cache_config_t trace_config = H5AC2__DEFAULT_CACHE_CONFIG; + H5AC2_jnl_config_t trace_config = H5AC2__DEFAULT_JNL_CONFIG; FILE * trace_file_ptr = NULL; #endif /* H5AC2__TRACE_FILE_ENABLED */ - FUNC_ENTER_NOAPI(H5AC2_set_cache_journaling_config, FAIL) + FUNC_ENTER_NOAPI(H5AC2_set_jnl_config, FAIL) HDassert( f ); HDassert( f->shared ); @@ -3455,11 +3492,7 @@ H5AC2_set_cache_journaling_config(H5F_t * f, #if H5AC2__TRACE_FILE_ENABLED /* Make note of the new configuration. */ - if ( ( show_trace ) && ( config_ptr != NULL ) ) { - - trace_config = *config_ptr; - - } + trace_config = *config_ptr; #endif /* H5AC2__TRACE_FILE_ENABLED */ if ( ( cache_ptr == NULL ) @@ -3479,7 +3512,7 @@ H5AC2_set_cache_journaling_config(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry.") } - result = H5AC2_validate_journaling_config(config_ptr); + result = H5AC2_validate_jnl_config(config_ptr); if ( result != SUCCEED ) { @@ -3488,7 +3521,7 @@ H5AC2_set_cache_journaling_config(H5F_t * f, } result = H5C2_get_journal_config((H5C2_t *)cache_ptr, &mdj_enabled, - NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -3534,14 +3567,13 @@ done: * of the config that pretain to journaling are necessary in * the trace file. Write the return value to catch occult errors. */ - if ( ( show_trace ) && - ( cache_ptr != NULL ) && + if ( ( cache_ptr != NULL ) && ( H5C2_get_trace_file_ptr(cache_ptr, &trace_file_ptr) >= 0 ) && ( trace_file_ptr != NULL ) ) { HDfprintf(trace_file_ptr, "%s %d %d \"%s\" %d %d %d %d %d %d\n", - "H5AC2_set_cache_journaling_config", + "H5AC2_set_jnl_config", trace_config.version, (int)(config_ptr->enable_journaling), config_ptr->journal_file_path, @@ -3556,17 +3588,14 @@ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC2_set_cache_journaling_config() */ +} /* H5AC2_set_jnl_config() */ /*------------------------------------------------------------------------- - * Function: H5AC2_set_non_journaling_cache_config - * - * Purpose: Handle all non-journaling related configuration switches - * in an instance of H5AC2_cache_config_t. + * Function: H5AC2_set_cache_config * - * This function is needed, as journaling cannot be set - * at cache creation time. + * Purpose: Handle all configuration switches in an instance of + * H5AC2_cache_config_t. * * Return: SUCCEED on success, and FAIL on failure. * @@ -3581,17 +3610,16 @@ done: */ herr_t -H5AC2_set_non_journaling_cache_config(H5F_t * f, - hid_t UNUSED dxpl_id, - H5AC2_cache_config_t *config_ptr) +H5AC2_set_cache_config(H5F_t * f, + H5AC2_cache_config_t *config_ptr) { - /* const char * fcn_name = "H5AC2_set_non_journaling_cache_config"; */ + /* const char * fcn_name = "H5AC2_set_cache_config"; */ H5AC2_t * cache_ptr; herr_t result; herr_t ret_value = SUCCEED; /* Return value */ H5C2_auto_size_ctl_t internal_config; - FUNC_ENTER_NOAPI(H5AC2_set_non_journaling_cache_config, FAIL) + FUNC_ENTER_NOAPI(H5AC2_set_cache_config, FAIL) HDassert( f ); HDassert( f->shared ); @@ -3715,7 +3743,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC2_set_non_journaling_cache_config() */ +} /* H5AC2_set_cache_config() */ /*------------------------------------------------------------------------- @@ -3757,6 +3785,10 @@ done: * to permit journaling. * JRM - 10/18/07 * + * Pulled journaling related code out of this function. + * + * JRM - 8/1/08 + * *------------------------------------------------------------------------- */ @@ -3856,26 +3888,150 @@ H5AC2_validate_config(H5AC2_cache_config_t * config_ptr) "H5AC2_ext_config_2_int_config() failed.") } - result = H5AC2_validate_journaling_config(config_ptr); + result = H5C2_validate_resize_config(&internal_config, + H5C2_RESIZE_CFG__VALIDATE_ALL); if ( result != SUCCEED ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error(s) in new config.") } - result = H5C2_validate_resize_config(&internal_config, - H5C2_RESIZE_CFG__VALIDATE_ALL); +done: - if ( result != SUCCEED ) { + FUNC_LEAVE_NOAPI(ret_value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error(s) in new config.") +} /* H5AC2_validate_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC2_validate_jnl_config() + * + * Purpose: Run a sanity check on the contents of the supplied + * instance of H5AC2_jnl_config_t. + * + * Do nothing and return SUCCEED if no errors are detected, + * and flag an error and return FAIL otherwise. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 7/31/08 + * + * Modifications: + * + * - None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5AC2_validate_jnl_config(H5AC2_jnl_config_t * config_ptr) + +{ + herr_t ret_value = SUCCEED; /* Return value */ + int name_len; + + FUNC_ENTER_NOAPI(H5AC2_validate_jnl_config, FAIL) + + if ( config_ptr == NULL ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") + } + + if ( config_ptr->version != H5AC2__CURR_JNL_CONFIG_VER ) { + +#if 0 /* JRM */ + HDfprintf(stdout, "version = %d(%d).\n", config_ptr->version, + H5AC2__CURR_JNL_CONFIG_VER); + HDfprintf(stdout, "enable_journaling = %d.\n", + (int)(config_ptr->enable_journaling)); + HDfprintf(stdout, "journal_recovered = %d\n", + (int)(config_ptr->journal_recovered)); + HDfprintf(stdout, "jbrb_buf_size = %ld\n", + (long)(config_ptr->jbrb_buf_size)); + HDfprintf(stdout, "jbrb_num_bufs = %d\n", config_ptr->jbrb_num_bufs); + HDfprintf(stdout, "jbrb_use_aio = %d\n", (int)(config_ptr->jbrb_use_aio)); + HDfprintf(stdout, "jbrb_human_readable = %d\n", + (int)(config_ptr->jbrb_human_readable)); +#endif /* JRM */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") + } + + if ( ( config_ptr->enable_journaling != TRUE ) && + ( config_ptr->enable_journaling != FALSE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->enable_journaling must be either TRUE or FALSE.") + } + + if ( ( config_ptr->journal_recovered != TRUE ) && + ( config_ptr->journal_recovered != FALSE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->journal_recovered must be either TRUE or FALSE.") + } + + if ( ( config_ptr->enable_journaling ) && + ( config_ptr->journal_recovered ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "enable_journaling and journal_recovered can't both be TRUE.") + } + + /* don't test journal_file_path unless enable_journaling is TRUE */ + if ( config_ptr->enable_journaling ) { + + /* Can't really test the journal_file_path 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->journal_file_path); + + if ( name_len <= 0 ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->journal_file_path is empty.") + + } else if ( name_len > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->journal_file_path too long.") + } + } + + if ( ( config_ptr->jbrb_buf_size < H5AC2__MIN_JBRB_BUF_SIZE ) || + ( config_ptr->jbrb_buf_size > H5AC2__MAX_JBRB_BUF_SIZE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_buf_size out of range.") + } + + if ( ( config_ptr->jbrb_num_bufs < H5AC2__MIN_JBRB_NUM_BUFS ) || + ( config_ptr->jbrb_num_bufs > H5AC2__MAX_JBRB_NUM_BUFS ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_num_bufs out of range.") + } + + if ( ( config_ptr->jbrb_use_aio != FALSE ) && + ( config_ptr->jbrb_use_aio != TRUE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_use_aio must be either TRUE or FALSE.") + } + + if ( ( config_ptr->jbrb_human_readable != FALSE ) && + ( config_ptr->jbrb_human_readable != TRUE ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "config_ptr->jbrb_human_readable must be either TRUE or FALSE.") } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC2_validate_config() */ +} /* H5AC2_validate_jnl_config() */ /*------------------------------------------------------------------------- @@ -5473,124 +5629,3 @@ done: #endif /* H5_HAVE_PARALLEL */ - -/*------------------------------------------------------------------------- - * Function: H5AC2_validate_journaling_config() - * - * Purpose: Run a sanity check on the contents of the journaling - * related fields of the supplied instance of - * H5AC2_cache_config_t. - * - * Do nothing and return SUCCEED if no errors are detected, - * and flag an error and return FAIL otherwise. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 7/6/08 - * - * Modifications: - * - * - None. - * - *------------------------------------------------------------------------- - */ - -herr_t -H5AC2_validate_journaling_config(H5AC2_cache_config_t * config_ptr) - -{ - herr_t ret_value = SUCCEED; /* Return value */ - int name_len; - - FUNC_ENTER_NOAPI(H5AC2_validate_journaling_config, FAIL) - - if ( config_ptr == NULL ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") - } - - if ( config_ptr->version != H5AC2__CURR_CACHE_CONFIG_VERSION ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") - } - - if ( ( config_ptr->enable_journaling != TRUE ) && - ( config_ptr->enable_journaling != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->enable_journaling must be either TRUE or FALSE.") - } - - if ( ( config_ptr->journal_recovered != TRUE ) && - ( config_ptr->journal_recovered != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->journal_recovered must be either TRUE or FALSE.") - } - - if ( ( config_ptr->enable_journaling ) && - ( config_ptr->journal_recovered ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->journal_recovered must be either TRUE or FALSE.") - } - - /* don't bother to test journal_file_path unless enable_journaling is TRUE */ - if ( config_ptr->enable_journaling ) { - - /* Can't really test the journal_file_path 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->journal_file_path); - - if ( name_len <= 0 ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->journal_file_path is empty.") - - } else if ( name_len > H5AC2__MAX_JOURNAL_FILE_NAME_LEN ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->journal_file_path too long.") - } - } - - if ( ( config_ptr->jbrb_buf_size < H5AC2__MIN_JBRB_BUF_SIZE ) || - ( config_ptr->jbrb_buf_size > H5AC2__MAX_JBRB_BUF_SIZE ) ) { -#if 1 /* JRM */ - HDfprintf(stdout, "config_ptr->jbrb_buf_size = %d.\n", - (int)(config_ptr->jbrb_buf_size)); -#endif /* JRM */ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->jbrb_buf_size out of range.") - } - - if ( ( config_ptr->jbrb_num_bufs < H5AC2__MIN_JBRB_NUM_BUFS ) || - ( config_ptr->jbrb_num_bufs > H5AC2__MAX_JBRB_NUM_BUFS ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->jbrb_num_bufs out of range.") - } - - if ( ( config_ptr->jbrb_use_aio != FALSE ) && - ( config_ptr->jbrb_use_aio != TRUE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->jbrb_use_aio must be either TRUE or FALSE.") - } - - if ( ( config_ptr->jbrb_human_readable != FALSE ) && - ( config_ptr->jbrb_human_readable != TRUE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "config_ptr->jbrb_human_readable must be either TRUE or FALSE.") - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5AC2_validate_journaling_config() */ - diff --git a/src/H5AC2private.h b/src/H5AC2private.h index a6f9d45..9137993 100644 --- a/src/H5AC2private.h +++ b/src/H5AC2private.h @@ -195,7 +195,8 @@ extern hid_t H5AC2_ind_dxpl_id; #define H5AC2__DEFAULT_CACHE_CONFIG \ { \ - /* int version = */ H5C2__CURR_AUTO_SIZE_CTL_VER, \ + /* 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, \ @@ -225,7 +226,15 @@ extern hid_t H5AC2_ind_dxpl_id; /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ /* double empty_reserve = */ 0.1, \ - /* int dirty_bytes_threshold = */ (256 * 1024), \ + /* int dirty_bytes_threshold = */ (256 * 1024) \ +} + + +/* Default journal configuration. */ + +#define H5AC2__DEFAULT_JNL_CONFIG \ +{ \ + /* int version = */ H5AC2__CURR_JNL_CONFIG_VER, \ /* hbool_t enable_journaling = */ FALSE, \ /* char journal_file_path[] = */ "", \ /* hbool_t journal_recovered = */ FALSE, \ @@ -279,7 +288,6 @@ H5_DLL herr_t H5AC2_check_for_journaling(H5F_t * f, H5C2_t * cache_ptr, hbool_t journal_recovered); H5_DLL herr_t H5AC2_create(H5F_t *f, - hid_t dxpl_id, H5AC2_cache_config_t *config_ptr); H5_DLL herr_t H5AC2_begin_transaction(hid_t id, hbool_t * do_transaction_ptr, @@ -338,19 +346,22 @@ H5_DLL herr_t H5AC2_get_cache_size(H5AC2_t * cache_ptr, H5_DLL herr_t H5AC2_get_cache_hit_rate(H5AC2_t * cache_ptr, double * hit_rate_ptr); +H5_DLL herr_t H5AC2_get_jnl_config(H5AC2_t * cache_ptr, + H5AC2_jnl_config_t * config_ptr); + H5_DLL herr_t H5AC2_reset_cache_hit_rate_stats(H5AC2_t * cache_ptr); H5_DLL herr_t H5AC2_set_cache_auto_resize_config(H5F_t * f, - hid_t dxpl_id, - H5AC2_cache_config_t *config_ptr); + H5AC2_cache_config_t *config_ptr); -H5_DLL herr_t H5AC2_set_cache_journaling_config(H5F_t * f, - hid_t dxpl_id, - H5AC2_cache_config_t *config_ptr, - hbool_t show_trace); +H5_DLL herr_t H5AC2_set_jnl_config(H5F_t * f, + hid_t dxpl_id, + H5AC2_jnl_config_t *config_ptr); H5_DLL herr_t H5AC2_validate_config(H5AC2_cache_config_t * config_ptr); +H5_DLL herr_t H5AC2_validate_jnl_config(H5AC2_jnl_config_t * config_ptr); + H5_DLL herr_t H5AC2_close_trace_file(H5AC2_t * cache_ptr); H5_DLL herr_t H5AC2_open_trace_file(H5AC2_t * cache_ptr, diff --git a/src/H5AC2public.h b/src/H5AC2public.h index 57c65b9..e13d76e 100644 --- a/src/H5AC2public.h +++ b/src/H5AC2public.h @@ -36,9 +36,6 @@ extern "C" { #endif -#define H5AC2__MAX_TRACE_FILE_NAME_LEN 1024 -#define H5AC2__MAX_JOURNAL_FILE_NAME_LEN 1024 - /**************************************************************************** * * structure H5AC2_cache_config_t @@ -381,61 +378,10 @@ extern "C" { * file. This field is ignored unless HDF5 has been compiled for * parallel. * - * - * Journal Configuration Fields: - * - * The journaling fields allow enabling of metadata journaling, specification - * of the journal file, and marking a file as recovered. - * - * Note that the fields with the "jbrb_" prefix are used to configure the - * journal buffer ring buffer -- a ring buffer of buffers used to buffer - * output of journal messages. - * - * At least to begin with, these fields may only be used at file open/create - * time -- i.e. in the FAPL. - * - * enable_journaling: Boolean flag that is set to TRUE if journaling is - * to be enabled, and to FALSE otherwise. - * - * When the cache configuration is reported, this field is TRUE iff - * journaling is enabled. - * - * journal_file_path: Full path of the file to be used to store the - * metadata journal. This field is only defined if enable_journaling - * is TRUE. - * - * At present, the length of the journal file path is restricted to - * no more than H5AC2__MAX_JOURNAL_FILE_NAME_LEN. - * - * journal_recovered: Boolean flag use to indicate that we are opening - * a journaled file that was not closed correctly, and on which the - * journal recovery tool has been run. - * - * Unless you are the writer of a new journal recovery tool, you - * should always set this field to FALSE. - * - * jbrb_buf_size: size_t containing the size of each individual buffer - * in the journal buffer ring buffer. This size should be chosen - * to be some multiple of the block size used by the file system - * on which the journal file will be written. - * - * jbrb_num_bufs: Integer containing the number of buffers in the journal - * buffer ring buffer. If synchronous I/O is used, one or two buffers - * is sufficient. If asynchronous I/O is used, the number of buffers - * should be sufficiently large that a write on buffer is likely to - * complete before that buffer is needed again. - * - * jbrb_use_aio: Boolean flag indicating whether we should use - * asynchronous I/O for journal entry writes. - * - * jbrb_human_readable: Boolean flag which determines whether the journal - * file will be written in human readable form. In general, this - * field should be set to false, as the human readable journal - * file is at least twice a large as the machine readable version. - * ****************************************************************************/ -#define H5AC2__CURR_CACHE_CONFIG_VERSION 1 +#define H5AC2__CURR_CACHE_CONFIG_VERSION 1 +#define H5AC2__MAX_TRACE_FILE_NAME_LEN 1024 typedef struct H5AC2_cache_config_t { @@ -495,18 +441,86 @@ typedef struct H5AC2_cache_config_t /* parallel configuration fields: */ int dirty_bytes_threshold; +} H5AC2_cache_config_t; - /* metadata journaling configuration fields: */ - hbool_t enable_journaling; - char journal_file_path[ - H5AC2__MAX_JOURNAL_FILE_NAME_LEN]; - hbool_t journal_recovered; - size_t jbrb_buf_size; - int jbrb_num_bufs; - hbool_t jbrb_use_aio; - hbool_t jbrb_human_readable; -} H5AC2_cache_config_t; +/**************************************************************************** + * + * structure H5AC2_jnl_config_t + * + * H5AC2_jnl_config_t is a public structure intended for use in public APIs. + * At least in its initial incarnation, it is intended to package all the + * data needed to configure metadata journaling. In the future, we may + * use it to package configuration data for other types of journaling as well. + * + * The fields of the structure are discussed individually below. Note + * that the fields with the "jbrb_" prefix are used to configure the + * journal buffer ring buffer -- a ring buffer of buffers used to buffer + * output of journal messages. + * + * version: Integer field containing the version number of this version + * of the H5AC2_jnl_config_t structure. Any instance of + * H5AC2_cache_config_t passed to the cache must have a known + * version number, or an error will be flagged. + * + * enable_journaling: Boolean flag that is set to TRUE if journaling is + * to be enabled, and to FALSE otherwise. + * + * When the cache configuration is reported, this field is TRUE iff + * journaling is enabled. + * + * journal_file_path: Full path of the file to be used to store the + * metadata journal. This field is only defined if enable_journaling + * is TRUE. + * + * At present, the length of the journal file path is restricted to + * no more than H5AC2__MAX_JOURNAL_FILE_NAME_LEN. + * + * journal_recovered: Boolean flag use to indicate that we are opening + * a journaled file that was not closed correctly, and on which the + * journal recovery tool has been run. + * + * Unless you are the writer of a new journal recovery tool, you + * should always set this field to FALSE. + * + * jbrb_buf_size: size_t containing the size of each individual buffer + * in the journal buffer ring buffer. This size should be chosen + * to be some multiple of the block size used by the file system + * on which the journal file will be written. + * + * jbrb_num_bufs: Integer containing the number of buffers in the journal + * buffer ring buffer. If synchronous I/O is used, one or two buffers + * is sufficient. If asynchronous I/O is used, the number of buffers + * should be sufficiently large that a write on buffer is likely to + * complete before that buffer is needed again. + * + * jbrb_use_aio: Boolean flag indicating whether we should use + * asynchronous I/O for journal entry writes. + * + * jbrb_human_readable: Boolean flag which determines whether the journal + * file will be written in human readable form. In general, this + * field should be set to false, as the human readable journal + * file is at least twice a large as the machine readable version. + * + ****************************************************************************/ + +#define H5AC2__CURR_JNL_CONFIG_VER 1 +#define H5AC2__MAX_JOURNAL_FILE_NAME_LEN 1024 + +typedef struct H5AC2_jnl_config_t +{ + int version; + + /* metadata journaling configuration fields: */ + hbool_t enable_journaling; + char journal_file_path[ H5AC2__MAX_JOURNAL_FILE_NAME_LEN]; + hbool_t journal_recovered; + size_t jbrb_buf_size; + int jbrb_num_bufs; + hbool_t jbrb_use_aio; + hbool_t jbrb_human_readable; + +} H5AC2_jnl_config_t; #ifdef __cplusplus diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 40ab9ab..bbbcf11 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -225,17 +225,7 @@ extern hid_t H5AC_ind_dxpl_id; /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ /* double empty_reserve = */ 0.1, \ - /* int dirty_bytes_threshold = */ (256 * 1024), \ - /* The following fields are not used by H5AC or H5C -- they exist here */ \ - /* because they are used by H5AC2 and H5C2, and including them here */ \ - /* us to avoid duplicating the user level cache configuration code. */ \ - /* hbool_t enable_journaling = */ FALSE, \ - /* char journal_file_path[] = */ "", \ - /* hbool_t journal_recovered = */ FALSE, \ - /* size_t jbrb_buf_size = */ (8 * 1024), \ - /* int jbrb_num_bufs = */ 2, \ - /* hbool_t jbrb_use_aio = */ FALSE, \ - /* hbool_t jbrb_human_readable = */ TRUE \ + /* int dirty_bytes_threshold = */ (256 * 1024) \ } diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index 6539a64..97be6f4 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -444,25 +444,6 @@ typedef struct H5AC_cache_config_t /* parallel configuration fields: */ int dirty_bytes_threshold; - /* The following fields are not used in H5AC or H5C. They are - * added because they are used in H5AC2 and H5C2, and putting - * them here allows us to avoid duplicating the functions involved - * in metadata cache configuration at the user API level. - * - * The old H5AC and H5C code simply ignores them. - * - * -- JRM - */ - /* metadata journaling configuration fields: */ - hbool_t enable_journaling; - char journal_file_path[ - H5AC__MAX_JOURNAL_FILE_NAME_LEN]; - hbool_t journal_recovered; - size_t jbrb_buf_size; - int jbrb_num_bufs; - hbool_t jbrb_use_aio; - hbool_t jbrb_human_readable; - } H5AC_cache_config_t; @@ -2282,7 +2282,7 @@ H5C2_get_trace_file_ptr_from_entry(const H5C2_cache_entry_t *entry_ptr, { const H5C2_t *cache_ptr; /* Cache pointer, from entry */ - FUNC_ENTER_NOAPI_NOFUNC(H5C2_get_trace_file_ptr) + FUNC_ENTER_NOAPI_NOFUNC(H5C2_get_trace_file_ptr_from_entry) /* Sanity checks */ HDassert( entry_ptr ); diff --git a/src/H5C2journal.c b/src/H5C2journal.c index 84d9260..4eaab9e 100644 --- a/src/H5C2journal.c +++ b/src/H5C2journal.c @@ -522,10 +522,7 @@ done: * * Changes: * - * John Mainzer -- 4/2/08 - * Modified function to report the pending journaling - * status if journaling has been enabled, but not yet - * configured. + * None. * *------------------------------------------------------------------------- */ @@ -533,7 +530,6 @@ done: herr_t H5C2_get_journal_config(H5C2_t * cache_ptr, hbool_t * journaling_enabled_ptr, - hbool_t * startup_pending_ptr, char * journal_file_path_ptr, size_t * jbrb_buf_size_ptr, int * jbrb_num_bufs_ptr, @@ -553,16 +549,10 @@ H5C2_get_journal_config(H5C2_t * cache_ptr, "journaling_enabled_ptr NULL on entry!?!.") } - if ( cache_ptr->mdj_enabled ) { *journaling_enabled_ptr = TRUE; - if ( startup_pending_ptr != NULL ) { - - *startup_pending_ptr = FALSE; - } - if ( journal_file_path_ptr != NULL ) { HDsnprintf(journal_file_path_ptr, @@ -3411,14 +3401,27 @@ H5C2_jb__bin2hex(const uint8_t * buf, * * Modifications: * + * John Mainzer -- 8/4/08 + * Reworked the function to use the new H5AC2_jnl_config_t + * structure and the associated utilities. + * + * I can't but observe that this function really doesn't + * belong in this file. Also, it used (and still uses) + * API calls -- which really shouldn't happen in the + * library. + * + * We must address these issues eventually, but for now my + * objective is simply to avoid breaking Albert's test code. + * *------------------------------------------------------------------------- */ herr_t -H5Pset_journal(hid_t fapl_id, const char *journal_file) +H5Pset_journal(hid_t fapl_id, + const char *journal_file) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* set to SUCCEED for now. */ - H5AC2_cache_config_t mdj_config; + H5AC2_jnl_config_t config; FUNC_ENTER_API(H5Pset_journal, FAIL) H5TRACE2("e", "i*s", fapl_id, journal_file); @@ -3432,28 +3435,31 @@ H5Pset_journal(hid_t fapl_id, const char *journal_file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file name too long") /* setup cache config struct to enable journaling */ - mdj_config.version = H5AC2__CURR_CACHE_CONFIG_VERSION; + config.version = H5AC2__CURR_JNL_CONFIG_VER; /* get cache config struct information */ - H5Pget_mdc_config(fapl_id, (H5AC_cache_config_t *)&mdj_config); + H5Pget_jnl_config(fapl_id, &config); /* set enable journaling field to true */ - mdj_config.enable_journaling = TRUE; /* turn on journaling */ - mdj_config.jbrb_buf_size = 8*1024; /* multiples of system buffer size*/ - mdj_config.jbrb_num_bufs = 2; - mdj_config.jbrb_use_aio = FALSE; /* only sync IO is supported */ - mdj_config.jbrb_human_readable = TRUE; /* only readable form is supported */ + config.enable_journaling = TRUE; /* turn on journaling */ + config.journal_recovered = FALSE; + config.jbrb_buf_size = 8*1024; /* multiples of system buffer size*/ + config.jbrb_num_bufs = 2; + config.jbrb_use_aio = FALSE; /* only sync IO is supported */ + config.jbrb_human_readable = TRUE; /* only readable form is supported */ /* specify name of journal file */ - HDstrcpy(mdj_config.journal_file_path, journal_file); + HDstrcpy(config.journal_file_path, journal_file); /* set latest format */ if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'latest format'") /* set cache config struct information */ - ret_value = H5Pset_mdc_config(fapl_id, (H5AC_cache_config_t *)&mdj_config); + ret_value = H5Pset_jnl_config(fapl_id, &config); done: + FUNC_LEAVE_API(ret_value) -} + +} /* H5Pset_journal() */ diff --git a/src/H5C2pkg.h b/src/H5C2pkg.h index 9111165..7646946 100644 --- a/src/H5C2pkg.h +++ b/src/H5C2pkg.h @@ -3617,7 +3617,7 @@ if ( ( (cache_ptr) == NULL ) || \ } else if ( (entry_ptr)->last_trans != 0 ) { \ \ HDassert( (cache_ptr)->mdj_enabled ); \ - HDassert( (cache_ptr)->trans_in_progress ); \ + HDassert( (entry_ptr)->is_dirty ); \ H5C2__DLL_REMOVE((entry_ptr), \ ((cache_ptr)->jwipl_head_ptr), \ ((cache_ptr)->jwipl_tail_ptr), \ diff --git a/src/H5C2private.h b/src/H5C2private.h index 276180d..1e4dbb3 100644 --- a/src/H5C2private.h +++ b/src/H5C2private.h @@ -1484,7 +1484,6 @@ H5_DLL herr_t H5C2_end_transaction(H5F_t * f, H5_DLL herr_t H5C2_get_journal_config(H5C2_t * cache_ptr, hbool_t * journaling_enabled_ptr, - hbool_t * startup_pending_ptr, char * journal_file_path_ptr, size_t * jbrb_buf_size_ptr, int * jbrb_num_bufs_ptr, @@ -309,6 +309,8 @@ H5F_get_access_plist(H5F_t *f) /* Copy properties of the file access property list */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial metadata cache resize config.") + if(H5P_set(new_plist, H5F_ACS_JNL_INIT_CONFIG_NAME, &(f->shared->initJnlCfg)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set initial journaling config.") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &(f->shared->rdcc_nelmts)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache element size") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) @@ -883,6 +885,8 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config") + if(H5P_get(plist, H5F_ACS_JNL_INIT_CONFIG_NAME, &(f->shared->initJnlCfg)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial journaling config") if(H5P_get(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &(f->shared->rdcc_nelmts)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get data cache element size") if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) @@ -939,11 +943,8 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) /* Create a metadata cache with modified API along side the regular * version. For now, this is just for testing. Once we get it * fully in use, we will delete the old version. - * - * Note the use of H5P_DATASET_XFER_DEFAULT for the dxpl_id parameter - * of H5AC2_create(). We may want to change this. */ - if(H5AC2_create(f, H5P_DATASET_XFER_DEFAULT, + if(H5AC2_create(f, (H5AC2_cache_config_t *)&(f->shared->mdc_initCacheCfg)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache2") @@ -1195,7 +1196,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) * Added calls to H5AC2_check_for_journaling() and * H5AC2_set_cache_journaling_config() at the end of * H5F_open(). For now at least, both of these operations - * must be done juct before H5F_open() returns, as the + * must be done just before H5F_open() returns, as the * required information is not available when the metadata * cache is created. * @@ -1400,9 +1401,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") { - H5AC2_cache_config_t * config_ptr = NULL; + H5AC2_jnl_config_t * config_ptr = NULL; - config_ptr = ((H5AC2_cache_config_t *)&(file->shared->mdc_initCacheCfg)); + config_ptr = &(file->shared->initJnlCfg); if ( H5AC2_check_for_journaling(file, dxpl_id, file->shared->cache2, config_ptr->journal_recovered) < 0 ) { @@ -1411,11 +1412,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d "H5AC2_check_for_journaling() reports failure.") } - if ( H5AC2_set_cache_journaling_config(file, dxpl_id, - config_ptr, TRUE) < 0 ) { + if ( H5AC2_set_jnl_config(file, dxpl_id, config_ptr) < 0 ) { HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, \ - "H5AC2_set_cache_journaling_config() failed.") + "H5AC2_set_jnl_config() failed.") } } @@ -3326,23 +3326,29 @@ done: * Programmer: Quincey Koziol * 7/3/08 * + * Changes: John Mainzer + * 8/4/08 + * Reworked function to use the new H5AC2_jnl_config_t + * structure and H5AC2_get_jnl_config(). + * *------------------------------------------------------------------------- */ htri_t H5F_is_journaling_enabled(const H5F_t *f) { - H5AC2_cache_config_t mdc_config; /* Current cache configuration */ + H5AC2_jnl_config_t config; /* Current journaling configuration */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5F_is_journaling_enabled, FAIL) /* Retrieve the current cache information */ - mdc_config.version = H5AC2__CURR_CACHE_CONFIG_VERSION; - if(H5AC2_get_cache_auto_resize_config(f->shared->cache2, &mdc_config) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache configuration") + config.version = H5AC2__CURR_JNL_CONFIG_VER; + if(H5AC2_get_jnl_config(f->shared->cache2, &config) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, \ + "can't retrieve journaling configuration") /* Set return value */ - ret_value = mdc_config.enable_journaling; + ret_value = config.enable_journaling; done: FUNC_LEAVE_NOAPI(ret_value) @@ -3350,6 +3356,121 @@ done: /*------------------------------------------------------------------------- + * Function: H5Fget_jnl_config + * + * Purpose: Retrieves the current journaling configuration, and + * return it in *config_ptr. + * + * Note that the version field of *config_Ptr must be correctly + * filled in by the caller. This allows us to adapt for + * obsolete versions of the structure. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: John Mainzer + * 8/1/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5Fget_jnl_config(hid_t file_id, + H5AC2_jnl_config_t *config_ptr) +{ + H5F_t *file=NULL; /* File object for file ID */ + herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + + FUNC_ENTER_API(H5Fget_jnl_config, FAIL) + H5TRACE2("e", "i*x", file_id, config_ptr); + + /* Check args */ + if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + } + + if ( ( NULL == config_ptr ) || + ( config_ptr->version != H5AC2__CURR_JNL_CONFIG_VER ) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") + } + + /* Go get the journaling configuration */ + result = H5AC2_get_jnl_config(file->shared->cache2, config_ptr); + + if ( result != SUCCEED ) { + + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "H5AC_get_jnl_config() failed."); + } + +done: + + FUNC_LEAVE_API(ret_value) + +} /* H5Fget_jnl_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5Fset_jnl_config + * + * Purpose: Sets the current journaling configuration, using the + * contents of the instance of H5AC2_jnl_config_t pointed + * to by config_ptr. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: John Mainzer + * 8/1/08 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5Fset_jnl_config(hid_t file_id, + H5AC2_jnl_config_t *config_ptr) +{ + H5F_t *file=NULL; /* File object for file ID */ + herr_t ret_value = SUCCEED; /* Return value */ + herr_t result; + + FUNC_ENTER_API(H5Fset_jnl_config, FAIL) + H5TRACE2("e", "i*x", file_id, config_ptr); + + /* Check args */ + if ( NULL == (file = H5I_object_verify(file_id, H5I_FILE)) ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + } + + /* set the resize configuration */ + result = H5AC2_set_jnl_config(file, H5P_DATASET_XFER_DEFAULT, config_ptr); + + if ( result != SUCCEED ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "H5AC2_set_jnl_config() failed."); + } + +done: + + FUNC_LEAVE_API(ret_value) + +} /* H5Fset_jnl_config() */ + + +/*------------------------------------------------------------------------- * Function: H5Fget_mdc_config * * Purpose: Retrieves the current automatic cache resize configuration @@ -3460,7 +3581,6 @@ H5Fset_mdc_config(hid_t file_id, /* pass the resize configuration to the modified cache as well. */ result = H5AC2_set_cache_auto_resize_config(file, - H5P_DATASET_XFER_DEFAULT, (H5AC2_cache_config_t *)config_ptr); if ( result != SUCCEED ) { diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2e34e64..64da334 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -99,6 +99,11 @@ typedef struct H5F_file_t { /* metadata cache. This structure is */ /* fixed at creation time and should */ /* not change thereafter. */ + H5AC2_jnl_config_t + initJnlCfg; /* Initial journaling configuration for */ + /* the file. At least in its initial */ + /* incarnation, this structure contains */ + /* only metadata journaling config data */ hid_t fcpl_id; /* File creation property list ID */ H5F_close_degree_t fc_degree; /* File close behavior degree */ size_t rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 25355ab..8786306 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -366,6 +366,7 @@ typedef struct H5F_t H5F_t; /* ========= File Access properties ============ */ #define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ +#define H5F_ACS_JNL_INIT_CONFIG_NAME "initJnlCfg" /* Initial journaling configuration */ #define H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME "rdcc_nelmts" /* Size of raw data chunk cache(elements) */ #define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ #define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index a055d46..185775d 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -23,6 +23,7 @@ #include "H5public.h" #include "H5Cpublic.h" #include "H5ACpublic.h" +#include "H5AC2public.h" #include "H5Ipublic.h" /* When this header is included from a private header, don't make calls to H5check() */ @@ -136,6 +137,10 @@ H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist); H5_DLL herr_t H5Funmount(hid_t loc, const char *name); H5_DLL hssize_t H5Fget_freespace(hid_t file_id); H5_DLL herr_t H5Fget_filesize(hid_t file_id, hsize_t *size); +H5_DLL herr_t H5Fget_jnl_config(hid_t file_id, + H5AC2_jnl_config_t *config_ptr); +H5_DLL herr_t H5Fset_jnl_config(hid_t file_id, + H5AC2_jnl_config_t *config_ptr); H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t * config_ptr); H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index f31d1a4..c1fc572 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -35,6 +35,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5AC2private.h" /* Metadata cache2 */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ @@ -58,6 +59,8 @@ /* Definitions for the initial metadata cache resize configuration */ #define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) #define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG +#define H5F_ACS_JNL_INIT_CONFIG_SIZE sizeof(H5AC2_jnl_config_t) +#define H5F_ACS_JNL_INIT_CONFIG_DEF H5AC2__DEFAULT_JNL_CONFIG /* Definitions for size of raw data chunk cache(elements) */ #define H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE sizeof(size_t) #define H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF 521 @@ -188,6 +191,7 @@ static herr_t H5P_facc_reg_prop(H5P_genclass_t *pclass) { H5AC_cache_config_t mdc_initCacheCfg = H5F_ACS_META_CACHE_INIT_CONFIG_DEF; /* Default metadata cache settings */ + H5AC2_jnl_config_t initJnlCfg = H5F_ACS_JNL_INIT_CONFIG_DEF; /* Default journaling config settings */ size_t rdcc_nelmts = H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF; /* Default raw data chunk cache # of elements */ size_t rdcc_nbytes = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */ double rdcc_w0 = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */ @@ -213,6 +217,11 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) if(H5P_register(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the initial journaling configuration */ + if(H5P_register(pclass, H5F_ACS_JNL_INIT_CONFIG_NAME, H5F_ACS_JNL_INIT_CONFIG_SIZE, &initJnlCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the size of raw data chunk cache (elements) */ if(H5P_register(pclass, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -1436,6 +1445,133 @@ done: /*------------------------------------------------------------------------- + * Function: H5Pset_jnl_config + * + * Purpose: Set the initial journaling configuration in the + * target FAPL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: J. Mainzer + * Thursday, July 31, 2008 + * + * Modifications: + * + * Done. + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_jnl_config(hid_t plist_id, + H5AC2_jnl_config_t * config_ptr) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pset_jnl_config, FAIL); + H5TRACE2("e", "i*x", plist_id, config_ptr); + + /* Get the plist structure */ + if( NULL == ( plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS) ) ) { + + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + } + + /* validate the new configuration */ + if ( H5AC2_validate_jnl_config(config_ptr) < 0 ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ + "invalid journaling configuration"); + } + + /* set the modified config */ + + /* If we ever support multiple versions of H5AC_jnl_config_t, we + * will have to test the version and do translation here. + */ + + if(H5P_set(plist, H5F_ACS_JNL_INIT_CONFIG_NAME, config_ptr)<0) { + + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, \ + "can't set initial journaling config"); + } + +done: + + FUNC_LEAVE_API(ret_value); + +} /* H5Pset_jnl_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_mdc_config + * + * Purpose: Retrieve the journaling initial configuration + * from the target FAPL. + * + * Observe that the function will fail if config_ptr is + * NULL, or if config_ptr->version specifies an unknown + * version of H5AC_jnl_config_t. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: J. Mainzer + * Thursday, July 31, 2008 + * + * Modifications: + * + * None. + * + *------------------------------------------------------------------------- + */ + +herr_t +H5Pget_jnl_config(hid_t plist_id, + H5AC2_jnl_config_t * config_ptr) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Pget_jnl_config, FAIL); + H5TRACE2("e", "i*x", plist_id, config_ptr); + + /* Get the plist structure */ + if ( NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)) ) { + + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + } + + /* validate the config_ptr */ + if ( config_ptr == NULL ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") + } + + if ( config_ptr->version != H5AC2__CURR_JNL_CONFIG_VER ) { + + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") + } + + /* If we ever support multiple versions of H5AC_jnl_config_t, we + * will have to get the cannonical version here, and then translate + * to the version of the structure supplied. + */ + + /* Get the current initial metadata cache resize configuration */ + if ( H5P_get(plist, H5F_ACS_JNL_INIT_CONFIG_NAME, config_ptr) < 0 ) { + + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, \ + "can't get initial journaling config"); + } + +done: + + FUNC_LEAVE_API(ret_value); + +} /* H5Pget_jnl_config() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_gc_references * * Purpose: Sets the flag for garbage collecting references for the file. diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 8382101..f2a8d1a 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -25,6 +25,7 @@ /* Public headers needed by this file */ #include "H5public.h" #include "H5Cpublic.h" +#include "H5AC2public.h" #include "H5Dpublic.h" #include "H5Fpublic.h" #include "H5FDpublic.h" @@ -255,6 +256,10 @@ H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t * config_ptr); H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t * config_ptr); /* out */ +H5_DLL herr_t H5Pset_jnl_config(hid_t plist_id, + H5AC2_jnl_config_t * config_ptr); +H5_DLL herr_t H5Pget_jnl_config(hid_t plist_id, + H5AC2_jnl_config_t * config_ptr); /* out */ H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref/*out*/); H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); |