From 668be45b5678fc38c58fbb657c04b557c7baffe7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 14 May 2015 20:57:34 -0500 Subject: [svn-r27075] Description: Clean up H5F interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel --- src/H5F.c | 2 +- src/H5Fdeprec.c | 2 +- src/H5Fint.c | 4 ++-- src/H5Fpkg.h | 8 ++++---- src/H5Fsuper.c | 46 +++++++++++++++++++++++----------------------- src/H5Fsuper_cache.c | 19 +++++++++++++++---- 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 672c631..3cdb604 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1380,7 +1380,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock and any superblock extensions */ - if(H5F_super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) + if(H5F__super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") /* Get the size of any persistent free space */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index c5a500a..7e2ea17 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -181,7 +181,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock extension */ - if(H5F_super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) + if(H5F__super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size") /* Check for SOHM info */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 31f4176..775c91f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1074,7 +1074,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, /* Initialize information about the superblock and allocate space for it */ /* (Writes superblock extension messages, if there are any) */ - if(H5F_super_init(file, dxpl_id) < 0) + if(H5F__super_init(file, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock") /* Create and open the root group */ @@ -1085,7 +1085,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") } else if (1 == shared->nrefs) { /* Read the superblock if it hasn't been read before. */ - if(H5F_super_read(file, dxpl_id) < 0) + if(H5F__super_read(file, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") /* Open the root group */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 53fe0d9..a645fd3 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -306,10 +306,10 @@ H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key); H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); /* Superblock related routines */ -H5_DLL herr_t H5F_super_init(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5F_super_read(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size); -H5_DLL herr_t H5F_super_free(H5F_super_t *sblock); +H5_DLL herr_t H5F__super_init(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5F__super_read(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size); +H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 845ab8c..6db631e 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -237,7 +237,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_read + * Function: H5F__super_read * * Purpose: Reads the superblock from the file or from the BUF. If * ADDR is a valid address, then it reads it from the file. @@ -254,17 +254,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_read(H5F_t *f, hid_t dxpl_id) +H5F__super_read(H5F_t *f, hid_t dxpl_id) { H5P_genplist_t *dxpl; /* DXPL object */ - H5F_super_t * sblock = NULL; /* superblock structure */ + H5F_super_t * sblock = NULL; /* Superblock structure */ unsigned sblock_flags = H5AC__NO_FLAGS_SET; /* flags used in superblock unprotect call */ haddr_t super_addr; /* Absolute address of superblock */ - H5AC_protect_t rw; /* read/write permissions for file */ + H5AC_protect_t rw; /* Read/write permissions for file */ hbool_t dirtied = FALSE; /* Bool for sblock protect call */ - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Get the DXPL plist object for DXPL ID */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) @@ -291,7 +291,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) /* Look up the superblock */ if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &dirtied, rw))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock") /* Mark the superblock dirty if it was modified during loading or VFD indicated to do so */ if((H5AC_WRITE == rw) && (dirtied || H5F_HAS_FEATURE(f, H5FD_FEAT_DIRTY_SBLK_LOAD))) @@ -299,7 +299,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) /* Pin the superblock in the cache */ if(H5AC_pin_protected_entry(sblock) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTPIN, FAIL, "unable to pin superblock") /* Set the pointer to the pinned superblock */ f->shared->sblock = sblock; @@ -307,14 +307,14 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) done: /* Release the superblock */ if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5F_super_read() */ +} /* end H5F__super_read() */ /*------------------------------------------------------------------------- - * Function: H5F_super_init + * Function: H5F__super_init * * Purpose: Allocates the superblock for the file and initializes * information about the superblock in memory. Writes extension @@ -330,7 +330,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_init(H5F_t *f, hid_t dxpl_id) +H5F__super_init(H5F_t *f, hid_t dxpl_id) { H5F_super_t *sblock = NULL; /* Superblock cache structure */ hbool_t sblock_in_cache = FALSE; /* Whether the superblock has been inserted into the metadata cache */ @@ -344,7 +344,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) hbool_t ext_created = FALSE; /* Whether the extension has been created */ herr_t ret_value = SUCCEED; /* Return Value */ - FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, H5AC__SUPERBLOCK_TAG, FAIL) /* Allocate space for the superblock */ if(NULL == (sblock = H5FL_CALLOC(H5F_super_t))) @@ -594,7 +594,7 @@ done: } /* end if */ else /* Free superblock */ - if(H5F_super_free(sblock) < 0) + if(H5F__super_free(sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock") /* Reset variables in file structure */ @@ -603,7 +603,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5F_super_init() */ +} /* end H5F__super_init() */ /*------------------------------------------------------------------------- @@ -641,7 +641,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_free + * Function: H5F__super_free * * Purpose: Destroyer the file's superblock * @@ -654,9 +654,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_free(H5F_super_t *sblock) +H5F__super_free(H5F_super_t *sblock) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(sblock); @@ -668,11 +668,11 @@ H5F_super_free(H5F_super_t *sblock) sblock = (H5F_super_t *)H5FL_FREE(H5F_super_t, sblock); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5F_super_free() */ +} /* H5F__super_free() */ /*------------------------------------------------------------------------- - * Function: H5F_super_size + * Function: H5F__super_size * * Purpose: Get storage size of the superblock and superblock extension * @@ -685,11 +685,11 @@ H5F_super_free(H5F_super_t *sblock) *------------------------------------------------------------------------- */ herr_t -H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size) +H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -725,7 +725,7 @@ H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_super_size() */ +} /* H5F__super_size() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 5737ce4..1e8675c 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -13,6 +13,17 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Fsuper_cache.c + * Aug 15 2009 + * Quincey Koziol + * + * Purpose: Implement file superblock & driver info metadata cache methods. + * + *------------------------------------------------------------------------- + */ + /****************/ /* Module Setup */ /****************/ @@ -133,7 +144,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) FUNC_ENTER_NOAPI_NOINIT - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_eq(addr, 0)); HDassert(dirtied); @@ -618,7 +629,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, void *_udata) done: /* Release the [possibly partially initialized] superblock on errors */ if(!ret_value && sblock) - if(H5F_super_free(sblock) < 0) + if(H5F__super_free(sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTFREE, NULL, "unable to destroy superblock data") FUNC_LEAVE_NOAPI(ret_value) @@ -779,7 +790,7 @@ H5F_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, * ultimately match it. */ if ((rel_eof = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER)) == HADDR_UNDEF) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") - H5F_addr_encode(f, &p, rel_eof + sblock->base_addr); + H5F_addr_encode(f, &p, (rel_eof + sblock->base_addr)); /* Retrieve information for root group */ if(NULL == (root_oloc = H5G_oloc(f->shared->root_grp))) @@ -887,7 +898,7 @@ H5F_sblock_dest(H5F_t UNUSED *f, H5F_super_t* sblock) HDassert(sblock); /* Free superblock */ - if(H5F_super_free(sblock) < 0) + if(H5F__super_free(sblock) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock") done: -- cgit v0.12