diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-11-02 19:00:56 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2010-11-02 19:00:56 (GMT) |
commit | a9ca88d1564351db7ca9371eeede12473b26a6a6 (patch) | |
tree | caff74657cad616101e47989359faac2c53dbc26 /src/H5G.c | |
parent | 8e04644abdc73446e85bac72bcced171a927b1f0 (diff) | |
download | hdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.zip hdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.tar.gz hdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.tar.bz2 |
[svn-r19714] Purpose:
Add API and supporting code to allow single object flushes and refreshes.
Description:
Added the following API calls:
H5Dflush / H5Drefresh
H5Gflush / H5Grefresh
H5Tflush / H5Trefresh
H5Oflush / H5Orefresh
Each H5*flush API flushes the targeted object's metadata,
while each H5*refresh evicts all metadata related to an object
and reopens the object (re-loading needed metadata from disk).
New files include src/H5Oflush.c, containing new internal H5O_*
functions used by the above API calls. Also, a test file and test
script template have been added, test/flushrefresh.c and
test/testflushrefresh.sh.in. There is not (yet) a corresponding
test script for windows as the current one isn't quite portable.
Several H5C and H5AC-level functions have been added to support
single object flushing and eviction, and the previously committed
'metadata tagging' code has been tweaked slightly to pull H5AC__*
macros out of H5C.c and a few other fixes as necessary as well.
Tag globality has been added to better encapsulate the meaning of
global tags in the H5C layer of the code.
Tested:
h5committested.
Diffstat (limited to 'src/H5G.c')
-rw-r--r-- | src/H5G.c | 68 |
1 files changed, 68 insertions, 0 deletions
@@ -1902,4 +1902,72 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_visit() */ + + +/*------------------------------------------------------------------------- + * Function: H5Gflush + * + * Purpose: Flushes all buffers associated with a group to disk. + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Mike McGreevy + * May 19, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Gflush(hid_t group_id) +{ + H5G_t *grp; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Gflush, FAIL) + H5TRACE1("e", "i", group_id); + + /* Check args */ + if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + + /* Call private function to flush group object */ + if (H5O_flush_metadata(&grp->oloc, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Gflush */ + + +/*------------------------------------------------------------------------- + * Function: H5Grefresh + * + * Purpose: Refreshes all buffers associated with a dataset. + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Mike McGreevy + * July 21, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Grefresh(hid_t group_id) +{ + H5G_t * grp = NULL; + hid_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(H5Grefresh, FAIL) + H5TRACE1("e", "i", group_id); + + /* Check args */ + if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + + /* Call private function to refresh group object */ + if ((H5O_refresh_metadata(group_id, grp->oloc, H5AC_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Grefresh */ |