Commit fb8c6c0a authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:3148] comments, whitespace, typecasting, macro fixes

git-svn-id: file:///svn/toku/tokudb@32672 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5b5c016b
...@@ -90,7 +90,7 @@ struct brtnode_fetch_extra { ...@@ -90,7 +90,7 @@ struct brtnode_fetch_extra {
enum brtnode_fetch_type type; enum brtnode_fetch_type type;
// needed for reading a node off disk // needed for reading a node off disk
struct brt_header *h; struct brt_header *h;
// used in the case where type == brtnode_fetch_extra // used in the case where type == brtnode_fetch_subset
// parameters needed to find out which child needs to be decompressed (so it can be read) // parameters needed to find out which child needs to be decompressed (so it can be read)
brt_search_t* search; brt_search_t* search;
BRT brt; BRT brt;
......
...@@ -442,14 +442,14 @@ toku_verify_estimates (BRT t, BRTNODE node) { ...@@ -442,14 +442,14 @@ toku_verify_estimates (BRT t, BRTNODE node) {
assert_zero(r); assert_zero(r);
BRTNODE childnode = childnode_v; BRTNODE childnode = childnode_v;
for (int i=0; i<childnode->n_children; i++) { for (int i=0; i<childnode->n_children; i++) {
child_estimate += childnode->bp[i].subtree_estimates.ndata; child_estimate += BP_SUBTREE_EST(childnode, i).ndata;
} }
toku_unpin_brtnode(t, childnode); toku_unpin_brtnode(t, childnode);
} }
else { else {
child_estimate = toku_omt_size(BLB_BUFFER(node, childnum)); child_estimate = toku_omt_size(BLB_BUFFER(node, childnum));
} }
assert(node->bp[childnum].subtree_estimates.ndata==child_estimate); assert(BP_SUBTREE_EST(node,childnum).ndata==child_estimate);
} }
} }
} }
...@@ -478,13 +478,13 @@ brtnode_memory_size (BRTNODE node) ...@@ -478,13 +478,13 @@ brtnode_memory_size (BRTNODE node)
continue; continue;
} }
else if (BP_STATE(node,i) == PT_COMPRESSED) { else if (BP_STATE(node,i) == PT_COMPRESSED) {
struct sub_block* sb = (struct sub_block*)node->bp[i].ptr; struct sub_block* sb = node->bp[i].ptr;
retval += sizeof(*sb); retval += sizeof(*sb);
retval += sb->compressed_size; retval += sb->compressed_size;
} }
else if (BP_STATE(node,i) == PT_AVAIL) { else if (BP_STATE(node,i) == PT_AVAIL) {
if (node->height > 0) { if (node->height > 0) {
NONLEAF_CHILDINFO childinfo = (NONLEAF_CHILDINFO)node->bp[i].ptr; NONLEAF_CHILDINFO childinfo = node->bp[i].ptr;
retval += sizeof(*childinfo); retval += sizeof(*childinfo);
retval += toku_fifo_memory_size(BNC_BUFFER(node, i)); retval += toku_fifo_memory_size(BNC_BUFFER(node, i));
} }
...@@ -608,7 +608,7 @@ int toku_brtnode_pe_callback (void *brtnode_pv, long bytes_to_free, long* bytes_ ...@@ -608,7 +608,7 @@ int toku_brtnode_pe_callback (void *brtnode_pv, long bytes_to_free, long* bytes_
for (int i = 0; i < node->n_children; i++) { for (int i = 0; i < node->n_children; i++) {
// Get rid of compressed stuff no matter what. // Get rid of compressed stuff no matter what.
if (BP_STATE(node,i) == PT_COMPRESSED) { if (BP_STATE(node,i) == PT_COMPRESSED) {
struct sub_block* sb = (struct sub_block*)node->bp[i].ptr; struct sub_block* sb = node->bp[i].ptr;
toku_free(sb->compressed_ptr); toku_free(sb->compressed_ptr);
toku_free(node->bp[i].ptr); toku_free(node->bp[i].ptr);
node->bp[i].ptr = NULL; node->bp[i].ptr = NULL;
...@@ -617,7 +617,7 @@ int toku_brtnode_pe_callback (void *brtnode_pv, long bytes_to_free, long* bytes_ ...@@ -617,7 +617,7 @@ int toku_brtnode_pe_callback (void *brtnode_pv, long bytes_to_free, long* bytes_
else if (BP_STATE(node,i) == PT_AVAIL) { else if (BP_STATE(node,i) == PT_AVAIL) {
if (BP_SHOULD_EVICT(node,i)) { if (BP_SHOULD_EVICT(node,i)) {
// free the basement node // free the basement node
BASEMENTNODE bn = (BASEMENTNODE)node->bp[i].ptr; BASEMENTNODE bn = node->bp[i].ptr;
OMT curr_omt = BLB_BUFFER(node, i); OMT curr_omt = BLB_BUFFER(node, i);
toku_omt_free_items(curr_omt); toku_omt_free_items(curr_omt);
destroy_basement_node(bn); destroy_basement_node(bn);
...@@ -649,7 +649,7 @@ BOOL toku_brtnode_pf_req_callback(void* brtnode_pv, void* read_extraargs) { ...@@ -649,7 +649,7 @@ BOOL toku_brtnode_pf_req_callback(void* brtnode_pv, void* read_extraargs) {
// placeholder for now // placeholder for now
BOOL retval = FALSE; BOOL retval = FALSE;
BRTNODE node = brtnode_pv; BRTNODE node = brtnode_pv;
struct brtnode_fetch_extra *bfe = (struct brtnode_fetch_extra *)read_extraargs; struct brtnode_fetch_extra *bfe = read_extraargs;
if (bfe->type == brtnode_fetch_none) { if (bfe->type == brtnode_fetch_none) {
retval = FALSE; retval = FALSE;
} }
...@@ -659,7 +659,6 @@ BOOL toku_brtnode_pf_req_callback(void* brtnode_pv, void* read_extraargs) { ...@@ -659,7 +659,6 @@ BOOL toku_brtnode_pf_req_callback(void* brtnode_pv, void* read_extraargs) {
BP_TOUCH_CLOCK(node,i); BP_TOUCH_CLOCK(node,i);
} }
for (int i = 0; i < node->n_children; i++) { for (int i = 0; i < node->n_children; i++) {
BP_TOUCH_CLOCK(node,i);
// if we find a partition that is not available, // if we find a partition that is not available,
// then a partial fetch is required because // then a partial fetch is required because
// the entire node must be made available // the entire node must be made available
...@@ -696,7 +695,7 @@ BOOL toku_brtnode_pf_req_callback(void* brtnode_pv, void* read_extraargs) { ...@@ -696,7 +695,7 @@ BOOL toku_brtnode_pf_req_callback(void* brtnode_pv, void* read_extraargs) {
// could have just used toku_brtnode_fetch_callback, but wanted to separate the two cases to separate functions // could have just used toku_brtnode_fetch_callback, but wanted to separate the two cases to separate functions
int toku_brtnode_pf_callback(void* brtnode_pv, void* read_extraargs, int fd, long* sizep) { int toku_brtnode_pf_callback(void* brtnode_pv, void* read_extraargs, int fd, long* sizep) {
BRTNODE node = brtnode_pv; BRTNODE node = brtnode_pv;
struct brtnode_fetch_extra *bfe = (struct brtnode_fetch_extra *)read_extraargs; struct brtnode_fetch_extra *bfe = read_extraargs;
// there must be a reason this is being called. If we get a garbage type or the type is brtnode_fetch_none, // there must be a reason this is being called. If we get a garbage type or the type is brtnode_fetch_none,
// then something went wrong // then something went wrong
assert((bfe->type == brtnode_fetch_subset) || (bfe->type == brtnode_fetch_all)); assert((bfe->type == brtnode_fetch_subset) || (bfe->type == brtnode_fetch_all));
...@@ -788,12 +787,12 @@ void toku_destroy_brtnode_internals(BRTNODE node) ...@@ -788,12 +787,12 @@ void toku_destroy_brtnode_internals(BRTNODE node)
} }
} }
else { else {
BASEMENTNODE bn = (BASEMENTNODE)node->bp[i].ptr; BASEMENTNODE bn = node->bp[i].ptr;
destroy_basement_node(bn); destroy_basement_node(bn);
} }
} }
else if (BP_STATE(node,i) == PT_COMPRESSED) { else if (BP_STATE(node,i) == PT_COMPRESSED) {
struct sub_block* sb = (struct sub_block*)node->bp[i].ptr; struct sub_block* sb = node->bp[i].ptr;
toku_free(sb->compressed_ptr); toku_free(sb->compressed_ptr);
} }
else { else {
...@@ -925,7 +924,7 @@ toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num ...@@ -925,7 +924,7 @@ toku_initialize_empty_brtnode (BRTNODE n, BLOCKNUM nodename, int height, int num
} }
else { else {
n->bp[i].ptr = toku_xmalloc(sizeof(struct brtnode_leaf_basement_node)); n->bp[i].ptr = toku_xmalloc(sizeof(struct brtnode_leaf_basement_node));
BASEMENTNODE bn = (BASEMENTNODE)n->bp[i].ptr; BASEMENTNODE bn = n->bp[i].ptr;
memset(bn, 0, sizeof(struct brtnode_leaf_basement_node)); memset(bn, 0, sizeof(struct brtnode_leaf_basement_node));
toku_setup_empty_bn(bn); toku_setup_empty_bn(bn);
} }
...@@ -1129,9 +1128,8 @@ move_leafentries( ...@@ -1129,9 +1128,8 @@ move_leafentries(
{ {
OMTVALUE *MALLOC_N(ube-lbi, new_le); OMTVALUE *MALLOC_N(ube-lbi, new_le);
u_int32_t i = 0; u_int32_t i = 0;
u_int32_t curr_index=0;
*num_bytes_moved = 0; *num_bytes_moved = 0;
for (i = lbi; i < ube; i++, curr_index++) { for (i = lbi; i < ube; i++) {
LEAFENTRY curr_le = NULL; LEAFENTRY curr_le = NULL;
curr_le = fetch_from_buf(src_omt, i); curr_le = fetch_from_buf(src_omt, i);
...@@ -1196,7 +1194,7 @@ brtleaf_split (BRT t, BRTNODE node, BRTNODE *nodea, BRTNODE *nodeb, DBT *splitk, ...@@ -1196,7 +1194,7 @@ brtleaf_split (BRT t, BRTNODE node, BRTNODE *nodea, BRTNODE *nodeb, DBT *splitk,
// the left node, node, will have split_node+1 basement nodes // the left node, node, will have split_node+1 basement nodes
// the right node, B, will have n_children-split_node basement nodes // the right node, B, will have n_children-split_node basement nodes
// the pivots of node will be the first split_node pivots that originally exist // the pivots of node will be the first split_node pivots that originally exist
// the pivots of B will be the last (n_children - split_node) pivots that originally exist // the pivots of B will be the last (n_children - 1 - split_node) pivots that originally exist
//set up the basement nodes in the new node //set up the basement nodes in the new node
int num_children_in_node = split_node + 1; int num_children_in_node = split_node + 1;
...@@ -1222,7 +1220,7 @@ brtleaf_split (BRT t, BRTNODE node, BRTNODE *nodea, BRTNODE *nodeb, DBT *splitk, ...@@ -1222,7 +1220,7 @@ brtleaf_split (BRT t, BRTNODE node, BRTNODE *nodea, BRTNODE *nodeb, DBT *splitk,
BP_HAVE_FULLHASH(B,i) = FALSE; BP_HAVE_FULLHASH(B,i) = FALSE;
BP_SUBTREE_EST(B,i)= zero_estimates; BP_SUBTREE_EST(B,i)= zero_estimates;
B->bp[i].ptr = toku_xmalloc(sizeof(struct brtnode_leaf_basement_node)); B->bp[i].ptr = toku_xmalloc(sizeof(struct brtnode_leaf_basement_node));
BASEMENTNODE bn = (BASEMENTNODE)B->bp[i].ptr; BASEMENTNODE bn = B->bp[i].ptr;
toku_setup_empty_bn(bn); toku_setup_empty_bn(bn);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment