diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-11-08 11:49:22 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-11-08 11:49:22 (GMT) |
commit | 048f77864f8420c692988220635bee8beeb3b421 (patch) | |
tree | 9e8541adc6fa4495acfdaa3206c2abcdcf2b7011 /src/H5Dint.c | |
parent | fef44254feda42e3a9ea52eb1035f57dcb50ef77 (diff) | |
download | hdf5-048f77864f8420c692988220635bee8beeb3b421.zip hdf5-048f77864f8420c692988220635bee8beeb3b421.tar.gz hdf5-048f77864f8420c692988220635bee8beeb3b421.tar.bz2 |
[svn-r28307] Updated the dataset refresh code so that VDS source datasets
are correctly updated.
Tested on Ubuntu 15.10 (Linux 4.2.0 x86_64) w/ gcc 5.2.1
serial + parallel (MPICH 3.1.4)
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r-- | src/H5Dint.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index 1bfe204..596c99a 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3339,7 +3339,7 @@ hid_t H5D_get_space(H5D_t *dset) { H5S_t *space = NULL; - hid_t ret_value = FAIL; + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI_NOINIT @@ -3416,3 +3416,57 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_get_type() */ + +/*------------------------------------------------------------------------- + * Function: H5D__refresh + * + * Purpose: Refreshes all buffers associated with a dataset. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * November 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__refresh(hid_t dset_id, H5D_t *dset, hid_t dxpl_id) +{ + H5D_virtual_held_file_t *head = NULL; /* Pointer to list of files held open */ + hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(dset); + + /* If the layout is virtual... */ + if(dset->shared->layout.type == H5D_VIRTUAL) { + /* Hold open the source datasets' files */ + if(H5D__virtual_hold_source_dset_files(dset, &head) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "unable to hold VDS source files open") + virt_dsets_held = TRUE; + + /* Refresh source datasets for virtual dataset */ + if(H5D__virtual_refresh_source_dsets(dset, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh VDS source datasets") + } /* end if */ + + /* Refresh dataset object */ + if((H5O_refresh_metadata(dset_id, dset->oloc, dxpl_id)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset") + +done: + /* Release hold on virtual datasets' files */ + if(virt_dsets_held) { + /* Sanity check */ + HDassert(dset->shared->layout.type == H5D_VIRTUAL); + + /* Release the hold on source datasets' files */ + if(H5D__virtual_release_source_dset_files(head) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__refresh() */ + |