summaryrefslogtreecommitdiffstats
path: root/src/H5Dint.c
diff options
context:
space:
mode:
authorNeil Fortner <fortnern@gmail.com>2022-07-19 01:15:48 (GMT)
committerGitHub <noreply@github.com>2022-07-19 01:15:48 (GMT)
commit5c399982245bbbf15cefa028d399b94d62932d61 (patch)
tree890d1ce5068ab7ee0507877cae6e75ad9bbab786 /src/H5Dint.c
parente3800e123566d074d839cbdea863ea5ec0ac1bdd (diff)
downloadhdf5-5c399982245bbbf15cefa028d399b94d62932d61.zip
hdf5-5c399982245bbbf15cefa028d399b94d62932d61.tar.gz
hdf5-5c399982245bbbf15cefa028d399b94d62932d61.tar.bz2
Persist dataset access properties when using H5Fstart_swmr_write (#1862)
* Fix HDFFV-11308 - dataset access properties disappear when using H5Fstart_swmr_write. * Committing clang-format changes * Add test for H5Fstart_swmr_write() persisting DAPL settings. Fix bugs in the library exposed by this test. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Dint.c')
-rw-r--r--src/H5Dint.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 0407a2e..6c9e646 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -3706,11 +3706,13 @@ done:
hid_t
H5D_get_access_plist(const H5D_t *dset)
{
- H5P_genplist_t * old_plist; /* Stored DAPL from dset */
- H5P_genplist_t * new_plist; /* New DAPL */
- H5P_genplist_t * def_fapl; /* Default FAPL */
- H5D_append_flush_t def_append_flush_info = {0}; /* Default append flush property */
- H5D_rdcc_t def_chunk_info; /* Default chunk cache property */
+ H5P_genplist_t * old_plist; /* Stored DAPL from dset */
+ H5P_genplist_t * new_plist; /* New DAPL */
+ H5P_genplist_t * def_dapl = NULL; /* Default DAPL */
+ H5D_append_flush_t def_append_flush_info = {0}; /* Default append flush property */
+ H5D_rdcc_t def_chunk_info; /* Default chunk cache property */
+ H5D_vds_view_t def_vds_view; /* Default virtual view property */
+ hsize_t def_vds_gap; /* Default virtual printf gap property */
hid_t new_dapl_id = FAIL;
hid_t ret_value = FAIL;
@@ -3739,23 +3741,23 @@ H5D_get_access_plist(const H5D_t *dset)
}
else {
/* Get the default FAPL */
- if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
+ if (NULL == (def_dapl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list")
/* Set the data cache number of slots to the value of the default FAPL */
- if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
+ if (H5P_get(def_dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data number of slots");
if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache number of slots")
/* Set the data cache byte size to the value of the default FAPL */
- if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
+ if (H5P_get(def_dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data cache byte size");
if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache byte size")
/* Set the preempt read chunks property to the value of the default FAPL */
- if (H5P_get(def_fapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
+ if (H5P_get(def_dapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get preempt read chunks");
if (H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set preempt read chunks")
@@ -3765,12 +3767,32 @@ H5D_get_access_plist(const H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set append flush property")
} /* end if-else */
- /* Set the VDS view & printf gap options */
- if (H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS view")
- if (H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) <
- 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap")
+ /* If the dataset is virtual then copy the VDS view & printf gap options.
+ * Otherwise, use the default values. */
+ if (dset->shared->layout.type == H5D_VIRTUAL) {
+ if (H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS view")
+ if (H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME,
+ &(dset->shared->layout.storage.u.virt.printf_gap)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap")
+ }
+ else {
+ /* Get the default FAPL if necessary */
+ if (!def_dapl && NULL == (def_dapl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Set the data cache number of slots to the value of the default FAPL */
+ if (H5P_get(def_dapl, H5D_ACS_VDS_VIEW_NAME, &def_vds_view) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS view");
+ if (H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &def_vds_view) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VDS view")
+
+ /* Set the data cache byte size to the value of the default FAPL */
+ if (H5P_get(def_dapl, H5D_ACS_VDS_PRINTF_GAP_NAME, &def_vds_gap) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS printf gap");
+ if (H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &def_vds_gap) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VDS printf gap")
+ }
/* Set the vds prefix option */
if (H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0)