diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2019-09-03 02:27:19 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2019-09-03 02:27:19 (GMT) |
commit | ec90f311060e4d939470996f5593b0e88780fc28 (patch) | |
tree | bb75e97ce7a1688d5f2b1e513e7bfbad619e7727 | |
parent | 373df11c469e6c4b131b3859bf3856ac94892e8a (diff) | |
parent | 62750441cdfbf17f7fa5db3bbf1320c1dc5be838 (diff) | |
download | hdf5-ec90f311060e4d939470996f5593b0e88780fc28.zip hdf5-ec90f311060e4d939470996f5593b0e88780fc28.tar.gz hdf5-ec90f311060e4d939470996f5593b0e88780fc28.tar.bz2 |
Merge pull request #1914 in HDFFV/hdf5 from ~VCHOI/my_third_fork:bugfix/shared_file_pointer to develop
* commit '62750441cdfbf17f7fa5db3bbf1320c1dc5be838':
Add comment to add tests later to verify conflicting values for MPI-specific properties on multiple opens.
Move ext_path field in H5F_t to H5F_shared_t. Remove unused routine H5F_set_coll_md_read().
Move coll_md_read and coll_md_write fields in H5F_t to H5F_shared_t.
-rw-r--r-- | src/H5Cmpio.c | 4 | ||||
-rw-r--r-- | src/H5Fint.c | 46 | ||||
-rw-r--r-- | src/H5Fpkg.h | 13 | ||||
-rw-r--r-- | src/H5Fprivate.h | 4 | ||||
-rw-r--r-- | src/H5Fquery.c | 6 | ||||
-rw-r--r-- | testpar/t_file.c | 5 |
6 files changed, 32 insertions, 46 deletions
diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 84ec16c..e784487 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -222,7 +222,7 @@ H5C_apply_candidate_list(H5F_t * f, HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - if(f->coll_md_write) { + if(f->shared->coll_md_write) { /* Sanity check */ HDassert(NULL == cache_ptr->coll_write_list); @@ -386,7 +386,7 @@ H5C_apply_candidate_list(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates failed") /* If we've deferred writing to do it collectively, take care of that now */ - if(f->coll_md_write) { + if(f->shared->coll_md_write) { /* Sanity check */ HDassert(cache_ptr->coll_write_list); diff --git a/src/H5Fint.c b/src/H5Fint.c index c56bd10..5e2cf26 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -246,9 +246,9 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") } /* end if */ #ifdef H5_HAVE_PARALLEL - if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") - if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) @@ -1020,9 +1020,9 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F if(NULL == (f->shared->efc = H5F__efc_create(efc_size))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache") #ifdef H5_HAVE_PARALLEL - if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag") - if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) @@ -1387,6 +1387,9 @@ H5F__dest(H5F_t *f, hbool_t flush) f->shared->mtab.child = (H5F_mount_t *)H5MM_xfree(f->shared->mtab.child); f->shared->mtab.nalloc = 0; + /* Free the external link file */ + f->shared->extpath = (char *)H5MM_xfree(f->shared->extpath); + /* Clean up the metadata retries array */ for(actype = 0; actype < (int)H5AC_NTYPES; actype++) if(f->shared->retries[actype]) @@ -1407,7 +1410,6 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Free the non-shared part of the file */ f->open_name = (char *)H5MM_xfree(f->open_name); f->actual_name = (char *)H5MM_xfree(f->actual_name); - f->extpath = (char *)H5MM_xfree(f->extpath); if(H5FO_top_dest(f) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") f->shared = NULL; @@ -1653,7 +1655,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(page_buf_size) { #ifdef H5_HAVE_PARALLEL /* Collective metadata writes are not supported with page buffering */ - if(file->coll_md_write) + if(file->shared->coll_md_write) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "collective metadata writes are not supported with page buffering") /* Temporary: fail file create when page buffering feature is enabled for parallel */ @@ -1753,8 +1755,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ /* Formulate the absolute path for later search of target file for external links */ - if(H5_build_extpath(name, &file->extpath) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") + if(shared->nrefs == 1) { + if(H5_build_extpath(name, &file->shared->extpath) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") + } /* Formulate the actual file name, after following symlinks, etc. */ if(H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0) @@ -2227,7 +2231,6 @@ H5F__reopen(H5F_t *f) /* Duplicate old file's names */ ret_value->open_name = H5MM_xstrdup(f->open_name); ret_value->actual_name = H5MM_xstrdup(f->actual_name); - ret_value->extpath = H5MM_xstrdup(f->extpath); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3155,31 +3158,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_max_eof_eoa() */ -#ifdef H5_HAVE_PARALLEL - -/*------------------------------------------------------------------------- - * Function: H5F_set_coll_md_read - * - * Purpose: Set the coll_md_read field with a new value. - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -void -H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity check */ - HDassert(f); - - f->coll_md_read = cmr; - - FUNC_LEAVE_NOAPI_VOID -} /* H5F_set_coll_md_read() */ -#endif /* H5_HAVE_PARALLEL */ - /*------------------------------------------------------------------------- * Function: H5F_get_metadata_read_retry_info diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e89111..6cd2d3c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -358,6 +358,14 @@ struct H5F_shared_t { /* Object flush info */ H5F_object_flush_t object_flush; /* Information for object flush callback */ hbool_t crt_dset_min_ohdr_flag; /* flag to minimize created dataset object header */ + + char *extpath; /* Path for searching target external link file */ + +#ifdef H5_HAVE_PARALLEL + H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ + hbool_t coll_md_write; /* Do all metadata writes collectively */ +#endif /* H5_HAVE_PARALLEL */ + }; /* @@ -368,7 +376,6 @@ struct H5F_shared_t { struct H5F_t { char *open_name; /* Name used to open file */ char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ - char *extpath; /* Path for searching target external link file */ H5F_shared_t *shared; /* The shared file info */ unsigned nopen_objs; /* Number of open object headers */ H5FO_t *obj_count; /* # of time each object is opened through top file structure */ @@ -376,10 +383,6 @@ struct H5F_t { hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ -#ifdef H5_HAVE_PARALLEL - H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ - hbool_t coll_md_write; /* Do all metadata writes collectively */ -#endif /* H5_HAVE_PARALLEL */ }; /*****************************/ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0a7daa0..8c70663 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -282,7 +282,7 @@ typedef struct H5F_t H5F_t; #define H5F_INTENT(F) ((F)->shared->flags) #define H5F_OPEN_NAME(F) ((F)->open_name) #define H5F_ACTUAL_NAME(F) ((F)->actual_name) -#define H5F_EXTPATH(F) ((F)->extpath) +#define H5F_EXTPATH(F) ((F)->shared->extpath) #define H5F_SHARED(F) ((F)->shared) #define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared) #define H5F_NOPEN_OBJS(F) ((F)->nopen_objs) @@ -323,7 +323,7 @@ typedef struct H5F_t H5F_t; #define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR))) #ifdef H5_HAVE_PARALLEL -#define H5F_COLL_MD_READ(F) ((F)->coll_md_read) +#define H5F_COLL_MD_READ(F) ((F)->shared->coll_md_read) #endif /* H5_HAVE_PARALLEL */ #define H5F_USE_MDC_LOGGING(F) ((F)->shared->use_mdc_logging) #define H5F_START_MDC_LOG_ON_ACCESS(F) ((F)->shared->start_mdc_log_on_access) diff --git a/src/H5Fquery.c b/src/H5Fquery.c index c885561..f36f348 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -229,9 +229,9 @@ H5F_get_extpath(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(f); - HDassert(f->extpath); + HDassert(f->shared->extpath); - FUNC_LEAVE_NOAPI(f->extpath) + FUNC_LEAVE_NOAPI(f->shared->extpath) } /* end H5F_get_extpath() */ @@ -1095,7 +1095,7 @@ H5F_coll_md_read(const H5F_t *f) HDassert(f); - FUNC_LEAVE_NOAPI(f->coll_md_read) + FUNC_LEAVE_NOAPI(f->shared->coll_md_read) } /* end H5F_coll_md_read() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/testpar/t_file.c b/testpar/t_file.c index f1aff19..204095b 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -736,6 +736,11 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, return nerrors; } +/* + * NOTE: See HDFFV-10894 and add tests later to verify MPI-specific properties in the + * incoming fapl that could conflict with the existing values in H5F_shared_t on + * multiple opens of the same file. + */ void test_file_properties(void) { |