summaryrefslogtreecommitdiffstats
path: root/src/H5B.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5B.c')
-rw-r--r--src/H5B.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/src/H5B.c b/src/H5B.c
index c2437c1..ccc1f425 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -100,19 +100,22 @@
#define H5B_PACKAGE /*suppress error about including H5Bpkg */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5B_mask
+
/* private headers */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Bpkg.h" /* B-link trees */
+#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
#include "H5MMprivate.h" /* Memory management */
-
-/* Pablo information */
-#define PABLO_MASK H5B_mask
+#include "H5Pprivate.h" /* Property lists */
/* Local macros */
@@ -128,7 +131,6 @@
/* PRIVATE PROTOTYPES */
static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr,
const H5B_class_t *type,
- const double split_ratios[],
uint8_t *lt_key,
hbool_t *lt_key_changed,
uint8_t *md_key, void *udata,
@@ -144,8 +146,7 @@ static size_t H5B_nodesize(H5F_t *f, const H5B_class_t *type,
size_t *total_nkey_size, size_t sizeof_rkey);
static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt,
haddr_t old_addr, int idx,
- const double split_ratios[], void *udata,
- haddr_t *new_addr/*out*/);
+ void *udata, haddr_t *new_addr/*out*/);
static H5B_t * H5B_copy(H5F_t *f, const H5B_t *old_bt);
#ifdef H5B_DEBUG
static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type,
@@ -177,10 +178,10 @@ H5FL_BLK_DEFINE_STATIC(page);
/* Declare a PQ free list to manage the native block information */
H5FL_BLK_DEFINE_STATIC(native_block);
-/* Declare a free list to manage the H5B_key_t array information */
+/* Declare a free list to manage the H5B_key_t sequence information */
H5FL_SEQ_DEFINE_STATIC(H5B_key_t);
-/* Declare a free list to manage the haddr_t array information */
+/* Declare a free list to manage the haddr_t sequence information */
H5FL_SEQ_DEFINE_STATIC(haddr_t);
/* Declare a free list to manage the H5B_t struct */
@@ -414,11 +415,11 @@ done:
* Jun 23 1997
*
* Modifications:
- * rky 980828
- * Only p0 writes metadata to disk.
+ * rky 980828
+ * Only p0 writes metadata to disk.
*
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
*
* Quincey Koziol, 2002-7-180
* Added dxpl parameter to allow more control over I/O from metadata
@@ -696,12 +697,13 @@ done:
*/
static herr_t
H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr,
- int idx, const double split_ratios[], void *udata,
- haddr_t *new_addr_p/*out*/)
+ int idx, void *udata, haddr_t *new_addr_p/*out*/)
{
+ H5P_genplist_t *dx_plist; /* Data transfer property list */
H5B_t *new_bt = NULL, *tmp_bt = NULL;
herr_t ret_value = SUCCEED;
int i, k, nleft, nright;
+ double split_ratios[3]; /* B-tree split ratios */
size_t recsize = 0;
FUNC_ENTER_NOAPI_NOINIT(H5B_split);
@@ -720,6 +722,15 @@ H5B_split(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_t *old_bt, haddr
recsize = old_bt->sizeof_rkey + H5F_SIZEOF_ADDR(f);
k = H5F_KVALUE(f, type);
+
+ /* Get the dataset transfer property list */
+ if (NULL == (dx_plist = H5I_object(dxpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
+
+ /* Get B-tree split ratios */
+ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios")
+
#ifdef H5B_DEBUG
if (H5DEBUG(B)) {
const char *side;
@@ -925,7 +936,7 @@ done:
*/
herr_t
H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
- const double split_ratios[], void *udata)
+ void *udata)
{
/*
* These are defined this way to satisfy alignment constraints.
@@ -953,7 +964,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
assert(type->sizeof_nkey <= sizeof _lt_key);
assert(H5F_addr_defined(addr));
- if ((my_ins = H5B_insert_helper(f, dxpl_id, addr, type, split_ratios, lt_key,
+ if ((my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key,
&lt_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0 ||
my_ins<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key");
@@ -1199,8 +1210,8 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt,
*/
static H5B_ins_t
H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type,
- const double split_ratios[], uint8_t *lt_key,
- hbool_t *lt_key_changed, uint8_t *md_key, void *udata,
+ uint8_t *lt_key, hbool_t *lt_key_changed,
+ uint8_t *md_key, void *udata,
uint8_t *rt_key, hbool_t *rt_key_changed,
haddr_t *new_node_p/*out*/)
{
@@ -1288,7 +1299,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
idx = 0;
if (H5B_decode_keys(f, bt, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key");
- if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, split_ratios,
+ if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
bt->key[idx].nkey, lt_key_changed, md_key,
udata, bt->key[idx+1].nkey, rt_key_changed,
&child_addr/*out*/))<0)
@@ -1330,7 +1341,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
idx = bt->nchildren - 1;
if (H5B_decode_keys(f, bt, idx) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, H5B_INS_ERROR, "unable to decode key");
- if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, split_ratios,
+ if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
bt->key[idx].nkey, lt_key_changed, md_key, udata,
bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree");
@@ -1376,7 +1387,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* Follow a branch out of this node to another subtree.
*/
assert(idx >= 0 && idx < bt->nchildren);
- if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, split_ratios,
+ if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type,
bt->key[idx].nkey, lt_key_changed, md_key, udata,
bt->key[idx+1].nkey, rt_key_changed, &child_addr/*out*/)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree");
@@ -1427,8 +1438,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
* If this node is full then split it before inserting the new child.
*/
if (bt->nchildren == 2 * H5F_KVALUE(f, type)) {
- if (H5B_split(f, dxpl_id, type, bt, addr, idx, split_ratios, udata,
- new_node_p/*out*/)<0)
+ if (H5B_split(f, dxpl_id, type, bt, addr, idx, udata, new_node_p/*out*/)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node");
if (NULL == (twin = H5AC_protect(f, dxpl_id, H5AC_BT, *new_node_p, type, udata)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node");