summaryrefslogtreecommitdiffstats
path: root/src/H5MFsection.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
commite767f44e953047297fece364218147c908e8b585 (patch)
treed4b6909f14b78bb732b6947adc46ac3cd3ca54f6 /src/H5MFsection.c
parent949649a2b6e00297cbdc49437e70a27e455e92d2 (diff)
parenta08ab621febde7b09e4d86eab80cb029c123e9f6 (diff)
downloadhdf5-e767f44e953047297fece364218147c908e8b585.zip
hdf5-e767f44e953047297fece364218147c908e8b585.tar.gz
hdf5-e767f44e953047297fece364218147c908e8b585.tar.bz2
Merge remote-tracking branch 'origin/develop' into monotonic_timer
Diffstat (limited to 'src/H5MFsection.c')
-rw-r--r--src/H5MFsection.c356
1 files changed, 126 insertions, 230 deletions
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index 02e3218..715ece4 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -56,45 +56,40 @@
/********************/
/* 'simple/small/large' section callbacks */
-static H5FS_section_info_t *H5MF_sect_deserialize(const H5FS_section_class_t *cls,
- hid_t dxpl_id, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size,
- unsigned *des_flags);
-static herr_t H5MF_sect_valid(const H5FS_section_class_t *cls,
- const H5FS_section_info_t *sect, hid_t dxpl_id);
-static H5FS_section_info_t *H5MF_sect_split(H5FS_section_info_t *sect,
+static H5FS_section_info_t *H5MF__sect_deserialize(const H5FS_section_class_t *cls,
+ const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags);
+static herr_t H5MF__sect_valid(const H5FS_section_class_t *cls,
+ const H5FS_section_info_t *sect);
+static H5FS_section_info_t *H5MF__sect_split(H5FS_section_info_t *sect,
hsize_t frag_size);
/* 'simple' section callbacks */
-static htri_t H5MF_sect_simple_can_merge(const H5FS_section_info_t *sect1,
+static htri_t H5MF__sect_simple_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF_sect_simple_merge(H5FS_section_info_t **sect1,
+static herr_t H5MF__sect_simple_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect,
+static htri_t H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
-static herr_t H5MF_sect_simple_shrink(H5FS_section_info_t **_sect,
+static herr_t H5MF__sect_simple_shrink(H5FS_section_info_t **_sect,
void *udata);
/* 'small' section callbacks */
-static herr_t H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata);
-static htri_t H5MF_sect_small_can_merge(const H5FS_section_info_t *sect1,
+static herr_t H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata);
+static htri_t H5MF__sect_small_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF_sect_small_merge(H5FS_section_info_t **sect1,
+static herr_t H5MF__sect_small_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect,
- void *udata);
-static herr_t H5MF_sect_small_shrink(H5FS_section_info_t **_sect,
- void *udata);
/* 'large' section callbacks */
-static htri_t H5MF_sect_large_can_merge(const H5FS_section_info_t *sect1,
+static htri_t H5MF__sect_large_can_merge(const H5FS_section_info_t *sect1,
const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF_sect_large_merge(H5FS_section_info_t **sect1,
+static herr_t H5MF__sect_large_merge(H5FS_section_info_t **sect1,
H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect,
+static htri_t H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect,
void *udata);
-static herr_t H5MF_sect_large_shrink(H5FS_section_info_t **_sect,
+static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect,
void *udata);
/*********************/
@@ -116,14 +111,14 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
/* Object methods */
NULL, /* Add section */
NULL, /* Serialize section */
- H5MF_sect_deserialize, /* Deserialize section */
- H5MF_sect_simple_can_merge, /* Can sections merge? */
- H5MF_sect_simple_merge, /* Merge sections */
- H5MF_sect_simple_can_shrink, /* Can section shrink container?*/
- H5MF_sect_simple_shrink, /* Shrink container w/section */
- H5MF_sect_free, /* Free section */
- H5MF_sect_valid, /* Check validity of section */
- H5MF_sect_split, /* Split section node for alignment */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_simple_can_merge, /* Can sections merge? */
+ H5MF__sect_simple_merge, /* Merge sections */
+ H5MF__sect_simple_can_shrink, /* Can section shrink container?*/
+ H5MF__sect_simple_shrink, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
@@ -140,16 +135,16 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
NULL, /* Terminate section class */
/* Object methods */
- H5MF_sect_small_add, /* Add section */
+ H5MF__sect_small_add, /* Add section */
NULL, /* Serialize section */
- H5MF_sect_deserialize, /* Deserialize section */
- H5MF_sect_small_can_merge, /* Can sections merge? */
- H5MF_sect_small_merge, /* Merge sections */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_small_can_merge, /* Can sections merge? */
+ H5MF__sect_small_merge, /* Merge sections */
NULL, /* Can section shrink container?*/
NULL, /* Shrink container w/section */
- H5MF_sect_free, /* Free section */
- H5MF_sect_valid, /* Check validity of section */
- H5MF_sect_split, /* Split section node for alignment */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
@@ -168,14 +163,14 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Object methods */
NULL, /* Add section */
NULL, /* Serialize section */
- H5MF_sect_deserialize, /* Deserialize section */
- H5MF_sect_large_can_merge, /* Can sections merge? */
- H5MF_sect_large_merge, /* Merge sections */
- H5MF_sect_large_can_shrink, /* Can section shrink container?*/
- H5MF_sect_large_shrink, /* Shrink container w/section */
- H5MF_sect_free, /* Free section */
- H5MF_sect_valid, /* Check validity of section */
- H5MF_sect_split, /* Split section node for alignment */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_large_can_merge, /* Can sections merge? */
+ H5MF__sect_large_merge, /* Merge sections */
+ H5MF__sect_large_can_shrink, /* Can section shrink container?*/
+ H5MF__sect_large_shrink, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
@@ -191,13 +186,13 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Declare a free list to manage the H5MF_free_section_t struct */
H5FL_DEFINE(H5MF_free_section_t);
-/*
+/*
* "simple/small/large" section callbacks
*/
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_new
+ * Function: H5MF__sect_new
*
* Purpose: Create a new section of "ctype" and return it to the caller
*
@@ -210,12 +205,12 @@ H5FL_DEFINE(H5MF_free_section_t);
*-------------------------------------------------------------------------
*/
H5MF_free_section_t *
-H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
+H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
{
H5MF_free_section_t *sect; /* 'Simple' free space section to add */
H5MF_free_section_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect_size);
@@ -237,11 +232,11 @@ H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5MF_sect_new() */
+} /* end H5MF__sect_new() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_free
+ * Function: H5MF__sect_free
*
* Purpose: Free a 'simple/small/large' section node
*
@@ -254,11 +249,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5MF_sect_free(H5FS_section_info_t *_sect)
+H5MF__sect_free(H5FS_section_info_t *_sect)
{
H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(sect);
@@ -267,11 +262,11 @@ H5MF_sect_free(H5FS_section_info_t *_sect)
sect = H5FL_FREE(H5MF_free_section_t, sect);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5MF_sect_free() */
+} /* H5MF__sect_free() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_deserialize
+ * Function: H5MF__sect_deserialize
*
* Purpose: Deserialize a buffer into a "live" section
*
@@ -284,14 +279,14 @@ H5MF_sect_free(H5FS_section_info_t *_sect)
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
-H5MF_sect_deserialize(const H5FS_section_class_t *cls,
- hid_t H5_ATTR_UNUSED dxpl_id, const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr,
+H5MF__sect_deserialize(const H5FS_section_class_t *cls,
+ const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr,
hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags)
{
H5MF_free_section_t *sect; /* New section */
H5FS_section_info_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(cls);
@@ -299,7 +294,7 @@ H5MF_sect_deserialize(const H5FS_section_class_t *cls,
HDassert(sect_size);
/* Create free space section for block */
- if(NULL == (sect = H5MF_sect_new(cls->type, sect_addr, sect_size)))
+ if(NULL == (sect = H5MF__sect_new(cls->type, sect_addr, sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set return value */
@@ -307,11 +302,11 @@ H5MF_sect_deserialize(const H5FS_section_class_t *cls,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_deserialize() */
+} /* H5MF__sect_deserialize() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_valid
+ * Function: H5MF__sect_valid
*
* Purpose: Check the validity of a section
*
@@ -324,28 +319,28 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
+H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
const H5FS_section_info_t
#ifdef NDEBUG
H5_ATTR_UNUSED
#endif /* NDEBUG */
- *_sect, hid_t H5_ATTR_UNUSED dxpl_id)
+ *_sect)
{
#ifndef NDEBUG
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
#endif /* NDEBUG */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5MF_sect_valid() */
+} /* H5MF__sect_valid() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_split
+ * Function: H5MF__sect_split
*
* Purpose: Split SECT into 2 sections: fragment for alignment & the aligned section
* SECT's addr and size are updated to point to the aligned section
@@ -358,14 +353,14 @@ H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
-H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
+H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
{
H5MF_free_section_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Allocate space for new section */
- if(NULL == (ret_value = H5MF_sect_new(sect->type, sect->addr, frag_size)))
+ if(NULL == (ret_value = H5MF__sect_new(sect->type, sect->addr, frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set new section's info */
@@ -374,14 +369,14 @@ H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
done:
FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value)
-} /* end H5MF_sect_split() */
+} /* end H5MF__sect_split() */
-/*
+/*
* "simple" section callbacks
*/
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_can_merge
+ * Function: H5MF__sect_simple_can_merge
*
* Purpose: Can two sections of this type merge?
*
@@ -396,14 +391,14 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1,
+H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect1);
@@ -415,11 +410,11 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1,
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_can_merge() */
+} /* H5MF__sect_simple_can_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_merge
+ * Function: H5MF__sect_simple_merge
*
* Purpose: Merge two sections of this type
*
@@ -434,14 +429,14 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1,
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
+H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void H5_ATTR_UNUSED *_udata)
{
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect1);
@@ -454,16 +449,16 @@ H5MF_sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2
(*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
- if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_merge() */
+} /* H5MF__sect_simple_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_can_shrink
+ * Function: H5MF__sect_simple_can_shrink
*
* Purpose: Can this section shrink the container?
*
@@ -476,7 +471,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
+H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
@@ -484,7 +479,7 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
haddr_t end; /* End of section to extend */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -519,7 +514,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect-
htri_t status; /* Status from aggregator adjoin */
/* See if section can absorb the aggregator & vice versa */
- if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0)
+ if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block")
else if(status > 0) {
/* Set the aggregator to operate on */
@@ -538,7 +533,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC,
htri_t status; /* Status from aggregator adjoin */
/* See if section can absorb the aggregator & vice versa */
- if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0)
+ if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block")
else if(status > 0) {
/* Set the aggregator to operate on */
@@ -558,11 +553,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", FUNC
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_can_shrink() */
+} /* H5MF__sect_simple_can_shrink() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_simple_shrink
+ * Function: H5MF__sect_simple_shrink
*
* Purpose: Shrink container with section
*
@@ -575,13 +570,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
+H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -594,7 +589,7 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR);
/* Release section's space at EOA */
- if(H5F_free(udata->f, udata->dxpl_id, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
+ if(H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
} /* end if */
else {
@@ -602,14 +597,14 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
HDassert(udata->aggr);
/* Absorb the section into the aggregator or vice versa */
- if(H5MF_aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0)
+ if(H5MF__aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't absorb section into aggregator or vice versa")
} /* end else */
/* Check for freeing section */
if(udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) {
/* Free section */
- if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
@@ -618,19 +613,19 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_simple_shrink() */
+} /* H5MF__sect_simple_shrink() */
-/*
+/*
* "small" section callbacks
*/
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_add
+ * Function: H5MF__sect_small_add
*
* Purpose: Perform actions on a small "meta" action before adding it to the free space manager:
* 1) Drop the section if it is at page end and its size <= page end threshold
- * 2) Adjust section size to include page end threshold if
+ * 2) Adjust section size to include page end threshold if
* (section size + threshold) is at page end
*
* Return: Success: non-negative
@@ -641,7 +636,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
+H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* Fractal heap free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
@@ -649,7 +644,7 @@ H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
hsize_t rem, prem;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
#ifdef H5MF_ALLOC_DEBUG_MORE
HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size);
@@ -665,7 +660,7 @@ HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.
/* Drop the section if it is at page end and its size is <= pgend threshold */
if(!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) && (*flags & H5FS_ADD_RETURNED_SPACE)) {
- if(H5MF_sect_free((H5FS_section_info_t *)(*sect)) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)(*sect)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect = NULL;
*flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE;
@@ -685,110 +680,11 @@ HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_inf
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_add() */
+} /* H5MF__sect_small_add() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_can_shrink
- *
- * Purpose: Can this section shrink the container?
- *
- * Note: A small section is allowed to shrink only at closing.
- *
- * Return: Success: non-negative (TRUE/FALSE)
- * Failure: negative
- *
- * Programmer: Vailin Choi; Dec 2012
- *
- *-------------------------------------------------------------------------
- */
-static htri_t
-H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
-{
- const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- haddr_t eoa; /* End of address space in the file */
- haddr_t end; /* End of section to extend */
- htri_t ret_value = FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments. */
- HDassert(sect);
- HDassert(udata);
- HDassert(udata->f);
-
- /* Retrieve the end of the file's address space */
- if(HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
-
- /* Compute address of end of section to check */
- end = sect->sect_info.addr + sect->sect_info.size;
-
- /* Check if the section is exactly at the end of the allocated space in the file */
- if(H5F_addr_eq(end, eoa) && sect->sect_info.size == udata->f->shared->fs_page_size) {
- udata->shrink = H5MF_SHRINK_EOA;
-
-#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, sect->sect_info.size, eoa);
-#endif /* H5MF_ALLOC_DEBUG_MORE */
-
- /* Indicate shrinking can occur */
- HGOTO_DONE(TRUE)
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_can_shrink() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_shrink
- *
- * Purpose: Shrink container with section
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Vailin Choi; Dec 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5MF_sect_small_shrink(H5FS_section_info_t **_sect, void *_udata)
-{
- H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check arguments. */
- HDassert(sect);
- HDassert((*sect)->sect_info.type == H5MF_FSPACE_SECT_SMALL);
- HDassert(udata);
- HDassert(udata->f);
- HDassert(udata->shrink == H5MF_SHRINK_EOA);
- HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR);
-
- /* Release section's space at EOA */
- if(H5F_free(udata->f, udata->dxpl_id, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
-
- /* Free section */
- if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
-
- /* Mark section as freed, for free space manager */
- *sect = NULL;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_shrink() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_can_merge
+ * Function: H5MF__sect_small_can_merge
*
* Purpose: Can two sections of this type merge?
*
@@ -803,7 +699,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_small_can_merge(const H5FS_section_info_t *_sect1,
+H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
@@ -811,7 +707,7 @@ H5MF_sect_small_can_merge(const H5FS_section_info_t *_sect1,
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect1);
@@ -831,11 +727,11 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_can_merge() */
+} /* H5MF__sect_small_can_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_small_merge
+ * Function: H5MF__sect_small_merge
*
* Purpose: Merge two sections of this type
*
@@ -851,7 +747,7 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
+H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void *_udata)
{
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
@@ -859,7 +755,7 @@ H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect1);
@@ -872,7 +768,7 @@ H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
(*sect1)->sect_info.size += sect2->sect_info.size;
if((*sect1)->sect_info.size == udata->f->shared->fs_page_size) {
- if(H5MF_xfree(udata->f, udata->alloc_type, udata->dxpl_id, (*sect1)->sect_info.addr, (*sect1)->sect_info.size) < 0)
+ if(H5MF_xfree(udata->f, udata->alloc_type, (*sect1)->sect_info.addr, (*sect1)->sect_info.size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
/* Need to free possible metadata page in the PB cache */
@@ -880,29 +776,29 @@ H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
/* Note: Large metadata page bypasses the PB cache */
/* Note: Update of raw data page (large or small sized) is handled by the PB cache */
if(udata->f->shared->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW)
- if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0)
+ if(H5PB_remove_entry(udata->f->shared, (*sect1)->sect_info.addr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
- if(H5MF_sect_free((H5FS_section_info_t *)(*sect1)) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect1 = NULL;
} /* end if */
/* Get rid of second section */
- if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_small_merge() */
+} /* H5MF__sect_small_merge() */
-/*
+/*
* "Large" section callbacks
*/
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_can_merge (same as H5MF_sect_simple_can_merge)
+ * Function: H5MF__sect_large_can_merge (same as H5MF__sect_simple_can_merge)
*
* Purpose: Can two sections of this type merge?
*
@@ -916,14 +812,14 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_large_can_merge(const H5FS_section_info_t *_sect1,
+H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1,
const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
{
const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Check arguments. */
HDassert(sect1);
@@ -938,11 +834,11 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_can_merge() */
+} /* H5MF__sect_large_can_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_merge (same as H5MF_sect_simple_merge)
+ * Function: H5MF__sect_large_merge (same as H5MF__sect_simple_merge)
*
* Purpose: Merge two sections of this type
*
@@ -956,14 +852,14 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
+H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
void H5_ATTR_UNUSED *_udata)
{
H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect1);
@@ -976,16 +872,16 @@ H5MF_sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
(*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
- if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_merge() */
+} /* H5MF__sect_large_merge() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_can_shrink
+ * Function: H5MF__sect_large_can_shrink
*
* Purpose: Can this section shrink the container?
*
@@ -997,7 +893,7 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
+H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
@@ -1005,7 +901,7 @@ H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
haddr_t end; /* End of section to extend */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -1034,11 +930,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect-
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_can_shrink() */
+} /* H5MF__sect_large_can_shrink() */
/*-------------------------------------------------------------------------
- * Function: H5MF_sect_large_shrink
+ * Function: H5MF__sect_large_shrink
*
* Purpose: Shrink a large-sized section
*
@@ -1050,14 +946,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
+H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
{
H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
hsize_t frag_size = 0; /* Fragment size */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Check arguments. */
HDassert(sect);
@@ -1073,14 +969,14 @@ H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
/* Free full pages from EOA */
/* Retain partial page in the free-space manager so as to keep EOA at page boundary */
- if(H5F_free(udata->f, udata->dxpl_id, udata->alloc_type, (*sect)->sect_info.addr+frag_size, (*sect)->sect_info.size-frag_size) < 0)
+ if(H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr+frag_size, (*sect)->sect_info.size-frag_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
if(frag_size) /* Adjust section size for the partial page */
(*sect)->sect_info.size = frag_size;
else {
/* Free section */
- if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0)
+ if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
@@ -1089,5 +985,5 @@ H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5MF_sect_large_shrink() */
+} /* H5MF__sect_large_shrink() */