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

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

reiserfs: cleanup, rename key and item accessors to more friendly names



This patch does a quick search and replace:
B_N_PITEM_HEAD() -> item_head()
B_N_PDELIM_KEY() -> internal_key()
B_N_PKEY() -> leaf_key()
B_N_PITEM() -> item_body()

And the item_head version:
B_I_PITEM() -> ih_item_body()
I_ENTRY_COUNT() -> ih_entry_count()

And the treepath variants:
get_ih() -> tp_item_head()
PATH_PITEM_HEAD() -> tp_item_head()
get_item() -> tp_item_body()

... which makes the code much easier on the eyes.

I've also removed a few unused macros.

Checkpatch will complain about the 80 character limit for do_balan.c.
I've addressed that in a later patchset to split up balance_leaf().

Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 797d9016
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -819,9 +819,9 @@ static int get_left_neighbor(reiserfs_blocknr_hint_t * hint)
	path = hint->path;
	bh = get_last_bh(path);
	RFALSE(!bh, "green-4002: Illegal path specified to get_left_neighbor");
	ih = get_ih(path);
	ih = tp_item_head(path);
	pos_in_item = path->pos_in_item;
	item = get_item(path);
	item = tp_item_body(path);

	hint->search_start = bh->b_blocknr;

+4 −4
Original line number Diff line number Diff line
@@ -110,17 +110,17 @@ int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
		       item_num, B_NR_ITEMS(bh));

		/* and entry must be not more than number of entries in the item */
		RFALSE(I_ENTRY_COUNT(ih) < entry_num,
		RFALSE(ih_entry_count(ih) < entry_num,
		       "vs-9010: entry number is too big %d (%d)",
		       entry_num, I_ENTRY_COUNT(ih));
		       entry_num, ih_entry_count(ih));

		if (search_res == POSITION_FOUND
		    || entry_num < I_ENTRY_COUNT(ih)) {
		    || entry_num < ih_entry_count(ih)) {
			/* go through all entries in the directory item beginning from the entry, that has been found */
			struct reiserfs_de_head *deh =
			    B_I_DEH(bh, ih) + entry_num;

			for (; entry_num < I_ENTRY_COUNT(ih);
			for (; entry_num < ih_entry_count(ih);
			     entry_num++, deh++) {
				int d_reclen;
				char *d_name;
+49 −49
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ static int balance_leaf_when_delete(struct tree_balance *tb, int flag)
	RFALSE(!tb->blknum[0] && !PATH_H_PPARENT(tb->tb_path, 0),
	       "PAP-12010: tree can not be empty");

	ih = B_N_PITEM_HEAD(tbS0, item_pos);
	ih = item_head(tbS0, item_pos);
	buffer_info_init_tbS0(tb, &bi);

	/* Delete or truncate the item */
@@ -312,7 +312,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
	/* for indirect item pos_in_item is measured in unformatted node
	   pointers. Recalculate to bytes */
	if (flag != M_INSERT
	    && is_indirect_le_ih(B_N_PITEM_HEAD(tbS0, item_pos)))
	    && is_indirect_le_ih(item_head(tbS0, item_pos)))
		pos_in_item *= UNFM_P_SIZE;

	if (tb->lnum[0] > 0) {
@@ -378,7 +378,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h

				if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) {
					/* we must shift the part of the appended item */
					if (is_direntry_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) {
					if (is_direntry_le_ih(item_head(tbS0, item_pos))) {

						RFALSE(zeros_num,
						       "PAP-12090: invalid parameter in case of a directory");
@@ -391,8 +391,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
							/* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 entries from given directory item */
							ret_val = leaf_shift_left(tb, tb->lnum[0], tb->lbytes-1);
							if (ret_val && !item_pos) {
								pasted = B_N_PITEM_HEAD(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1);
								l_pos_in_item += I_ENTRY_COUNT(pasted) - (tb->lbytes -1);
								pasted = item_head(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1);
								l_pos_in_item += ih_entry_count(pasted) - (tb->lbytes -1);
							}

							/* Append given directory entry to directory item */
@@ -418,9 +418,9 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
					} else {
						/* regular object */
						RFALSE(tb->lbytes <= 0, "PAP-12095: there is nothing to shift to L[0]. lbytes=%d", tb->lbytes);
						RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),
						RFALSE(pos_in_item != ih_item_len(item_head(tbS0, item_pos)),
						       "PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d",
						       ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),pos_in_item);
						       ih_item_len(item_head(tbS0, item_pos)),pos_in_item);

						if (tb->lbytes >= pos_in_item) {
							/* appended item will be in L[0] in whole */
@@ -436,12 +436,12 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
							       "PAP-12105: there is nothing to paste into L[0]. insert_size=%d",
							       tb->insert_size[0]);
							ret_val = leaf_shift_left(tb, tb->lnum[0], ih_item_len
									    (B_N_PITEM_HEAD(tbS0, item_pos)));
									    (item_head(tbS0, item_pos)));
							/* Append to body of item in L[0] */
							buffer_info_init_left(tb, &bi);
							leaf_paste_in_buffer
							    (&bi, n + item_pos - ret_val, ih_item_len
							     (B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val)),
							     (item_head(tb->L[0], n + item_pos - ret_val)),
							     l_n, body,
							     zeros_num > l_n ? l_n : zeros_num);
							/* 0-th item in S0 can be only of DIRECT type when l_n != 0 */
