diff options
author | vchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com> | 2021-10-28 03:45:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 03:45:11 (GMT) |
commit | b92c7e58a97bc81a8983da3312dbfe72f6a75745 (patch) | |
tree | 40ce8f08c2ec57a772ce57b3b91da56be21d5334 /src/H5Oflush.c | |
parent | bb54464d2dcee95032332c44aa4d1ee2438e4be4 (diff) | |
parent | 33630ee54581f7f54e4ecd8e53ec3e94ba13c493 (diff) | |
download | hdf5-b92c7e58a97bc81a8983da3312dbfe72f6a75745.zip hdf5-b92c7e58a97bc81a8983da3312dbfe72f6a75745.tar.gz hdf5-b92c7e58a97bc81a8983da3312dbfe72f6a75745.tar.bz2 |
Merge pull request #43 from vchoi-hdfgroup/feature/vfd_swmr
Feature/vfd swmr
Diffstat (limited to 'src/H5Oflush.c')
-rw-r--r-- | src/H5Oflush.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 2e3c1fd..f2eacd6 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -49,7 +49,7 @@ /* Local Prototypes */ /********************/ static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag); -static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc); +static herr_t H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid); /*************/ /* Functions */ @@ -194,7 +194,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) +H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid) { hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */ herr_t ret_value = SUCCEED; /* Return value */ @@ -202,7 +202,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) FUNC_ENTER_NOAPI(FAIL) /* If the file is opened with write access, no need to perform refresh actions. */ - if (!(H5F_INTENT(oloc.file) & H5F_ACC_RDWR)) { + if (!(H5F_INTENT(oloc->file) & H5F_ACC_RDWR)) { H5G_loc_t obj_loc; H5O_loc_t obj_oloc; H5G_name_t obj_path; @@ -219,7 +219,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) /* "Fake" another open object in the file, so that it doesn't get closed * if this object is the only thing holding the file open. */ - H5F_incr_nopen_objs(oloc.file); + H5F_incr_nopen_objs(oloc->file); objs_incr = TRUE; /* Get the VOL object from the ID and cache a pointer to the connector. @@ -252,7 +252,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) connector->nrefs++; /* Close object & evict its metadata */ - if ((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) + if (H5O__refresh_metadata_close(oloc, &obj_loc, oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ @@ -280,7 +280,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) done: if (objs_incr) - H5F_decr_nopen_objs(oloc.file); + H5F_decr_nopen_objs(oloc->file); FUNC_LEAVE_NOAPI(ret_value); } /* end H5O_refresh_metadata() */ @@ -305,8 +305,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) +H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid) { + H5F_t * file; /* Local copy of the object's file pointer */ haddr_t tag = 0; /* Tag for object */ hbool_t corked = FALSE; /* Whether object's metadata is corked */ herr_t ret_value = SUCCEED; /* Return value */ @@ -327,28 +328,32 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") /* Retrieve tag for object */ - if (H5O__oh_tag(&oloc, &tag) < 0) + if (H5O__oh_tag(oloc, &tag) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to get object header address") /* Get cork status of the object with tag */ - if (H5AC_cork(oloc.file, tag, H5AC__GET_CORKED, &corked) < 0) + if (H5AC_cork(oloc->file, tag, H5AC__GET_CORKED, &corked) < 0) HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") + /* Hold a copy of the object's file pointer, since closing the object will + * invalidate the file pointer in the oloc. + */ + file = oloc->file; /* Close the object */ if (H5I_dec_ref(oid) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to close object") /* Flush metadata based on tag value of the object */ - if (H5F_flush_tagged_metadata(oloc.file, tag) < 0) + if (H5F_flush_tagged_metadata(file, tag) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Evict the object's tagged metadata */ - if (H5F_evict_tagged_metadata(oloc.file, tag) < 0) + if (H5F_evict_tagged_metadata(file, tag) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to evict metadata") /* Re-cork object with tag */ if (corked) - if (H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) + if (H5AC_cork(file, tag, H5AC__SET_CORK, &corked) < 0) HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object") done: |