diff options
author | Jeff Mahoney <jeffm@suse.com> | 2014-04-23 10:00:35 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-05-06 16:51:44 -0400 |
commit | 4cf5f7addf18ecae2ea49b11944976cbd26d5281 (patch) | |
tree | 52aa9ebf68e7951bacbdc708f1d19467736187bc /fs/reiserfs/do_balan.c | |
parent | 797d9016ceca69879bb273218810fa0beef46aac (diff) |
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: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs/do_balan.c')
-rw-r--r-- | fs/reiserfs/do_balan.c | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c index 9a3c68cf6026..80b2b1b37169 100644 --- a/fs/reiserfs/do_balan.c +++ b/fs/reiserfs/do_balan.c | |||
@@ -114,7 +114,7 @@ static int balance_leaf_when_delete(struct tree_balance *tb, int flag) | |||
114 | RFALSE(!tb->blknum[0] && !PATH_H_PPARENT(tb->tb_path, 0), | 114 | RFALSE(!tb->blknum[0] && !PATH_H_PPARENT(tb->tb_path, 0), |
115 | "PAP-12010: tree can not be empty"); | 115 | "PAP-12010: tree can not be empty"); |
116 | 116 | ||
117 | ih = B_N_PITEM_HEAD(tbS0, item_pos); | 117 | ih = item_head(tbS0, item_pos); |
118 | buffer_info_init_tbS0(tb, &bi); | 118 | buffer_info_init_tbS0(tb, &bi); |
119 | 119 | ||
120 | /* Delete or truncate the item */ | 120 | /* Delete or truncate the item */ |
@@ -312,7 +312,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
312 | /* for indirect item pos_in_item is measured in unformatted node | 312 | /* for indirect item pos_in_item is measured in unformatted node |
313 | pointers. Recalculate to bytes */ | 313 | pointers. Recalculate to bytes */ |
314 | if (flag != M_INSERT | 314 | if (flag != M_INSERT |
315 | && is_indirect_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) | 315 | && is_indirect_le_ih(item_head(tbS0, item_pos))) |
316 | pos_in_item *= UNFM_P_SIZE; | 316 | pos_in_item *= UNFM_P_SIZE; |
317 | 317 | ||
318 | if (tb->lnum[0] > 0) { | 318 | if (tb->lnum[0] > 0) { |
@@ -378,7 +378,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
378 | 378 | ||
379 | if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) { | 379 | if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) { |
380 | /* we must shift the part of the appended item */ | 380 | /* we must shift the part of the appended item */ |
381 | if (is_direntry_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) { | 381 | if (is_direntry_le_ih(item_head(tbS0, item_pos))) { |
382 | 382 | ||
383 | RFALSE(zeros_num, | 383 | RFALSE(zeros_num, |
384 | "PAP-12090: invalid parameter in case of a directory"); | 384 | "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 | |||
391 | /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 entries from given directory item */ | 391 | /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 entries from given directory item */ |
392 | ret_val = leaf_shift_left(tb, tb->lnum[0], tb->lbytes-1); | 392 | ret_val = leaf_shift_left(tb, tb->lnum[0], tb->lbytes-1); |
393 | if (ret_val && !item_pos) { | 393 | if (ret_val && !item_pos) { |
394 | pasted = B_N_PITEM_HEAD(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1); | 394 | pasted = item_head(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1); |
395 | l_pos_in_item += I_ENTRY_COUNT(pasted) - (tb->lbytes -1); | 395 | l_pos_in_item += ih_entry_count(pasted) - (tb->lbytes -1); |
396 | } | 396 | } |
397 | 397 | ||
398 | /* Append given directory entry to directory item */ | 398 | /* 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 | |||
418 | } else { | 418 | } else { |
419 | /* regular object */ | 419 | /* regular object */ |
420 | RFALSE(tb->lbytes <= 0, "PAP-12095: there is nothing to shift to L[0]. lbytes=%d", tb->lbytes); | 420 | RFALSE(tb->lbytes <= 0, "PAP-12095: there is nothing to shift to L[0]. lbytes=%d", tb->lbytes); |
421 | RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)), | 421 | RFALSE(pos_in_item != ih_item_len(item_head(tbS0, item_pos)), |
422 | "PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d", | 422 | "PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d", |
423 | ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),pos_in_item); | 423 | ih_item_len(item_head(tbS0, item_pos)),pos_in_item); |
424 | 424 | ||
425 | if (tb->lbytes >= pos_in_item) { | 425 | if (tb->lbytes >= pos_in_item) { |
426 | /* appended item will be in L[0] in whole */ | 426 | /* 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 | |||
436 | "PAP-12105: there is nothing to paste into L[0]. insert_size=%d", | 436 | "PAP-12105: there is nothing to paste into L[0]. insert_size=%d", |
437 | tb->insert_size[0]); | 437 | tb->insert_size[0]); |
438 | ret_val = leaf_shift_left(tb, tb->lnum[0], ih_item_len | 438 | ret_val = leaf_shift_left(tb, tb->lnum[0], ih_item_len |
439 | (B_N_PITEM_HEAD(tbS0, item_pos))); | 439 | (item_head(tbS0, item_pos))); |
440 | /* Append to body of item in L[0] */ | 440 | /* Append to body of item in L[0] */ |
441 | buffer_info_init_left(tb, &bi); | 441 | buffer_info_init_left(tb, &bi); |
442 | leaf_paste_in_buffer | 442 | leaf_paste_in_buffer |
443 | (&bi, n + item_pos - ret_val, ih_item_len | 443 | (&bi, n + item_pos - ret_val, ih_item_len |
444 | (B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val)), | 444 | (item_head(tb->L[0], n + item_pos - ret_val)), |
445 | l_n, body, | 445 | l_n, body, |
446 | zeros_num > l_n ? l_n : zeros_num); | 446 | zeros_num > l_n ? l_n : zeros_num); |
447 | /* 0-th item in S0 can be only of DIRECT type when l_n != 0 */ | 447 | /* 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 | |||
449 | int version; | 449 | int version; |
450 | int temp_l = l_n; | 450 | int temp_l = l_n; |
451 | 451 | ||
452 | RFALSE(ih_item_len(B_N_PITEM_HEAD(tbS0, 0)), | 452 | RFALSE(ih_item_len(item_head(tbS0, 0)), |
453 | "PAP-12106: item length must be 0"); | 453 | "PAP-12106: item length must be 0"); |
454 | RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY | 454 | RFALSE(comp_short_le_keys(leaf_key(tbS0, 0), leaf_key |
455 | (tb->L[0], n + item_pos - ret_val)), | 455 | (tb->L[0], n + item_pos - ret_val)), |
456 | "PAP-12107: items must be of the same file"); | 456 | "PAP-12107: items must be of the same file"); |
457 | if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val))) { | 457 | if (is_indirect_le_ih(item_head(tb->L[0], n + item_pos - ret_val))) { |
458 | temp_l = l_n << (tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT); | 458 | temp_l = l_n << (tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT); |
459 | } | 459 | } |
460 | /* update key of first item in S0 */ | 460 | /* update key of first item in S0 */ |
461 | version = ih_version(B_N_PITEM_HEAD(tbS0, 0)); | 461 | version = ih_version(item_head(tbS0, 0)); |
462 | set_le_key_k_offset(version, B_N_PKEY(tbS0, 0), | 462 | set_le_key_k_offset(version, leaf_key(tbS0, 0), |
463 | le_key_k_offset(version,B_N_PKEY(tbS0, 0)) + temp_l); | 463 | le_key_k_offset(version,leaf_key(tbS0, 0)) + temp_l); |
464 | /* update left delimiting key */ | 464 | /* update left delimiting key */ |
465 | set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), | 465 | set_le_key_k_offset(version, internal_key(tb->CFL[0], tb->lkey[0]), |
466 | le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0])) + temp_l); | 466 | le_key_k_offset(version, internal_key(tb->CFL[0], tb->lkey[0])) + temp_l); |
467 | } | 467 | } |
468 | 468 | ||
469 | /* Calculate new body, position in item and insert_size[0] */ | 469 | /* 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 | |||
474 | zeros_num -= l_n; | 474 | zeros_num -= l_n; |
475 | pos_in_item = 0; | 475 | pos_in_item = 0; |
476 | 476 | ||
477 | RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1)) | 477 | RFALSE(comp_short_le_keys(leaf_key(tbS0, 0), leaf_key(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1)) |
478 | || !op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size) | 478 | || !op_is_left_mergeable(leaf_key(tbS0, 0), tbS0->b_size) |
479 | || !op_is_left_mergeable(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), tbS0->b_size), | 479 | || !op_is_left_mergeable(internal_key(tb->CFL[0], tb->lkey[0]), tbS0->b_size), |
480 | "PAP-12120: item must be merge-able with left neighboring item"); | 480 | "PAP-12120: item must be merge-able with left neighboring item"); |
481 | } else { /* only part of the appended item will be in L[0] */ | 481 | } else { /* only part of the appended item will be in L[0] */ |
482 | 482 | ||
@@ -493,9 +493,9 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
493 | 493 | ||
494 | struct item_head *pasted; | 494 | struct item_head *pasted; |
495 | 495 | ||
496 | 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 */ | 496 | 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 */ |
497 | /* then increment pos_in_item by the size of the last item in L[0] */ | 497 | /* then increment pos_in_item by the size of the last item in L[0] */ |
498 | pasted = B_N_PITEM_HEAD(tb->L[0], n - 1); | 498 | pasted = item_head(tb->L[0], n - 1); |
499 | if (is_direntry_le_ih(pasted)) | 499 | if (is_direntry_le_ih(pasted)) |
500 | pos_in_item += ih_entry_count(pasted); | 500 | pos_in_item += ih_entry_count(pasted); |
501 | else | 501 | else |
@@ -512,7 +512,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
512 | body, zeros_num); | 512 | body, zeros_num); |
513 | 513 | ||
514 | /* if appended item is directory, paste entry */ | 514 | /* if appended item is directory, paste entry */ |
515 | pasted = B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val); | 515 | pasted = item_head(tb->L[0], n + item_pos - ret_val); |
516 | if (is_direntry_le_ih(pasted)) | 516 | if (is_direntry_le_ih(pasted)) |
517 | leaf_paste_entries(&bi, n + item_pos - ret_val, | 517 | leaf_paste_entries(&bi, n + item_pos - ret_val, |
518 | pos_in_item, 1, | 518 | pos_in_item, 1, |
@@ -617,12 +617,12 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
617 | 617 | ||
618 | if (n - tb->rnum[0] <= item_pos) { /* pasted item or part of it falls to R[0] */ | 618 | if (n - tb->rnum[0] <= item_pos) { /* pasted item or part of it falls to R[0] */ |
619 | if (item_pos == n - tb->rnum[0] && tb->rbytes != -1) { /* we must shift the part of the appended item */ | 619 | if (item_pos == n - tb->rnum[0] && tb->rbytes != -1) { /* we must shift the part of the appended item */ |
620 | if (is_direntry_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) { /* we append to directory item */ | 620 | if (is_direntry_le_ih(item_head(tbS0, item_pos))) { /* we append to directory item */ |
621 | int entry_count; | 621 | int entry_count; |
622 | 622 | ||
623 | RFALSE(zeros_num, | 623 | RFALSE(zeros_num, |
624 | "PAP-12145: invalid parameter in case of a directory"); | 624 | "PAP-12145: invalid parameter in case of a directory"); |
625 | entry_count = I_ENTRY_COUNT(B_N_PITEM_HEAD | 625 | entry_count = ih_entry_count(item_head |
626 | (tbS0, item_pos)); | 626 | (tbS0, item_pos)); |
627 | if (entry_count - tb->rbytes < | 627 | if (entry_count - tb->rbytes < |
628 | pos_in_item) | 628 | pos_in_item) |
@@ -665,10 +665,10 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
665 | n_shift = 0; | 665 | n_shift = 0; |
666 | 666 | ||
667 | RFALSE(pos_in_item != ih_item_len | 667 | RFALSE(pos_in_item != ih_item_len |
668 | (B_N_PITEM_HEAD(tbS0, item_pos)), | 668 | (item_head(tbS0, item_pos)), |
669 | "PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d", | 669 | "PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d", |
670 | pos_in_item, ih_item_len | 670 | pos_in_item, ih_item_len |
671 | (B_N_PITEM_HEAD(tbS0, item_pos))); | 671 | (item_head(tbS0, item_pos))); |
672 | 672 | ||
673 | leaf_shift_right(tb, tb->rnum[0], n_shift); | 673 | leaf_shift_right(tb, tb->rnum[0], n_shift); |
674 | /* Calculate number of bytes which must remain in body after appending to R[0] */ | 674 | /* 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 | |||
679 | int version; | 679 | int version; |
680 | unsigned long temp_rem = n_rem; | 680 | unsigned long temp_rem = n_rem; |
681 | 681 | ||
682 | version = ih_version(B_N_PITEM_HEAD(tb->R[0], 0)); | 682 | version = ih_version(item_head(tb->R[0], 0)); |
683 | if (is_indirect_le_key(version, B_N_PKEY(tb->R[0], 0))) { | 683 | if (is_indirect_le_key(version, leaf_key(tb->R[0], 0))) { |
684 | temp_rem = n_rem << (tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT); | 684 | temp_rem = n_rem << (tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT); |
685 | } | 685 | } |
686 | set_le_key_k_offset(version, B_N_PKEY(tb->R[0], 0), | 686 | set_le_key_k_offset(version, leaf_key(tb->R[0], 0), |
687 | le_key_k_offset(version, B_N_PKEY(tb->R[0], 0)) + temp_rem); | 687 | le_key_k_offset(version, leaf_key(tb->R[0], 0)) + temp_rem); |
688 | set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]), | 688 | set_le_key_k_offset(version, internal_key(tb->CFR[0], tb->rkey[0]), |
689 | le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])) + temp_rem); | 689 | le_key_k_offset(version, internal_key(tb->CFR[0], tb->rkey[0])) + temp_rem); |
690 | } | 690 | } |
691 | /* k_offset (B_N_PKEY(tb->R[0],0)) += n_rem; | 691 | /* k_offset (leaf_key(tb->R[0],0)) += n_rem; |
692 | k_offset (B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0])) += n_rem;*/ | 692 | k_offset (internal_key(tb->CFR[0],tb->rkey[0])) += n_rem;*/ |
693 | do_balance_mark_internal_dirty(tb, tb->CFR[0], 0); | 693 | do_balance_mark_internal_dirty(tb, tb->CFR[0], 0); |
694 | 694 | ||
695 | /* Append part of body into R[0] */ | 695 | /* 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 | |||
707 | tb->insert_size[0] - n_rem, | 707 | tb->insert_size[0] - n_rem, |
708 | r_body, r_zeros_number); | 708 | r_body, r_zeros_number); |
709 | 709 | ||
710 | if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->R[0], 0))) { | 710 | if (is_indirect_le_ih(item_head(tb->R[0], 0))) { |
711 | #if 0 | 711 | #if 0 |
712 | RFALSE(n_rem, | 712 | RFALSE(n_rem, |
713 | "PAP-12160: paste more than one unformatted node pointer"); | 713 | "PAP-12160: paste more than one unformatted node pointer"); |
714 | #endif | 714 | #endif |
715 | set_ih_free_space(B_N_PITEM_HEAD(tb->R[0], 0), 0); | 715 | set_ih_free_space(item_head(tb->R[0], 0), 0); |
716 | } | 716 | } |
717 | tb->insert_size[0] = n_rem; | 717 | tb->insert_size[0] = n_rem; |
718 | if (!n_rem) | 718 | if (!n_rem) |
@@ -731,7 +731,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
731 | } | 731 | } |
732 | 732 | ||
733 | /* paste new entry, if item is directory item */ | 733 | /* paste new entry, if item is directory item */ |
734 | pasted = B_N_PITEM_HEAD(tb->R[0], item_pos - n + tb->rnum[0]); | 734 | pasted = item_head(tb->R[0], item_pos - n + tb->rnum[0]); |
735 | if (is_direntry_le_ih(pasted) && pos_in_item >= 0) { | 735 | if (is_direntry_le_ih(pasted) && pos_in_item >= 0) { |
736 | leaf_paste_entries(&bi, item_pos - n + tb->rnum[0], | 736 | leaf_paste_entries(&bi, item_pos - n + tb->rnum[0], |
737 | pos_in_item, 1, | 737 | pos_in_item, 1, |
@@ -784,8 +784,8 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
784 | if (!tb->CFR[0]) | 784 | if (!tb->CFR[0]) |
785 | reiserfs_panic(tb->tb_sb, "vs-12195", | 785 | reiserfs_panic(tb->tb_sb, "vs-12195", |
786 | "CFR not initialized"); | 786 | "CFR not initialized"); |
787 | copy_key(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), | 787 | copy_key(internal_key(tb->CFL[0], tb->lkey[0]), |
788 | B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])); | 788 | internal_key(tb->CFR[0], tb->rkey[0])); |
789 | do_balance_mark_internal_dirty(tb, tb->CFL[0], 0); | 789 | do_balance_mark_internal_dirty(tb, tb->CFL[0], 0); |
790 | } | 790 | } |
791 | 791 | ||
@@ -886,7 +886,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
886 | 886 | ||
887 | RFALSE(ih, "PAP-12210: ih must be 0"); | 887 | RFALSE(ih, "PAP-12210: ih must be 0"); |
888 | 888 | ||
889 | aux_ih = B_N_PITEM_HEAD(tbS0, item_pos); | 889 | aux_ih = item_head(tbS0, item_pos); |
890 | if (is_direntry_le_ih(aux_ih)) { | 890 | if (is_direntry_le_ih(aux_ih)) { |
891 | /* we append to directory item */ | 891 | /* we append to directory item */ |
892 | 892 | ||
@@ -922,7 +922,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
922 | int n_shift, n_rem, r_zeros_number; | 922 | int n_shift, n_rem, r_zeros_number; |
923 | const char *r_body; | 923 | const char *r_body; |
924 | 924 | ||
925 | RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)) || tb->insert_size[0] <= 0, | 925 | RFALSE(pos_in_item != ih_item_len(item_head(tbS0, item_pos)) || tb->insert_size[0] <= 0, |
926 | "PAP-12225: item too short or insert_size <= 0"); | 926 | "PAP-12225: item too short or insert_size <= 0"); |
927 | 927 | ||
928 | /* Calculate number of bytes which must be shifted from appended item */ | 928 | /* 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 | |||
952 | { | 952 | { |
953 | struct item_head *tmp; | 953 | struct item_head *tmp; |
954 | 954 | ||
955 | tmp = B_N_PITEM_HEAD(S_new[i], 0); | 955 | tmp = item_head(S_new[i], 0); |
956 | if (is_indirect_le_ih | 956 | if (is_indirect_le_ih |
957 | (tmp)) { | 957 | (tmp)) { |
958 | set_ih_free_space(tmp, 0); | 958 | set_ih_free_space(tmp, 0); |
@@ -973,7 +973,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
973 | struct item_head *pasted; | 973 | struct item_head *pasted; |
974 | 974 | ||
975 | #ifdef CONFIG_REISERFS_CHECK | 975 | #ifdef CONFIG_REISERFS_CHECK |
976 | struct item_head *ih_check = B_N_PITEM_HEAD(tbS0, item_pos); | 976 | struct item_head *ih_check = item_head(tbS0, item_pos); |
977 | 977 | ||
978 | if (!is_direntry_le_ih(ih_check) | 978 | if (!is_direntry_le_ih(ih_check) |
979 | && (pos_in_item != ih_item_len(ih_check) | 979 | && (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 | |||
1002 | tb->insert_size[0], | 1002 | tb->insert_size[0], |
1003 | body, zeros_num); | 1003 | body, zeros_num); |
1004 | 1004 | ||
1005 | pasted = B_N_PITEM_HEAD(S_new[i], item_pos - n + snum[i]); | 1005 | pasted = item_head(S_new[i], item_pos - n + snum[i]); |
1006 | if (is_direntry_le_ih(pasted)) { | 1006 | if (is_direntry_le_ih(pasted)) { |
1007 | leaf_paste_entries(&bi, | 1007 | leaf_paste_entries(&bi, |
1008 | item_pos - n + snum[i], | 1008 | item_pos - n + snum[i], |
@@ -1032,7 +1032,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
1032 | (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag); | 1032 | (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag); |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | memcpy(insert_key + i, B_N_PKEY(S_new[i], 0), KEY_SIZE); | 1035 | memcpy(insert_key + i, leaf_key(S_new[i], 0), KEY_SIZE); |
1036 | insert_ptr[i] = S_new[i]; | 1036 | insert_ptr[i] = S_new[i]; |
1037 | 1037 | ||
1038 | RFALSE(!buffer_journaled(S_new[i]) | 1038 | RFALSE(!buffer_journaled(S_new[i]) |
@@ -1061,7 +1061,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h | |||
1061 | case M_PASTE:{ /* append item in S[0] */ | 1061 | case M_PASTE:{ /* append item in S[0] */ |
1062 | struct item_head *pasted; | 1062 | struct item_head *pasted; |
1063 | 1063 | ||
1064 | pasted = B_N_PITEM_HEAD(tbS0, item_pos); | 1064 | pasted = item_head(tbS0, item_pos); |
1065 | /* when directory, may be new entry already pasted */ | 1065 | /* when directory, may be new entry already pasted */ |
1066 | if (is_direntry_le_ih(pasted)) { | 1066 | if (is_direntry_le_ih(pasted)) { |
1067 | if (pos_in_item >= 0 && pos_in_item <= ih_entry_count(pasted)) { | 1067 | 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, | |||
1246 | 1246 | ||
1247 | if (B_IS_ITEMS_LEVEL(src)) | 1247 | if (B_IS_ITEMS_LEVEL(src)) |
1248 | /* source buffer contains leaf node */ | 1248 | /* source buffer contains leaf node */ |
1249 | memcpy(B_N_PDELIM_KEY(dest, n_dest), B_N_PITEM_HEAD(src, n_src), | 1249 | memcpy(internal_key(dest, n_dest), item_head(src, n_src), |
1250 | KEY_SIZE); | 1250 | KEY_SIZE); |
1251 | else | 1251 | else |
1252 | memcpy(B_N_PDELIM_KEY(dest, n_dest), B_N_PDELIM_KEY(src, n_src), | 1252 | memcpy(internal_key(dest, n_dest), internal_key(src, n_src), |
1253 | KEY_SIZE); | 1253 | KEY_SIZE); |
1254 | 1254 | ||
1255 | do_balance_mark_internal_dirty(tb, dest, 0); | 1255 | do_balance_mark_internal_dirty(tb, dest, 0); |