@@ -449,21 +449,21 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
								int version;
								int temp_l = l_n;

								RFALSE(ih_item_len(B_N_PITEM_HEAD(tbS0, 0)),
								RFALSE(ih_item_len(item_head(tbS0, 0)),
								     "PAP-12106: item length must be 0");
								RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY
								RFALSE(comp_short_le_keys(leaf_key(tbS0, 0), leaf_key
								      (tb->L[0], n + item_pos - ret_val)),
								     "PAP-12107: items must be of the same file");
								if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val))) {
								if (is_indirect_le_ih(item_head(tb->L[0], n + item_pos - ret_val))) {
									temp_l = l_n << (tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT);
								}
								/* update key of first item in S0 */
								version = ih_version(B_N_PITEM_HEAD(tbS0, 0));
								set_le_key_k_offset(version, B_N_PKEY(tbS0, 0),
								     le_key_k_offset(version,B_N_PKEY(tbS0, 0)) + temp_l);
								version = ih_version(item_head(tbS0, 0));
								set_le_key_k_offset(version, leaf_key(tbS0, 0),
								     le_key_k_offset(version,leaf_key(tbS0, 0)) + temp_l);
								/* update left delimiting key */
								set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),
								     le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0])) + temp_l);
								set_le_key_k_offset(version, internal_key(tb->CFL[0], tb->lkey[0]),
								     le_key_k_offset(version, internal_key(tb->CFL[0], tb->lkey[0])) + temp_l);
							}

							/* Calculate new body, position in item and insert_size[0] */
@@ -474,9 +474,9 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
								zeros_num -= l_n;
							pos_in_item = 0;

							RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1))
							     || !op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)
							     || !op_is_left_mergeable(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), tbS0->b_size),
							RFALSE(comp_short_le_keys(leaf_key(tbS0, 0), leaf_key(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1))
							     || !op_is_left_mergeable(leaf_key(tbS0, 0), tbS0->b_size)
							     || !op_is_left_mergeable(internal_key(tb->CFL[0], tb->lkey[0]), tbS0->b_size),
							     "PAP-12120: item must be merge-able with left neighboring item");
						} else {	/* only part of the appended item will be in L[0] */

@@ -493,9 +493,9 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h

					struct item_head *pasted;

					if (!item_pos && op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)) {	/* if we paste into first item of S[0] and it is left mergable */
					if (!item_pos && op_is_left_mergeable(leaf_key(tbS0, 0), tbS0->b_size)) {	/* if we paste into first item of S[0] and it is left mergable */
						/* then increment pos_in_item by the size of the last item in L[0] */
						pasted = B_N_PITEM_HEAD(tb->L[0], n - 1);
						pasted = item_head(tb->L[0], n - 1);
						if (is_direntry_le_ih(pasted))
							pos_in_item += ih_entry_count(pasted);
						else
@@ -512,7 +512,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
							     body, zeros_num);

					/* if appended item is directory, paste entry */
					pasted = B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val);
					pasted = item_head(tb->L[0], n + item_pos - ret_val);
					if (is_direntry_le_ih(pasted))
						leaf_paste_entries(&bi, n + item_pos - ret_val,
								   pos_in_item, 1,
@@ -617,12 +617,12 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h

			if (n - tb->rnum[0] <= item_pos) {	/* pasted item or part of it falls to R[0] */
				if (item_pos == n - tb->rnum[0] && tb->rbytes != -1) {	/* we must shift the part of the appended item */
					if (is_direntry_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) {	/* we append to directory item */
					if (is_direntry_le_ih(item_head(tbS0, item_pos))) {	/* we append to directory item */
						int entry_count;

						RFALSE(zeros_num,
						       "PAP-12145: invalid parameter in case of a directory");
						entry_count = I_ENTRY_COUNT(B_N_PITEM_HEAD
						entry_count = ih_entry_count(item_head
								  (tbS0, item_pos));
						if (entry_count - tb->rbytes <
						    pos_in_item)
@@ -665,10 +665,10 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
							n_shift = 0;

						RFALSE(pos_in_item != ih_item_len
						       (B_N_PITEM_HEAD(tbS0, item_pos)),
						       (item_head(tbS0, item_pos)),
						       "PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d",
						       pos_in_item, ih_item_len
						       (B_N_PITEM_HEAD(tbS0, item_pos)));
						       (item_head(tbS0, item_pos)));

						leaf_shift_right(tb, tb->rnum[0], n_shift);
						/* Calculate number of bytes which must remain in body after appending to R[0] */
@@ -679,17 +679,17 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
							int version;
							unsigned long temp_rem = n_rem;

							version = ih_version(B_N_PITEM_HEAD(tb->R[0], 0));
							if (is_indirect_le_key(version, B_N_PKEY(tb->R[0], 0))) {
							version = ih_version(item_head(tb->R[0], 0));
							if (is_indirect_le_key(version, leaf_key(tb->R[0], 0))) {
								temp_rem = n_rem << (tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT);
							}
							set_le_key_k_offset(version, B_N_PKEY(tb->R[0], 0),
							     le_key_k_offset(version, B_N_PKEY(tb->R[0], 0)) + temp_rem);
							set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]),
							     le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])) + temp_rem);
							set_le_key_k_offset(version, leaf_key(tb->R[0], 0),
							     le_key_k_offset(version, leaf_key(tb->R[0], 0)) + temp_rem);
							set_le_key_k_offset(version, internal_key(tb->CFR[0], tb->rkey[0]),
							     le_key_k_offset(version, internal_key(tb->CFR[0], tb->rkey[0])) + temp_rem);
						}
/*		  k_offset (B_N_PKEY(tb->R[0],0)) += n_rem;
		  k_offset (B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0])) += n_rem;*/
/*		  k_offset (leaf_key(tb->R[0],0)) += n_rem;
		  k_offset (internal_key(tb->CFR[0],tb->rkey[0])) += n_rem;*/
						do_balance_mark_internal_dirty(tb, tb->CFR[0], 0);

						/* Append part of body into R[0] */
@@ -707,12 +707,12 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
								     tb->insert_size[0] - n_rem,
								     r_body, r_zeros_number);

						if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->R[0], 0))) {
						if (is_indirect_le_ih(item_head(tb->R[0], 0))) {
#if 0
							RFALSE(n_rem,
							       "PAP-12160: paste more than one unformatted node pointer");
#endif
							set_ih_free_space(B_N_PITEM_HEAD(tb->R[0], 0), 0);
							set_ih_free_space(item_head(tb->R[0], 0), 0);
						}
						tb->insert_size[0] = n_rem;
						if (!n_rem)
@@ -731,7 +731,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
					}

					/* paste new entry, if item is directory item */
					pasted = B_N_PITEM_HEAD(tb->R[0], item_pos - n + tb->rnum[0]);
					pasted = item_head(tb->R[0], item_pos - n + tb->rnum[0]);
					if (is_direntry_le_ih(pasted) && pos_in_item >= 0) {
						leaf_paste_entries(&bi, item_pos - n + tb->rnum[0],
								   pos_in_item, 1,
@@ -784,8 +784,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
			if (!tb->CFR[0])
				reiserfs_panic(tb->tb_sb, "vs-12195",
					       "CFR not initialized");
			copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),
				 B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]));
			copy_key(internal_key(tb->CFL[0], tb->lkey[0]),
				 internal_key(tb->CFR[0], tb->rkey[0]));
			do_balance_mark_internal_dirty(tb, tb->CFL[0], 0);
		}

