diff options
author | John Mainzer <mainzer@hdfgroup.org> | 2008-02-18 05:28:04 (GMT) |
---|---|---|
committer | John Mainzer <mainzer@hdfgroup.org> | 2008-02-18 05:28:04 (GMT) |
commit | cd571e4a45e5af71ae608388141e6b28a16f8171 (patch) | |
tree | 27a6b76035cd03c2b13946730225b34f0f03d98d /src/H5Fsuper.c | |
parent | d3e926b897b42d27e1c5f8533a8a413c448738e2 (diff) | |
download | hdf5-cd571e4a45e5af71ae608388141e6b28a16f8171.zip hdf5-cd571e4a45e5af71ae608388141e6b28a16f8171.tar.gz hdf5-cd571e4a45e5af71ae608388141e6b28a16f8171.tar.bz2 |
[svn-r14594] Ported flash cache size increase code into the journaling branch --
note that both the H5C and H5C2 code have been updated.
Also checked in code to track journaling status in the super block.
Note that this code has not been tested -- but as best I can tell,
it does not break the existing regression tests.
Tested serial (debug and production) on Phoenix. Also tested parallel
on kagiso.
Note that regression test fails on kagiso (but not on phoenix) if
the cache2 serial tests are configured to use the core file driver.
Thus this code is check in with the core file driver optimization
of the cache2 tests disabled. To turn it on, set the USE_CORE_DRIVER
#define to TRUE.
Diffstat (limited to 'src/H5Fsuper.c')
-rw-r--r-- | src/H5Fsuper.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index cbc5f72..ed3395e 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -33,6 +33,8 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5MMprivate.h" /* Memory management */ + /****************/ @@ -226,6 +228,12 @@ done: * wendling@ncsa.uiuc.edu * Sept 12, 2003 * + * Changes: Johm Mainzer + * 12/14/07 + * Added code to read in the metadata journaling config + * if it is present, and to initialize + * f->shared->journaling_enabled to FALSE if it isn't. + * *------------------------------------------------------------------------- */ herr_t @@ -251,6 +259,14 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) shared = f->shared; lf = shared->lf; + /* initialize the metadata journaling configuration sections of the + * super block to indicate that journaling is not turned on at + * present. These initialization may be overridden shortly. + */ + shared->journaling_enabled = FALSE; + shared->path_len = 0; + shared->external_journal_file_path_ptr = NULL; + /* Get the shared file creation property list */ if(NULL == (c_plist = H5I_object(shared->fcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") @@ -553,6 +569,9 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) H5O_loc_t ext_loc; /* "Object location" for superblock extension */ H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */ H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */ + H5O_mdj_conf_t mdj_conf;/* metadata journaling config message + * from superblock extension + */ /* Sanity check - superblock extension should only be defined for * superblock version >= 2. @@ -617,6 +636,48 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); } /* end else */ + /* Read in the metadata journaling configuration message, + * if it exists. + */ + if(NULL == H5O_msg_read(&ext_loc, H5O_MDJ_CONF_ID, &mdj_conf, dxpl_id)) { + /* Reset error from "failed" message read */ + H5E_clear_stack(NULL); + } /* end if */ + else { + + shared->journaling_enabled = mdj_conf.journaling_enabled; + + if ( shared->journaling_enabled ) { + + shared->journal_is_external = mdj_conf.journal_is_external; + shared->internal_journal_loc = mdj_conf.internal_journal_loc; + shared->path_len = mdj_conf.path_len; + shared->external_journal_file_path_ptr = + mdj_conf.external_journal_file_path_ptr; + + /* for now at least, the journal file must always be + * external -- hence the following asserts. Remove them + * if we ever support an internal journal. + */ + HDassert( shared->journal_is_external ); + HDassert( shared->path_len > 0 ); + HDassert( shared->external_journal_file_path_ptr != NULL ); + + /* if there is a an external journal file, + * H5O_mdj_conf_decode() will allocate a buffer to + * store it in. Rather than allocate our own buffer, + * we will use the one created by H5O_mdj_conf_decode(), + * and modify mdj_conf so that H5O_mdj_conf_reset() will + * not discard it. + */ + mdj_conf.path_len = 0; + mdj_conf.external_journal_file_path_ptr = NULL; + } + + /* Reset metadata journaling config message */ + H5O_msg_reset(H5O_MDJ_CONF_ID, &mdj_conf); + } + /* Close the extension. Twiddle the number of open objects to avoid * closing the file (since this will be the only open object). */ @@ -645,6 +706,13 @@ done: * koziol@ncsa.uiuc.edu * Sept 15, 2003 * + * Changes: John Mainzer + * Dec. 14, 2007 + * Added initialization for the metadata journaling + * configuration fields. By default, these fields are + * initialized to indicate that we are not journaling + * metadata. + * *------------------------------------------------------------------------- */ herr_t @@ -802,6 +870,43 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") } /* end if */ + /* check for journaling config data to store */ + if ( f->shared->journaling_enabled ) { + + struct H5O_mdj_conf_t mdj_conf; + + mdj_conf.journaling_enabled = f->shared->journaling_enabled; + mdj_conf.journal_is_external = f->shared->journal_is_external; + mdj_conf.internal_journal_loc = f->shared->internal_journal_loc; + mdj_conf.path_len = f->shared->path_len; + + if ( f->shared->external_journal_file_path_ptr == NULL ) { + + mdj_conf.external_journal_file_path_ptr = NULL; + + } else { + + if ( ( NULL == (mdj_conf.external_journal_file_path_ptr = + H5MM_malloc(mdj_conf.path_len + 1)) ) ) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ + "memory alloc failed for mdj path") + + } + HDmemcpy(mdj_conf.external_journal_file_path_ptr, + f->shared->external_journal_file_path_ptr, + f->shared->path_len); + } + + if ( H5O_msg_create(&ext_loc, H5O_MDJ_CONF_ID, + H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, + H5O_UPDATE_TIME, &mdj_conf, dxpl_id) < 0 ) { + + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, \ + "unable to update metadata journal conf header message") + } + } + /* Twiddle the number of open objects to avoid closing the file * (since this will be the only open object currently). */ |