Commit b49fb112 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Jan Kara

reiserfs: balance_leaf refactor, move state variables into tree_balance

This patch pushes the rest of the state variables in balance_leaf into
the tree_balance structure so we can use them when we split balance_leaf
into separate functions.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 97fd4b97
This diff is collapsed.
...@@ -631,10 +631,11 @@ static void set_parameters(struct tree_balance *tb, int h, int lnum, ...@@ -631,10 +631,11 @@ static void set_parameters(struct tree_balance *tb, int h, int lnum,
/* only for leaf level */ /* only for leaf level */
if (h == 0) { if (h == 0) {
if (s012 != NULL) { if (s012 != NULL) {
tb->s0num = *s012++, tb->s0num = *s012++;
tb->s1num = *s012++, tb->s2num = *s012++; tb->snum[0] = *s012++;
tb->s1bytes = *s012++; tb->snum[1] = *s012++;
tb->s2bytes = *s012; tb->sbytes[0] = *s012++;
tb->sbytes[1] = *s012;
} }
tb->lbytes = lb; tb->lbytes = lb;
tb->rbytes = rb; tb->rbytes = rb;
......
...@@ -673,9 +673,9 @@ void store_print_tb(struct tree_balance *tb) ...@@ -673,9 +673,9 @@ void store_print_tb(struct tree_balance *tb)
"* h * size * ln * lb * rn * rb * blkn * s0 * s1 * s1b * s2 * s2b * curb * lk * rk *\n" "* h * size * ln * lb * rn * rb * blkn * s0 * s1 * s1b * s2 * s2b * curb * lk * rk *\n"
"* 0 * %4d * %2d * %2d * %2d * %2d * %4d * %2d * %2d * %3d * %2d * %3d * %4d * %2d * %2d *\n", "* 0 * %4d * %2d * %2d * %2d * %2d * %4d * %2d * %2d * %3d * %2d * %3d * %4d * %2d * %2d *\n",
tb->insert_size[0], tb->lnum[0], tb->lbytes, tb->rnum[0], tb->insert_size[0], tb->lnum[0], tb->lbytes, tb->rnum[0],
tb->rbytes, tb->blknum[0], tb->s0num, tb->s1num, tb->s1bytes, tb->rbytes, tb->blknum[0], tb->s0num, tb->snum[0],
tb->s2num, tb->s2bytes, tb->cur_blknum, tb->lkey[0], tb->sbytes[0], tb->snum[1], tb->sbytes[1],
tb->rkey[0]); tb->cur_blknum, tb->lkey[0], tb->rkey[0]);
/* this prints balance parameters for non-leaf levels */ /* this prints balance parameters for non-leaf levels */
h = 0; h = 0;
......
...@@ -2471,12 +2471,6 @@ struct tree_balance { ...@@ -2471,12 +2471,6 @@ struct tree_balance {
/* number of items that fall into left most node when S[0] splits */ /* number of items that fall into left most node when S[0] splits */
int s0num; int s0num;
/* number of items that fall into first new node when S[0] splits */
int s1num;
/* number of items that fall into second new node when S[0] splits */
int s2num;
/* /*
* number of bytes which can flow to the left neighbor from the left * number of bytes which can flow to the left neighbor from the left
* most liquid item that cannot be shifted from S[0] entirely * most liquid item that cannot be shifted from S[0] entirely
...@@ -2491,12 +2485,30 @@ struct tree_balance { ...@@ -2491,12 +2485,30 @@ struct tree_balance {
*/ */
int rbytes; int rbytes;
/*
* index into the array of item headers in
* S[0] of the affected item
*/
int item_pos;
/* new nodes allocated to hold what could not fit into S */
struct buffer_head *S_new[2];
/*
* number of items that will be placed into nodes in S_new
* when S[0] splits
*/
int snum[2];
/* /*
* number of bytes which flow to the first new node when S[0] splits * number of bytes which flow to nodes in S_new when S[0] splits
* note: if S[0] splits into 3 nodes, then items do not need to be cut * note: if S[0] splits into 3 nodes, then items do not need to be cut
*/ */
int s1bytes; int sbytes[2];
int s2bytes;
int pos_in_item;
int zeroes_num;
/* /*
* buffers which are to be freed after do_balance finishes * buffers which are to be freed after do_balance finishes
......
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