summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-05-03 18:53:50 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-05-03 18:53:50 (GMT)
commit08b55972053dec4b9c7cd5a2480355869b7c0663 (patch)
tree441b660b613b35d098611eb5493b55f2429d710f /src
parent1d381a91e759443cbde4620c254d658eff1e8f6f (diff)
downloadhdf5-08b55972053dec4b9c7cd5a2480355869b7c0663.zip
hdf5-08b55972053dec4b9c7cd5a2480355869b7c0663.tar.gz
hdf5-08b55972053dec4b9c7cd5a2480355869b7c0663.tar.bz2
[svn-r8472] Purpose:
Code optimization Description: Eliminate the B-tree "split_ratios" as a parameter and pull it from the DXPL instead. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.9 (sleipnir) w/parallel too minor to require h5committest
Diffstat (limited to 'src')
-rw-r--r--src/H5B.c37
-rw-r--r--src/H5Bprivate.h2
-rw-r--r--src/H5Distore.c12
-rw-r--r--src/H5Dprivate.h3
-rw-r--r--src/H5Fistore.c12
-rw-r--r--src/H5Gstab.c3
6 files changed, 33 insertions, 36 deletions
diff --git a/src/H5B.c b/src/H5B.c
index ce3ca71..bb5388e 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -108,12 +108,14 @@
#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 */
+#include "H5Pprivate.h" /* Property lists */
/* Local macros */
#define H5B_SIZEOF_HDR(F) \
@@ -126,7 +128,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,
@@ -142,8 +143,7 @@ static size_t H5B_nodesize(const 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, unsigned idx,
- const double split_ratios[], void *udata,
- haddr_t *new_addr/*out*/);
+ void *udata, haddr_t *new_addr/*out*/);
static H5B_t * H5B_copy(const H5F_t *f, const H5B_t *old_bt);
static herr_t H5B_serialize(H5F_t *f, H5B_t *bt, uint8_t *buf);
static size_t H5B_size(H5F_t *f, H5B_t *bt);
@@ -475,6 +475,7 @@ H5B_serialize(H5F_t *f, H5B_t *bt, uint8_t *buf)
done:
FUNC_LEAVE_NOAPI(ret_value)
}
+
/*-------------------------------------------------------------------------
* Function: H5B_flush
@@ -794,13 +795,14 @@ 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,
- unsigned idx, const double split_ratios[], void *udata,
- haddr_t *new_addr_p/*out*/)
+ unsigned 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;
unsigned k; /* B-tree 'K' value for the maximum number of entries in node */
unsigned nleft, nright; /* Number of keys in left & right halves */
size_t recsize = 0;
+ double split_ratios[3]; /* B-tree split ratios */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -820,6 +822,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;
@@ -1031,7 +1042,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.
@@ -1058,7 +1069,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")
@@ -1352,8 +1363,8 @@ H5B_insert_child(const 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*/)
{
@@ -1441,7 +1452,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
*/
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)
@@ -1481,7 +1492,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")
@@ -1528,7 +1539,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 < 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")
@@ -1581,7 +1592,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, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node")
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index c3ebf85..1f7a8eb 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -116,7 +116,7 @@ H5_DLL herr_t H5B_create (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void
H5_DLL herr_t H5B_find (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
void *udata);
H5_DLL 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);
H5_DLL herr_t H5B_iterate (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, H5B_operator_t
op, haddr_t addr, void *udata);
H5_DLL herr_t H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 7c91c54..a21418e 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -103,7 +103,6 @@ typedef struct H5F_rdcc_ent_t {
hbool_t locked; /*entry is locked in cache */
hbool_t dirty; /*needs to be written to disk? */
H5O_layout_t *layout; /*the layout message */
- double split_ratios[3];/*B-tree node splitting ratios */
H5O_pline_t *pline; /*filter pipeline message */
hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */
size_t rd_count; /*bytes remaining to be read */
@@ -976,7 +975,7 @@ H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache,
* Create the chunk it if it doesn't exist, or reallocate the chunk if
* its size changed. Then write the data into the file.
*/
- if (H5B_insert(f, dxpl_id, H5B_ISTORE, ent->layout->addr, ent->split_ratios, &udata)<0)
+ if (H5B_insert(f, dxpl_id, H5B_ISTORE, ent->layout->addr, &udata)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk");
if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
@@ -1514,8 +1513,6 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con
ent->wr_count = chunk_size;
ent->chunk = chunk;
- HDmemcpy(&(ent->split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE);
-
/* Add it to the cache */
assert(NULL==rdcc->slot[idx]);
rdcc->slot[idx] = ent;
@@ -1654,8 +1651,6 @@ H5F_istore_unlock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
x.alloc_size = x.chunk_size;
x.chunk = chunk;
- HDmemcpy(&(x.split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE);
-
H5F_istore_flush_entry (f, dxpl_cache, dxpl_id, &x, TRUE);
} else {
if(chunk)
@@ -2172,7 +2167,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
H5F_istore_ud1_t udata; /* B-tree pass-through for creating chunk */
void *chunk=NULL; /* Chunk buffer for writing fill values */
H5P_genplist_t *dx_plist; /* Data xfer property list */
- double split_ratios[3];/* B-tree node splitting ratios */
#ifdef H5_HAVE_PARALLEL
MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank=(-1); /* This process's rank */
@@ -2210,8 +2204,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
/* Get necessary properties from dataset transfer property list */
if (NULL == (dx_plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
- if(H5P_get(dx_plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,split_ratios)<0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get B-tree split ratios");
if(H5P_get(dx_plist,H5D_XFER_EDC_NAME,&edc)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get edc information");
if(H5P_get(dx_plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0)
@@ -2328,7 +2320,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
udata.key.offset[u] = chunk_offset[u];
/* Allocate the chunk with all processes */
- if (H5B_insert(f, dxpl_id, H5B_ISTORE, layout->addr, split_ratios, &udata)<0)
+ if (H5B_insert(f, dxpl_id, H5B_ISTORE, layout->addr, &udata)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk");
/* Check if fill values should be written to blocks */
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index b828c8b..e52f51c 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -91,6 +91,9 @@
#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t)
#define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO
/* Definitions for B-tree node splitting ratio property */
+/* (These default B-tree node splitting ratios are also used for splitting
+ * group's B-trees as well as chunked dataset's B-trees - QAK)
+ */
#define H5D_XFER_BTREE_SPLIT_RATIO_NAME "btree_split_ratio"
#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9}
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index 7c91c54..a21418e 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -103,7 +103,6 @@ typedef struct H5F_rdcc_ent_t {
hbool_t locked; /*entry is locked in cache */
hbool_t dirty; /*needs to be written to disk? */
H5O_layout_t *layout; /*the layout message */
- double split_ratios[3];/*B-tree node splitting ratios */
H5O_pline_t *pline; /*filter pipeline message */
hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */
size_t rd_count; /*bytes remaining to be read */
@@ -976,7 +975,7 @@ H5F_istore_flush_entry(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache,
* Create the chunk it if it doesn't exist, or reallocate the chunk if
* its size changed. Then write the data into the file.
*/
- if (H5B_insert(f, dxpl_id, H5B_ISTORE, ent->layout->addr, ent->split_ratios, &udata)<0)
+ if (H5B_insert(f, dxpl_id, H5B_ISTORE, ent->layout->addr, &udata)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk");
if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file");
@@ -1514,8 +1513,6 @@ H5F_istore_lock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, con
ent->wr_count = chunk_size;
ent->chunk = chunk;
- HDmemcpy(&(ent->split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE);
-
/* Add it to the cache */
assert(NULL==rdcc->slot[idx]);
rdcc->slot[idx] = ent;
@@ -1654,8 +1651,6 @@ H5F_istore_unlock(H5F_t *f, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id,
x.alloc_size = x.chunk_size;
x.chunk = chunk;
- HDmemcpy(&(x.split_ratios),&dxpl_cache->btree_split_ratio,H5D_XFER_BTREE_SPLIT_RATIO_SIZE);
-
H5F_istore_flush_entry (f, dxpl_cache, dxpl_id, &x, TRUE);
} else {
if(chunk)
@@ -2172,7 +2167,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
H5F_istore_ud1_t udata; /* B-tree pass-through for creating chunk */
void *chunk=NULL; /* Chunk buffer for writing fill values */
H5P_genplist_t *dx_plist; /* Data xfer property list */
- double split_ratios[3];/* B-tree node splitting ratios */
#ifdef H5_HAVE_PARALLEL
MPI_Comm mpi_comm=MPI_COMM_NULL; /* MPI communicator for file */
int mpi_rank=(-1); /* This process's rank */
@@ -2210,8 +2204,6 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
/* Get necessary properties from dataset transfer property list */
if (NULL == (dx_plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
- if(H5P_get(dx_plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,split_ratios)<0)
- HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get B-tree split ratios");
if(H5P_get(dx_plist,H5D_XFER_EDC_NAME,&edc)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get edc information");
if(H5P_get(dx_plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0)
@@ -2328,7 +2320,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
udata.key.offset[u] = chunk_offset[u];
/* Allocate the chunk with all processes */
- if (H5B_insert(f, dxpl_id, H5B_ISTORE, layout->addr, split_ratios, &udata)<0)
+ if (H5B_insert(f, dxpl_id, H5B_ISTORE, layout->addr, &udata)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk");
/* Check if fill values should be written to blocks */
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index f92383a..4804cff 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -216,7 +216,6 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hi
{
H5O_stab_t stab; /*symbol table message */
H5G_bt_ud1_t udata; /*data to pass through B-tree */
- static double split_ratios[3] = {0.1, 0.5, 0.9};
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_stab_insert, FAIL);
@@ -242,7 +241,7 @@ H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hi
H5G_ent_copy(&(udata.ent),obj_ent,H5G_COPY_NULL); /* NULL copy here, no copies happens in H5G_node_insert() callback() */
/* insert */
- if (H5B_insert(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, split_ratios, &udata) < 0)
+ if (H5B_insert(grp_ent->file, dxpl_id, H5B_SNODE, stab.btree_addr, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry");
/* update the name offset in the entry */