From 88c8c78763dcfc0e42906a1b07b117896f6f3dac Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 25 Jun 2016 22:41:48 -0500 Subject: [svn-r30108] Moved group flush and evict code to H5G_close from H5Gclose. --- src/H5Dint.c | 2 +- src/H5G.c | 30 +----------------------------- src/H5Gint.c | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index b089c10..bbe16cf 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1915,7 +1915,7 @@ H5D_close(H5D_t *dataset) /* Evict dataset metadata if evicting on close */ if(H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { -// printf("tag: 0x%3llx\n", dataset->oloc.addr); +// printf("EVICTING DATASET (TAG: 0x%3llx)\n", dataset->oloc.addr); // printf("DUMPING CACHE - BEFORE FLUSH\n"); // H5AC_dump_cache(dataset->oloc.file); if(H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_ind_read_dxpl_id) < 0) diff --git a/src/H5G.c b/src/H5G.c index e4313fe..1955c33 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -715,29 +715,15 @@ done: herr_t H5Gclose(hid_t group_id) { - H5G_t *grp = NULL; /* Group */ - H5F_t *file = NULL; /* File */ - hbool_t evict = FALSE; /* Evict metadata on close? */ - haddr_t tag = HADDR_UNDEF; /* Metadata tag for evictions */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", group_id); /* Check args */ - if(NULL == (grp = (H5G_t *)H5I_object_verify(group_id,H5I_GROUP))) + if(NULL == H5I_object_verify(group_id,H5I_GROUP)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") - /* Check if this is the last object reference and we'll be evicting - * on close. We need to cache this info since it will be gone after the - * decrement call frees the struct. - */ - file = grp->oloc.file; - if(1 == grp->shared->fo_count && H5F_EVICT_ON_CLOSE(file)) { - evict = TRUE; - tag = grp->oloc.addr; - } /* end if */ - /* * Decrement the counter on the group atom. It will be freed if the count * reaches zero. @@ -745,20 +731,6 @@ H5Gclose(hid_t group_id) if(H5I_dec_app_ref(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") - /* Clean up metadata in the metadata cache if evicting on close */ - if(evict && H5F_SHARED(file)) { -// printf("DUMPING CACHE - BEFORE FLUSH\n"); -// H5AC_dump_cache(file); - if(H5AC_flush_tagged_metadata(file, tag, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") -// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); -// H5AC_dump_cache(file); - if(H5AC_evict_tagged_metadata(file, tag, FALSE, H5AC_ind_read_dxpl_id) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") -// printf("DUMPING CACHE - AFTER EVICT\n"); -// H5AC_dump_cache(file); - } /* end if */ - done: FUNC_LEAVE_API(ret_value) } /* end H5Gclose() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index f5bccc3..ff92ecc 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -486,7 +486,7 @@ H5G_close(H5G_t *grp) if(0 == grp->shared->fo_count) { HDassert(grp != H5G_rootof(H5G_fileof(grp))); - /* Uncork cache entries with object address tag */ + /* Uncork cache entries with object address tag */ if(H5AC_cork(grp->oloc.file, grp->oloc.addr, H5AC__GET_CORKED, &corked) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") if(corked) @@ -500,6 +500,23 @@ H5G_close(H5G_t *grp) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects") if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + + /* Evict group metadata if evicting on close */ + if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { +// printf("EVICTING GROUP (TAG: 0x%3llx)\n", grp->oloc.addr); +// printf("DUMPING CACHE - BEFORE FLUSH\n"); +// H5AC_dump_cache(grp->oloc.file); + if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") +// printf("DUMPING CACHE - BETWEEN FLUSH AND EVICT\n"); +// H5AC_dump_cache(grp->oloc.file); + if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") +// printf("DUMPING CACHE - AFTER EVICT\n"); +// H5AC_dump_cache(grp->oloc.file); + } /* end if */ + + /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } else { /* Decrement the ref. count for this object in the top file */ -- cgit v0.12