diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2017-10-23 15:48:26 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2017-10-23 15:48:26 (GMT) |
commit | 23460c30f10e098a980c5466b6108269d2fd92f6 (patch) | |
tree | 4f72697342c43c0572140683e5cbcc076d04cf6f | |
parent | d5acbfeb9e469ada610c4efa35a225be1cc2e0c1 (diff) | |
parent | d8a3782ce49d537d96020dfa250a253d90f4c14f (diff) | |
download | hdf5-23460c30f10e098a980c5466b6108269d2fd92f6.zip hdf5-23460c30f10e098a980c5466b6108269d2fd92f6.tar.gz hdf5-23460c30f10e098a980c5466b6108269d2fd92f6.tar.bz2 |
Merge pull request #714 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:swmr_ci_move to develop
* commit 'd8a3782ce49d537d96020dfa250a253d90f4c14f':
Moved the SWMR + cache image check up before the root group is constructed to avoid the special case close.
Moved the 'cache image + SWMR' check from H5Fcreate/open to H5F_open. Prep for the VOL merge.
-rw-r--r-- | src/H5F.c | 18 | ||||
-rw-r--r-- | src/H5Fint.c | 9 |
2 files changed, 10 insertions, 17 deletions
@@ -443,8 +443,6 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - hbool_t ci_load = FALSE; /* whether MDC ci load requested */ - hbool_t ci_write = FALSE; /* whether MDC CI write requested */ H5F_t *new_file = NULL; /*file struct for new file */ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ @@ -490,12 +488,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") - /* Check to see if both SWMR and cache image are requested. Fail if so */ - if(H5C_cache_image_status(new_file, &ci_load, &ci_write) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status") - if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) - HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image") - /* Get an atom for the file */ if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file") @@ -554,8 +546,6 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - hbool_t ci_load = FALSE; /* whether MDC ci load requested */ - hbool_t ci_write = FALSE; /* whether MDC CI write requested */ H5F_t *new_file = NULL; /*file struct for new file */ hid_t dxpl_id = H5AC_ind_read_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ @@ -585,12 +575,6 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") - /* Check to see if both SWMR and cache image are requested. Fail if so */ - if(H5C_cache_image_status(new_file, &ci_load, &ci_write) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status") - if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) - HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and cache image") - /* Get an atom for the file */ if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") @@ -1649,7 +1633,7 @@ H5Fstart_swmr_write(hid_t file_id) /* Flush the superblock extension */ if(H5F_flush_tagged_metadata(file, file->shared->sblock->ext_addr, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension") /* Flush data buffers */ if(H5F__flush(file, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0) diff --git a/src/H5Fint.c b/src/H5Fint.c index 4c5e00e..7371c46 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1186,6 +1186,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F_t *ret_value = NULL; /*actual return value */ char *lock_env_var = NULL;/*env var pointer */ hbool_t use_file_locking; /*read from env var */ + hbool_t ci_load = FALSE; /* whether MDC ci load requested */ + hbool_t ci_write = FALSE; /* whether MDC CI write requested */ FUNC_ENTER_NOAPI(NULL) @@ -1319,6 +1321,12 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, set_flag = TRUE; } /* end else */ + /* Check to see if both SWMR and cache image are requested. Fail if so */ + if(H5C_cache_image_status(file, &ci_load, &ci_write) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status") + if((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't have both SWMR and cache image") + /* Retain the name the file was opened with */ file->open_name = H5MM_xstrdup(name); @@ -1497,6 +1505,7 @@ done: if((NULL == ret_value) && file) if(H5F__dest(file, meta_dxpl_id, raw_dxpl_id, FALSE) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_open() */ |