From fe3c4567f58a8558db098511ddafbc91e26015f1 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 30 Aug 2019 23:06:04 -0500 Subject: Move coll_md_read and coll_md_write fields in H5F_t to H5F_shared_t. --- src/H5Cmpio.c | 4 ++-- src/H5Fint.c | 12 ++++++------ src/H5Fpkg.h | 10 ++++++---- src/H5Fprivate.h | 2 +- src/H5Fquery.c | 2 +- 5 files changed, 16 insertions(+), 14 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..a28d6c9 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) @@ -1653,7 +1653,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 */ @@ -3174,7 +3174,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) /* Sanity check */ HDassert(f); - f->coll_md_read = cmr; + f->shared->coll_md_read = cmr; FUNC_LEAVE_NOAPI_VOID } /* H5F_set_coll_md_read() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e89111..1436c13 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -358,6 +358,12 @@ 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 */ + +#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 */ + }; /* @@ -376,10 +382,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..1441931 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -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..70a8c9f 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -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 */ -- cgit v0.12 From eef0cf26941072f449a8e332babcf21ee9eea128 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Sat, 31 Aug 2019 01:24:38 -0500 Subject: Move ext_path field in H5F_t to H5F_shared_t. Remove unused routine H5F_set_coll_md_read(). --- src/H5Fint.c | 36 +++++++----------------------------- src/H5Fpkg.h | 3 ++- src/H5Fprivate.h | 2 +- src/H5Fquery.c | 4 ++-- 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index a28d6c9..5e2cf26 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -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; @@ -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->shared->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 1436c13..6cd2d3c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -359,6 +359,8 @@ struct H5F_shared_t { 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 */ @@ -374,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 */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1441931..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) diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 70a8c9f..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() */ -- cgit v0.12 From 62750441cdfbf17f7fa5db3bbf1320c1dc5be838 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 2 Sep 2019 12:59:48 -0500 Subject: Add comment to add tests later to verify conflicting values for MPI-specific properties on multiple opens. --- testpar/t_file.c | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- cgit v0.12