@@ -886,7 +886,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h

					RFALSE(ih, "PAP-12210: ih must be 0");

					aux_ih = B_N_PITEM_HEAD(tbS0, item_pos);
					aux_ih = item_head(tbS0, item_pos);
					if (is_direntry_le_ih(aux_ih)) {
						/* we append to directory item */

@@ -922,7 +922,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
						int n_shift, n_rem, r_zeros_number;
						const char *r_body;

						RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)) || tb->insert_size[0] <= 0,
						RFALSE(pos_in_item != ih_item_len(item_head(tbS0, item_pos)) || tb->insert_size[0] <= 0,
						       "PAP-12225: item too short or insert_size <= 0");

						/* Calculate number of bytes which must be shifted from appended item */
@@ -952,7 +952,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
						{
							struct item_head *tmp;

							tmp = B_N_PITEM_HEAD(S_new[i], 0);
							tmp = item_head(S_new[i], 0);
							if (is_indirect_le_ih
							    (tmp)) {
								set_ih_free_space(tmp, 0);
@@ -973,7 +973,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
					struct item_head *pasted;

#ifdef CONFIG_REISERFS_CHECK
					struct item_head *ih_check = B_N_PITEM_HEAD(tbS0, item_pos);
					struct item_head *ih_check = item_head(tbS0, item_pos);

					if (!is_direntry_le_ih(ih_check)
					    && (pos_in_item != ih_item_len(ih_check)
@@ -1002,7 +1002,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
							     tb->insert_size[0],
							     body, zeros_num);

					pasted = B_N_PITEM_HEAD(S_new[i], item_pos - n + snum[i]);
					pasted = item_head(S_new[i], item_pos - n + snum[i]);
					if (is_direntry_le_ih(pasted)) {
						leaf_paste_entries(&bi,
								   item_pos - n + snum[i],
@@ -1032,7 +1032,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
				       (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);
		}

		memcpy(insert_key + i, B_N_PKEY(S_new[i], 0), KEY_SIZE);
		memcpy(insert_key + i, leaf_key(S_new[i], 0), KEY_SIZE);
		insert_ptr[i] = S_new[i];

		RFALSE(!buffer_journaled(S_new[i])
@@ -1061,7 +1061,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h
		case M_PASTE:{	/* append item in S[0] */
				struct item_head *pasted;

				pasted = B_N_PITEM_HEAD(tbS0, item_pos);
				pasted = item_head(tbS0, item_pos);
				/* when directory, may be new entry already pasted */
				if (is_direntry_le_ih(pasted)) {
					if (pos_in_item >= 0 && pos_in_item <= ih_entry_count(pasted)) {
@@ -1246,10 +1246,10 @@ void replace_key(struct tree_balance *tb, struct buffer_head *dest, int n_dest,

	if (B_IS_ITEMS_LEVEL(src))
		/* source buffer contains leaf node */
		memcpy(B_N_PDELIM_KEY(dest, n_dest), B_N_PITEM_HEAD(src, n_src),
		memcpy(internal_key(dest, n_dest), item_head(src, n_src),
		       KEY_SIZE);
	else
		memcpy(B_N_PDELIM_KEY(dest, n_dest), B_N_PDELIM_KEY(src, n_src),
		memcpy(internal_key(dest, n_dest), internal_key(src, n_src),
		       KEY_SIZE);

	do_balance_mark_internal_dirty(tb, dest, 0);
+10 −10
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ static void create_virtual_node(struct tree_balance *tb, int h)
	vn->vn_free_ptr += vn->vn_nr_item * sizeof(struct virtual_item);

	/* first item in the node */
	ih = B_N_PITEM_HEAD(Sh, 0);
	ih = item_head(Sh, 0);

	/* define the mergeability for 0-th item (if it is not being deleted) */
	if (op_is_left_mergeable(&(ih->ih_key), Sh->b_size)
@@ -128,7 +128,7 @@ static void create_virtual_node(struct tree_balance *tb, int h)

		vi->vi_item_len += ih_item_len(ih + j) + IH_SIZE;
		vi->vi_ih = ih + j;
		vi->vi_item = B_I_PITEM(Sh, ih + j);
		vi->vi_item = ih_item_body(Sh, ih + j);
		vi->vi_uarea = vn->vn_free_ptr;

		// FIXME: there is no check, that item operation did not
@@ -168,7 +168,7 @@ static void create_virtual_node(struct tree_balance *tb, int h)
	if (tb->CFR[0]) {
		struct reiserfs_key *key;

		key = B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]);
		key = internal_key(tb->CFR[0], tb->rkey[0]);
		if (op_is_left_mergeable(key, Sh->b_size)
		    && (vn->vn_mode != M_DELETE
			|| vn->vn_affected_item_num != B_NR_ITEMS(Sh) - 1))
@@ -182,8 +182,8 @@ static void create_virtual_node(struct tree_balance *tb, int h)
			/* we delete last item and it could be merged with right neighbor's first item */
			if (!
			    (B_NR_ITEMS(Sh) == 1
			     && is_direntry_le_ih(B_N_PITEM_HEAD(Sh, 0))
			     && I_ENTRY_COUNT(B_N_PITEM_HEAD(Sh, 0)) == 1)) {
			     && is_direntry_le_ih(item_head(Sh, 0))
			     && ih_entry_count(item_head(Sh, 0)) == 1)) {
				/* node contains more than 1 item, or item is not directory item, or this item contains more than 1 entry */
				print_block(Sh, 0, -1, -1);
				reiserfs_panic(tb->tb_sb, "vs-8045",
@@ -675,10 +675,10 @@ static int are_leaves_removable(struct tree_balance *tb, int lfree, int rfree)
		       "vs-8125: item number must be 1: it is %d",
		       B_NR_ITEMS(S0));

		ih = B_N_PITEM_HEAD(S0, 0);
		ih = item_head(S0, 0);
		if (tb->CFR[0]
		    && !comp_short_le_keys(&(ih->ih_key),
					   B_N_PDELIM_KEY(tb->CFR[0],
					   internal_key(tb->CFR[0],
							  tb->rkey[0])))
			if (is_direntry_le_ih(ih)) {
				/* Directory must be in correct state here: that is
@@ -1036,7 +1036,7 @@ static int get_far_parent(struct tree_balance *tb,

	/* Form key to get parent of the left/right neighbor. */
	le_key2cpu_key(&s_lr_father_key,
		       B_N_PDELIM_KEY(*pcom_father,
		       internal_key(*pcom_father,
				      (c_lr_par ==
				       LEFT_PARENTS) ? (tb->lkey[h - 1] =
							position -
@@ -1175,9 +1175,9 @@ static inline int can_node_be_removed(int mode, int lfree, int sfree, int rfree,
	struct item_head *ih;
	struct reiserfs_key *r_key = NULL;

	ih = B_N_PITEM_HEAD(Sh, 0);
	ih = item_head(Sh, 0);
	if (tb->CFR[h])
		r_key = B_N_PDELIM_KEY(tb->CFR[h], tb->rkey[h]);
		r_key = internal_key(tb->CFR[h], tb->rkey[h]);

	if (lfree + rfree + sfree < MAX_CHILD_SIZE(Sh) + levbytes
	    /* shifting may merge items which might save space */
+10 −10
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ static void internal_insert_childs(struct buffer_info *cur_bi,
	memcpy(dc, new_dc, DC_SIZE * count);

	/* prepare space for count items  */
	ih = B_N_PDELIM_KEY(cur, ((to == -1) ? 0 : to));
	ih = internal_key(cur, ((to == -1) ? 0 : to));

	memmove(ih + count, ih,
		(nr - to) * KEY_SIZE + (nr + 1 + count) * DC_SIZE);
@@ -233,7 +233,7 @@ static void internal_delete_pointers_items(struct buffer_info *cur_bi,
	dc = B_N_CHILD(cur, first_p);

	memmove(dc, dc + del_num, (nr + 1 - first_p - del_num) * DC_SIZE);
	key = B_N_PDELIM_KEY(cur, first_i);
	key = internal_key(cur, first_i);
	memmove(key, key + del_num,
		(nr - first_i - del_num) * KEY_SIZE + (nr + 1 -
						       del_num) * DC_SIZE);
@@ -330,13 +330,13 @@ static void internal_copy_pointers_items(struct buffer_info *dest_bi,
	memcpy(dc, B_N_CHILD(src, src_order), DC_SIZE * cpy_num);

	/* prepare space for cpy_num - 1 item headers */
	key = B_N_PDELIM_KEY(dest, dest_order);
	key = internal_key(dest, dest_order);
	memmove(key + cpy_num - 1, key,
		KEY_SIZE * (nr_dest - dest_order) + DC_SIZE * (nr_dest +
							       cpy_num));

	/* insert headers */
	memcpy(key, B_N_PDELIM_KEY(src, src_order), KEY_SIZE * (cpy_num - 1));
	memcpy(key, internal_key(src, src_order), KEY_SIZE * (cpy_num - 1));

	/* sizes, item number */
	set_blkh_nr_item(blkh, blkh_nr_item(blkh) + (cpy_num - 1));
@@ -429,12 +429,12 @@ static void internal_insert_key(struct buffer_info *dest_bi, int dest_position_b
	nr = blkh_nr_item(blkh);

	/* prepare space for inserting key */
	key = B_N_PDELIM_KEY(dest, dest_position_before);
	key = internal_key(dest, dest_position_before);
	memmove(key + 1, key,
		(nr - dest_position_before) * KEY_SIZE + (nr + 1) * DC_SIZE);

	/* insert key */
	memcpy(key, B_N_PDELIM_KEY(src, src_position), KEY_SIZE);
	memcpy(key, internal_key(src, src_position), KEY_SIZE);

	/* Change dirt, free space, item number fields. */

@@ -717,7 +717,7 @@ static void replace_lkey(struct tree_balance *tb, int h, struct item_head *key)
	if (B_NR_ITEMS(PATH_H_PBUFFER(tb->tb_path, h)) == 0)
		return;

	memcpy(B_N_PDELIM_KEY(tb->CFL[h], tb->lkey[h]), key, KEY_SIZE);
	memcpy(internal_key(tb->CFL[h], tb->lkey[h]), key, KEY_SIZE);

	do_balance_mark_internal_dirty(tb, tb->CFL[h], 0);
}
@@ -732,7 +732,7 @@ static void replace_rkey(struct tree_balance *tb, int h, struct item_head *key)
	       "R[h] can not be empty if it exists (item number=%d)",
	       B_NR_ITEMS(tb->R[h]));

	memcpy(B_N_PDELIM_KEY(tb->CFR[h], tb->rkey[h]), key, KEY_SIZE);
	memcpy(internal_key(tb->CFR[h], tb->rkey[h]), key, KEY_SIZE);

	do_balance_mark_internal_dirty(tb, tb->CFR[h], 0);
}
@@ -997,7 +997,7 @@ int balance_internal(struct tree_balance *tb, /* tree_balance structure
			/* new items don't fall into S_new */
			/*  store the delimiting key for the next level */
			/* new_insert_key = (n - snum)'th key in S[h] */
			memcpy(&new_insert_key, B_N_PDELIM_KEY(tbSh, n - snum),
			memcpy(&new_insert_key, internal_key(tbSh, n - snum),
			       KEY_SIZE);
			/* last parameter is del_par */
			internal_move_pointers_items(&dest_bi, &src_bi,
@@ -1008,7 +1008,7 @@ int balance_internal(struct tree_balance *tb, /* tree_balance structure
			/*  store the delimiting key for the next level */
			/* new_insert_key = (n + insert_item - snum)'th key in S[h] */
			memcpy(&new_insert_key,
			       B_N_PDELIM_KEY(tbSh, n + insert_num - snum),
			       internal_key(tbSh, n + insert_num - snum),
			       KEY_SIZE);
			/* last parameter is del_par */
			internal_move_pointers_items(&dest_bi, &src_bi,
Loading