summaryrefslogtreecommitdiffstats
path: root/src/H5B2pkg.h
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2012-05-30 22:01:00 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2012-05-30 22:01:00 (GMT)
commit9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6 (patch)
tree006f9f714a95e349ae313fd76afdae9a45910c19 /src/H5B2pkg.h
parent1f6cb6f84a0fdeec79938624ef874d4147d52d87 (diff)
downloadhdf5-9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6.zip
hdf5-9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6.tar.gz
hdf5-9786c0e5cb563c362c9b6f5b9bd0730b9ddcadf6.tar.bz2
[svn-r22422] Purpose: Add support for SWMR with v2 b-trees
Description: Adds SWMR support to the v2 b-trees when used as a chunk index. Because each node keeps track of the total number of records reachable through each of its children, nodes must be shadowed every time a descendent record is inserted or removed. This implementation prevents this from happening, however, if the node has already been shadowed since the last time the v2 b-tree header was flushed. Also modified SWMR test to include v2 b-trees. Tested: jam, koala, ostrich (h5committest), durandal Note: There is a preexisting failure in the ph5diff (-v) test
Diffstat (limited to 'src/H5B2pkg.h')
-rw-r--r--src/H5B2pkg.h62
1 files changed, 39 insertions, 23 deletions
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index b820853..96ef54f 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -160,6 +160,7 @@ typedef struct H5B2_hdr_t {
/* Shared internal data structures (not stored) */
H5F_t *f; /* Pointer to the file that the B-tree is in */
+ void *parent; /* Flush dependency parent */
haddr_t addr; /* Address of B-tree header in the file */
size_t hdr_size; /* Size of the B-tree header on disk */
size_t rc; /* Reference count of nodes using this header */
@@ -172,6 +173,9 @@ typedef struct H5B2_hdr_t {
uint8_t *page; /* Common disk page for I/O */
size_t *nat_off; /* Array of offsets of native records */
H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */
+ hbool_t swmr_write; /* Whether we are doing SWMR writes */
+ struct H5B2_leaf_t *shadowed_leaf; /* Linked list of shadowed leaf nodes */
+ struct H5B2_internal_t *shadowed_internal; /* Linked list of shadowed internal nodes */
/* Client information (not stored) */
const H5B2_class_t *cls; /* Class of B-tree client */
@@ -185,8 +189,10 @@ typedef struct H5B2_leaf_t {
/* Internal B-tree information */
H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
+ void *parent; /* Flush dependency parent */
uint8_t *leaf_native; /* Pointer to native records */
uint16_t nrec; /* Number of records in node */
+ struct H5B2_leaf_t *shadowed_next; /* Next node in shadowed list */
} H5B2_leaf_t;
/* B-tree internal node information */
@@ -196,10 +202,12 @@ typedef struct H5B2_internal_t {
/* Internal B-tree information */
H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
+ void *parent; /* Flush dependency parent */
uint8_t *int_native; /* Pointer to native records */
H5B2_node_ptr_t *node_ptrs; /* Pointer to node pointers */
uint16_t nrec; /* Number of records in node */
uint16_t depth; /* Depth of this node in the B-tree */
+ struct H5B2_internal_t *shadowed_next; /* Next node in shadowed list */
} H5B2_internal_t;
/* v2 B-tree */
@@ -211,6 +219,7 @@ struct H5B2_t {
/* Callback info for loading a free space header into the cache */
typedef struct H5B2_hdr_cache_ud_t {
H5F_t *f; /* File that v2 b-tree header is within */
+ void *parent; /* Flush dependency parent */
void *ctx_udata; /* User-data for protecting */
} H5B2_hdr_cache_ud_t;
@@ -218,6 +227,7 @@ typedef struct H5B2_hdr_cache_ud_t {
typedef struct H5B2_internal_cache_ud_t {
H5F_t *f; /* File that v2 b-tree header is within */
H5B2_hdr_t *hdr; /* v2 B-tree header */
+ void *parent; /* Flush dependency parent */
unsigned nrec; /* Number of records in node to load */
unsigned depth; /* Depth of node to load */
} H5B2_internal_cache_ud_t;
@@ -226,6 +236,7 @@ typedef struct H5B2_internal_cache_ud_t {
typedef struct H5B2_leaf_cache_ud_t {
H5F_t *f; /* File that v2 b-tree header is within */
H5B2_hdr_t *hdr; /* v2 B-tree header */
+ void *parent; /* Flush dependency parent */
unsigned nrec; /* Number of records in node to load */
} H5B2_leaf_cache_ud_t;
@@ -273,9 +284,9 @@ extern const H5B2_class_t *const H5B2_client_class_g[H5B2_NUM_BTREE_ID];
/* Routines for managing B-tree header info */
H5_DLL H5B2_hdr_t *H5B2_hdr_alloc(H5F_t *f);
H5_DLL haddr_t H5B2_hdr_create(H5F_t *f, hid_t dxpl_id,
- const H5B2_create_t *cparam, void *ctx_udata);
+ const H5B2_create_t *cparam, void *ctx_udata, void *parent);
H5_DLL herr_t H5B2_hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
- void *ctx_udata, uint16_t depth);
+ void *ctx_udata, void *parent, uint16_t depth);
H5_DLL herr_t H5B2_hdr_incr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2_hdr_decr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr);
@@ -285,15 +296,15 @@ H5_DLL herr_t H5B2_hdr_delete(H5B2_hdr_t *hdr, hid_t dxpl_id);
/* Routines for operating on leaf nodes */
H5B2_leaf_t *H5B2_protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr,
- unsigned nrec, H5AC_protect_t rw);
+ void *parent, unsigned nrec, H5AC_protect_t rw);
/* Routines for operating on internal nodes */
H5_DLL H5B2_internal_t *H5B2_protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
- haddr_t addr, unsigned nrec, unsigned depth, H5AC_protect_t rw);
+ haddr_t addr, void *parent, unsigned nrec, unsigned depth, H5AC_protect_t rw);
/* Routines for allocating nodes */
-H5_DLL herr_t H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id);
-H5_DLL herr_t H5B2_create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
+H5_DLL herr_t H5B2_split_root(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata);
+H5_DLL herr_t H5B2_create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent,
H5B2_node_ptr_t *node_ptr);
/* Routines for releasing structures */
@@ -304,45 +315,50 @@ H5_DLL herr_t H5B2_internal_free(H5B2_internal_t *i);
/* Routines for inserting records */
H5_DLL herr_t H5B2_insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
unsigned depth, unsigned *parent_cache_info_flags_ptr,
- H5B2_node_ptr_t *curr_node_ptr, void *udata);
+ H5B2_node_ptr_t *curr_node_ptr, void *parent, void *udata);
H5_DLL herr_t H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
- H5B2_node_ptr_t *curr_node_ptr, void *udata);
+ H5B2_node_ptr_t *curr_node_ptr, void *parent, void *udata);
/* Routines for iterating over nodes/records */
H5_DLL herr_t H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
- const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data);
+ const H5B2_node_ptr_t *curr_node, void *parent, H5B2_operator_t op, void *op_data);
H5_DLL herr_t H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id,
- unsigned depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data);
+ unsigned depth, const H5B2_node_ptr_t *curr_node, void *parent,
+ hsize_t *op_data);
/* Routines for locating records */
H5_DLL int H5B2_locate_record(const H5B2_class_t *type, unsigned nrec,
size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx);
H5_DLL herr_t H5B2_neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
unsigned depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
- H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
+ H5B2_compare_t comp, void *parent, void *udata, H5B2_found_t op,
+ void *op_data);
H5_DLL herr_t H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
- H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc,
- H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data);
+ H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp,
+ void *parent, void *udata, H5B2_found_t op, void *op_data);
/* Routines for removing records */
H5_DLL herr_t H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id,
- hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
- hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, void *udata,
- H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
+ hbool_t *depth_decreased, void *swap_loc, void *swap_parent, unsigned depth,
+ H5AC_info_t *parent_cache_info, hbool_t * parent_cache_info_dirtied_ptr,
H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op,
void *op_data);
+H5_DLL herr_t H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
+ H5B2_node_ptr_t *curr_node_ptr, void *parent, void *udata, H5B2_remove_t op,
+ void *op_data);
H5_DLL herr_t H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
- hbool_t *depth_decreased, void *swap_loc, unsigned depth, H5AC_info_t *parent_cache_info,
- hbool_t * parent_cache_info_dirtied_ptr, H5B2_node_ptr_t *curr_node_ptr, hsize_t idx,
- H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
- H5B2_node_ptr_t *curr_node_ptr, unsigned idx, H5B2_remove_t op,
+ hbool_t *depth_decreased, void *swap_loc, void *swap_parent, unsigned depth,
+ H5AC_info_t *parent_cache_info, hbool_t * parent_cache_info_dirtied_ptr,
+ H5B2_node_ptr_t *curr_node_ptr, hsize_t idx, void *udata, H5B2_remove_t op,
void *op_data);
+H5_DLL herr_t H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id,
+ H5B2_node_ptr_t *curr_node_ptr, void *parent, unsigned idx,
+ H5B2_remove_t op, void *op_data);
/* Routines for deleting nodes */
H5_DLL herr_t H5B2_delete_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
- const H5B2_node_ptr_t *curr_node, H5B2_remove_t op, void *op_data);
+ const H5B2_node_ptr_t *curr_node, void *parent, H5B2_remove_t op,
+ void *op_data);
/* Debugging routines for dumping file structures */
H5_DLL herr_t H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,