summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c5
-rw-r--r--src/H5FScache.c7
-rw-r--r--src/H5FSdbg.c2
-rw-r--r--src/H5Fpkg.h7
-rw-r--r--src/H5Fsuper.c58
-rw-r--r--src/H5MF.c96
6 files changed, 102 insertions, 73 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 2b082ff..bdc5b5f 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2970,9 +2970,8 @@ H5Fget_info(hid_t obj_id, H5F_info_t *finfo)
HDmemset(finfo, 0, sizeof(H5F_info_t));
/* Check for superblock extension info */
- if(H5F_addr_defined(f->shared->extension_addr))
- if(H5F_super_ext_size(f, H5AC_ind_dxpl_id, &finfo->super_ext_size) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size")
+ 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 sizes")
/* Check for SOHM info */
if(H5F_addr_defined(f->shared->sohm_addr))
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 5d901e9..a7978f5 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -283,13 +283,6 @@ done:
* koziol@ncsa.uiuc.edu
* May 2 2006
*
- * Changes: JRM -- 8/21/06
- * Added the flags_ptr parameter. This parameter exists to
- * allow the flush routine to report to the cache if the
- * entry is resized or renamed as a result of the flush.
- * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry.
- *
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c
index 1e36c77..df48240 100644
--- a/src/H5FSdbg.c
+++ b/src/H5FSdbg.c
@@ -287,7 +287,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int
case H5FS_CLIENT_FILE_ID:
#ifdef NOT_YET
- if(H5MF_sects_debug(f, dxpl_id, client_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
+ if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections")
#endif /* NOT_YET */
break;
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 5b22266..b39ad11 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -43,6 +43,7 @@
#include "H5Oprivate.h" /* Object header messages */
#include "H5RCprivate.h" /* Reference counted object functions */
+
/*
* Feature: Define this constant on the compiler command-line if you want to
* see some debugging messages on the debug stream.
@@ -67,6 +68,10 @@
#define H5F_FS_MERGE_METADATA 0x01 /* Section can merge with metadata aggregator */
#define H5F_FS_MERGE_RAWDATA 0x02 /* Section can merge with small 'raw' data aggregator */
+/* Macro to abstract checking whether file is using a free space manager */
+#define H5F_HAVE_FREE_SPACE_MANAGER(F) TRUE /* Currently always have a free space manager */
+
+
/* Structure for metadata & "small [raw] data" block aggregation fields */
struct H5F_blk_aggr_t {
unsigned long feature_flag; /* Feature flag type */
@@ -229,7 +234,7 @@ H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nop
H5_DLL herr_t H5F_super_init(H5F_t *f, hid_t dxpl_id);
H5_DLL herr_t H5F_super_write(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_ext_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_ext_info);
+H5_DLL herr_t H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size);
/* Metadata accumulator routines */
H5_DLL htri_t H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type,
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 72d1965..f5973e9 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -1134,8 +1134,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_super_ext_size
- * Get storage size of the superblock extension
+ * Function: H5F_super_size
+ *
+ * Purpose: Get storage size of the superblock and superblock extension
*
* Return: Success: non-negative on success
* Failure: Negative
@@ -1145,33 +1146,58 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_super_ext_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_ext_size)
+H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size)
{
- H5O_loc_t ext_loc; /* "Object location" for superblock extension */
- H5O_info_t oinfo; /* Object info for superblock extension */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5F_super_ext_size, FAIL)
+ FUNC_ENTER_NOAPI(H5F_super_size, FAIL)
/* Sanity check */
HDassert(f);
- HDassert(super_ext_size);
- /* Set up "fake" object location for superblock extension */
- H5O_loc_reset(&ext_loc);
- ext_loc.file = f;
- ext_loc.addr = f->shared->extension_addr;
+ /* Set the superblock size */
+ if(super_size) {
+ H5P_genplist_t *plist; /* File creation property list */
+ unsigned super_vers; /* Superblock version */
+
+ /* Get the shared file creation property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Grab values from property list */
+ if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get superblock version")
- /* Get object header info for superblock extension */
- if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+ /* Set the superblock size */
+ *super_size = H5F_SUPERBLOCK_SIZE(super_vers, f);
+ } /* end if */
/* Set the superblock extension size */
- *super_ext_size = oinfo.hdr.space.total;
+ if(super_ext_size) {
+ if(H5F_addr_defined(f->shared->extension_addr)) {
+ H5O_loc_t ext_loc; /* "Object location" for superblock extension */
+ H5O_info_t oinfo; /* Object info for superblock extension */
+
+ /* Set up "fake" object location for superblock extension */
+ H5O_loc_reset(&ext_loc);
+ ext_loc.file = f;
+ ext_loc.addr = f->shared->extension_addr;
+
+ /* Get object header info for superblock extension */
+ if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+
+ /* Set the superblock extension size */
+ *super_ext_size = oinfo.hdr.space.total;
+ } /* end if */
+ else
+ /* Set the superblock extension size to zero */
+ *super_ext_size = (hsize_t)0;
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_super_ext_size() */
+} /* H5F_super_size() */
/*-------------------------------------------------------------------------
diff --git a/src/H5MF.c b/src/H5MF.c
index 97c97f6..dfd1547 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -417,68 +417,71 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ
/* Get free space type from allocation type */
fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type);
- /* Check if the free space manager for the file has been initialized */
- if(!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type]))
- if(H5MF_alloc_open(f, dxpl_id, fs_type) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, HADDR_UNDEF, "can't initialize file free space")
-
- /* Search for large enough space in the free space manager */
- if(f->shared->fs_man[fs_type]) {
- H5MF_free_section_t *node; /* Free space section pointer */
- htri_t node_found = FALSE; /* Whether an existing free list node was found */
-
- /* Try to get a section from the free space manager */
- if((node_found = H5FS_sect_find(f, dxpl_id, f->shared->fs_man[fs_type], size, (H5FS_section_info_t **)&node)) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "error locating free space in file")
+ /* Check if we are using the free space manager for this file */
+ if(H5F_HAVE_FREE_SPACE_MANAGER(f)) {
+ /* Check if the free space manager for the file has been initialized */
+ if(!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type]))
+ if(H5MF_alloc_open(f, dxpl_id, fs_type) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, HADDR_UNDEF, "can't initialize file free space")
+
+ /* Search for large enough space in the free space manager */
+ if(f->shared->fs_man[fs_type]) {
+ H5MF_free_section_t *node; /* Free space section pointer */
+ htri_t node_found = FALSE; /* Whether an existing free list node was found */
+
+ /* Try to get a section from the free space manager */
+ if((node_found = H5FS_sect_find(f, dxpl_id, f->shared->fs_man[fs_type], size, (H5FS_section_info_t **)&node)) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "error locating free space in file")
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 1.5, node_found = %t\n", FUNC, node_found);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- /* Check for actually finding section */
- if(node_found) {
- /* Sanity check */
- HDassert(node);
+ /* Check for actually finding section */
+ if(node_found) {
+ /* Sanity check */
+ HDassert(node);
- /* Retrieve return value */
- ret_value = node->sect_info.addr;
+ /* Retrieve return value */
+ ret_value = node->sect_info.addr;
- /* Check for eliminating the section */
- if(node->sect_info.size == size) {
+ /* Check for eliminating the section */
+ if(node->sect_info.size == size) {
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 1.6, freeing node\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- /* Free section node */
- if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free simple section node")
- } /* end if */
- else {
- H5MF_sect_ud_t udata; /* User data for callback */
+ /* Free section node */
+ if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free simple section node")
+ } /* end if */
+ else {
+ H5MF_sect_ud_t udata; /* User data for callback */
- /* Adjust information for section */
- node->sect_info.addr += size;
- node->sect_info.size -= size;
+ /* Adjust information for section */
+ node->sect_info.addr += size;
+ node->sect_info.size -= size;
- /* Construct user data for callbacks */
- udata.f = f;
- udata.dxpl_id = dxpl_id;
- udata.alloc_type = alloc_type;
- udata.allow_sect_absorb = TRUE;
+ /* Construct user data for callbacks */
+ udata.f = f;
+ udata.dxpl_id = dxpl_id;
+ udata.alloc_type = alloc_type;
+ udata.allow_sect_absorb = TRUE;
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 1.7, re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- /* Re-insert section node into file's free space */
- if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't re-add section to file free space")
- } /* end else */
+ /* Re-insert section node into file's free space */
+ if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't re-add section to file free space")
+ } /* end else */
- /* Leave now */
- HGOTO_DONE(ret_value)
+ /* Leave now */
+ HGOTO_DONE(ret_value)
+ } /* end if */
} /* end if */
- } /* end if */
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Check 2.0\n", FUNC);
#endif /* H5MF_ALLOC_DEBUG_MORE */
+ } /* end if */
/* Allocate from the metadata aggregator (or the VFD) */
if(HADDR_UNDEF == (ret_value = H5MF_aggr_vfd_alloc(f, alloc_type, dxpl_id, size)))
@@ -629,17 +632,20 @@ HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC);
/* If we are deleting the free space manager, leave now, to avoid
* [re-]starting it.
+ * or if file space strategy type is not using a free space manager
+ * (H5F_FILE_SPACE_AGGR_VFD or H5F_FILE_SPACE_VFD), drop free space
+ * section on the floor.
*
* Note: this drops the space to free on the floor...
*
*/
- if(f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING)
-{
+ if(f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING ||
+ !H5F_HAVE_FREE_SPACE_MANAGER(f)) {
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
HGOTO_DONE(SUCCEED)
-}
+ } /* end if */
/* There's either already a free space manager, or the freed
* space isn't at the end of the file, so start up (or create)