Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+185 −206

File changed.

Preview size limit exceeded, changes collapsed.

+5 −4
Original line number Diff line number Diff line
@@ -631,10 +631,11 @@ static void set_parameters(struct tree_balance *tb, int h, int lnum,
	/* only for leaf level */
	if (h == 0) {
		if (s012 != NULL) {
			tb->s0num = *s012++,
			    tb->s1num = *s012++, tb->s2num = *s012++;
			tb->s1bytes = *s012++;
			tb->s2bytes = *s012;
			tb->s0num = *s012++;
			tb->snum[0] = *s012++;
			tb->snum[1] = *s012++;
			tb->sbytes[0] = *s012++;
			tb->sbytes[1] = *s012;
		}
		tb->lbytes = lb;
		tb->rbytes = rb;
+3 −3
Original line number Diff line number Diff line
@@ -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"
		"* 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->rbytes, tb->blknum[0], tb->s0num, tb->s1num, tb->s1bytes,
		tb->s2num, tb->s2bytes, tb->cur_blknum, tb->lkey[0],
		tb->rkey[0]);
		tb->rbytes, tb->blknum[0], tb->s0num, tb->snum[0],
		tb->sbytes[0], tb->snum[1], tb->sbytes[1],
		tb->cur_blknum, tb->lkey[0], tb->rkey[0]);

	/* this prints balance parameters for non-leaf levels */
	h = 0;
+21 −9
Original line number Diff line number Diff line
@@ -2471,12 +2471,6 @@ struct tree_balance {
	/* number of items that fall into left most node when S[0] splits */
	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
	 * most liquid item that cannot be shifted from S[0] entirely
@@ -2491,12 +2485,30 @@ struct tree_balance {
	 */
	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
	 */
	int s1bytes;
	int s2bytes;
	int sbytes[2];

	int pos_in_item;
	int zeroes_num;

	/*
	 * buffers which are to be freed after do_balance finishes