diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-09-01 12:20:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-01 12:20:05 (GMT) |
commit | fdeac5309eceeed5159dcbc60de4161f144593ef (patch) | |
tree | ef03b76215d539dbf4fb1249910b66327886d821 /src | |
parent | 26c8d0c32ed7f3db00ff8d997e5606e07666e846 (diff) | |
download | hdf5-fdeac5309eceeed5159dcbc60de4161f144593ef.zip hdf5-fdeac5309eceeed5159dcbc60de4161f144593ef.tar.gz hdf5-fdeac5309eceeed5159dcbc60de4161f144593ef.tar.bz2 |
Fix serial to parallel chunked dataset file space allocation bug (#3394) (#3467)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dint.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c index e6a709e..a547a72 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1664,12 +1664,13 @@ done: static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id) { - H5P_genplist_t *plist; /* Property list */ - H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */ - unsigned alloc_time_state; /* Allocation time state */ - htri_t msg_exists; /* Whether a particular type of message exists */ - hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list */ + H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */ + unsigned alloc_time_state; /* Allocation time state */ + htri_t msg_exists; /* Whether a particular type of message exists */ + hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ + hbool_t must_init_storage = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) @@ -1812,12 +1813,24 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) * Make sure all storage is properly initialized. * This is important only for parallel I/O where the space must * be fully allocated before I/O can happen. + * + * Storage will be initialized here if either the VFD being used + * has set the H5FD_FEAT_ALLOCATE_EARLY flag to indicate that it + * wishes to force early space allocation OR a parallel VFD is + * being used and the dataset in question doesn't have any filters + * applied to it. If filters are applied to the dataset, collective + * I/O will be required when writing to the dataset, so we don't + * need to initialize storage here, as the collective I/O process + * will coordinate that. */ - if ((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) && - !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) && - H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) - if (H5D__alloc_storage(dataset, H5D_ALLOC_OPEN, FALSE, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage"); + must_init_storage = (H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) && + !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage); + must_init_storage = must_init_storage && (H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY) || + (H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI) && + dataset->shared->dcpl_cache.pline.nused == 0)); + + if (must_init_storage && (H5D__alloc_storage(dataset, H5D_ALLOC_OPEN, FALSE, NULL) < 0)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage"); done: if (ret_value < 0) { |