diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-10-11 20:02:54 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-10-11 20:02:54 (GMT) |
commit | 1fa1ec619011a1ba13935a5c68f217e60f20c0a7 (patch) | |
tree | 0cf682df6376db930f2fb86e99bf6eb39ccee868 /src/H5O.c | |
parent | af2e625041ee761f5e88d0ea221a356c28302841 (diff) | |
parent | 75f2ed6167b094431fce2b4b700b3cf9da564c51 (diff) | |
download | hdf5-1fa1ec619011a1ba13935a5c68f217e60f20c0a7.zip hdf5-1fa1ec619011a1ba13935a5c68f217e60f20c0a7.tar.gz hdf5-1fa1ec619011a1ba13935a5c68f217e60f20c0a7.tar.bz2 |
Merge pull request #2001 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:1_12_alpha_merges to hdf5_1_12
* commit '75f2ed6167b094431fce2b4b700b3cf9da564c51':
Fixed a bug (HDFFV-10899) where the behavior of the deprecated H5Gget_objinfo() call had changed and passing in a non-existing soft link with a statbuf of NULL passed instead of failed (as it should as per the RM). The HDF5 1.8 and 1.10 behavior was restored and H5Gget_objinfo() will now fail and return -1 as before.
Fixed the java assert issue with H5O cache corking calls.
Corrected missing parallel #ifdefs.
Converted H5O MD cache cork calls to use the VOL.
Marked up H5Fget/set_mpi_atomicity() to use the VOL.
Diffstat (limited to 'src/H5O.c')
-rw-r--r-- | src/H5O.c | 210 |
1 files changed, 156 insertions, 54 deletions
@@ -1116,113 +1116,215 @@ done: /*------------------------------------------------------------------------- - * Function: H5Odisable_mdc_flushes + * Function: H5O_disable_mdc_flushes * - * Purpose: To "cork" an object: - * --keep dirty entries associated with the object in the metadata cache + * Purpose: Private version of the metadata cache cork function. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_disable_mdc_flushes(H5O_loc_t *oloc) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + + if (H5AC_cork(oloc->file, oloc->addr, H5AC__SET_CORK, NULL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5O_disable_mdc_flushes() */ + + +/*------------------------------------------------------------------------- + * Function: H5Odisable_mdc_flushes + * + * Purpose: "Cork" an object, keeping dirty entries associated with the + * object in the metadata cache. + * + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * January 2014 + * Programmer: Vailin Choi + * January 2014 * *------------------------------------------------------------------------- */ herr_t H5Odisable_mdc_flushes(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(FAIL); H5TRACE1("e", "i", object_id); - /* Get the object's oloc */ - if(NULL == (oloc = H5O_get_loc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") + /* Make sure the ID is a file object */ + if (H5I_is_file_object(object_id) != TRUE) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); - if(H5AC_cork(oloc->file, oloc->addr, H5AC__SET_CORK, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork an object") + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); + + /* Cork the object */ + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, &loc_params) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API(ret_value); } /* H5Odisable_mdc_flushes() */ /*------------------------------------------------------------------------- - * Function: H5Oenable_mdc_flushes + * Function: H5O_enable_mdc_flushes * - * Purpose: To "uncork" an object - * --release keeping dirty entries associated with the object - * in the metadata cache + * Purpose: Private version of the metadata cache uncork function. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_enable_mdc_flushes(H5O_loc_t *oloc) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + + if (H5AC_cork(oloc->file, oloc->addr, H5AC__UNCORK, NULL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5O_enable_mdc_flushes() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oenable_mdc_flushes + * + * Purpose: "Uncork" an object, allowing dirty entries associated with + * the object to be flushed. * - * Programmer: Vailin Choi - * January 2014 + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi + * January 2014 * *------------------------------------------------------------------------- */ herr_t H5Oenable_mdc_flushes(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(FAIL); H5TRACE1("e", "i", object_id); - /* Get the object's oloc */ - if(NULL == (oloc = H5O_get_loc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") + /* Make sure the ID is a file object */ + if (H5I_is_file_object(object_id) != TRUE) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); + + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); - /* Set the value */ - if(H5AC_cork(oloc->file, oloc->addr, H5AC__UNCORK, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + /* Uncork the object */ + if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, &loc_params) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API(ret_value); } /* H5Oenable_mdc_flushes() */ /*------------------------------------------------------------------------- - * Function: H5Oare_mdc_flushes_disabled + * Function: H5O_are_mdc_flushes_disabled * - * Purpose: Retrieve the object's "cork" status in the parameter "are_disabled": - * TRUE if mdc flushes for the object is disabled - * FALSE if mdc flushes for the object is not disabled - * Return error if the parameter "are_disabled" is not supplied + * Purpose: Private version of cork status getter. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + + HDassert(are_disabled); + + if (H5AC_cork(oloc->file, oloc->addr, H5AC__GET_CORKED, are_disabled) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5O_are_mdc_flushes_disabled() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oare_mdc_flushes_disabled + * + * Purpose: Retrieve the object's "cork" status in the parameter "are_disabled": + * TRUE if mdc flushes for the object is disabled + * FALSE if mdc flushes for the object is not disabled * - * Programmer: Vailin Choi - * January 2014 + * Return error if the parameter "are_disabled" is not supplied + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi + * January 2014 * *------------------------------------------------------------------------- */ herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(FAIL); H5TRACE2("e", "i*b", object_id, are_disabled); - /* Check args */ + /* Sanity check */ + if (!are_disabled) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID"); - /* Get the object's oloc */ - if(NULL == (oloc = H5O_get_loc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") - if(!are_disabled) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") + /* Make sure the ID is a file object */ + if (H5I_is_file_object(object_id) != TRUE) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); + + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); /* Get the cork status */ - if(H5AC_cork(oloc->file, oloc->addr, H5AC__GET_CORKED, are_disabled) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, &loc_params, are_disabled) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status"); done: FUNC_LEAVE_API(ret_value) |