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