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/ibalance.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/ibalance.c')
-rw-r--r-- | fs/reiserfs/ibalance.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/reiserfs/ibalance.c b/fs/reiserfs/ibalance.c index e1978fd895f5..ae26a271da35 100644 --- a/fs/reiserfs/ibalance.c +++ b/fs/reiserfs/ibalance.c | |||
@@ -153,7 +153,7 @@ static void internal_insert_childs(struct buffer_info *cur_bi, | |||
153 | memcpy(dc, new_dc, DC_SIZE * count); | 153 | memcpy(dc, new_dc, DC_SIZE * count); |
154 | 154 | ||
155 | /* prepare space for count items */ | 155 | /* prepare space for count items */ |
156 | ih = B_N_PDELIM_KEY(cur, ((to == -1) ? 0 : to)); | 156 | ih = internal_key(cur, ((to == -1) ? 0 : to)); |
157 | 157 | ||
158 | memmove(ih + count, ih, | 158 | memmove(ih + count, ih, |
159 | (nr - to) * KEY_SIZE + (nr + 1 + count) * DC_SIZE); | 159 | (nr - to) * KEY_SIZE + (nr + 1 + count) * DC_SIZE); |
@@ -233,7 +233,7 @@ static void internal_delete_pointers_items(struct buffer_info *cur_bi, | |||
233 | dc = B_N_CHILD(cur, first_p); | 233 | dc = B_N_CHILD(cur, first_p); |
234 | 234 | ||
235 | memmove(dc, dc + del_num, (nr + 1 - first_p - del_num) * DC_SIZE); | 235 | memmove(dc, dc + del_num, (nr + 1 - first_p - del_num) * DC_SIZE); |
236 | key = B_N_PDELIM_KEY(cur, first_i); | 236 | key = internal_key(cur, first_i); |
237 | memmove(key, key + del_num, | 237 | memmove(key, key + del_num, |
238 | (nr - first_i - del_num) * KEY_SIZE + (nr + 1 - | 238 | (nr - first_i - del_num) * KEY_SIZE + (nr + 1 - |
239 | del_num) * DC_SIZE); | 239 | del_num) * DC_SIZE); |
@@ -330,13 +330,13 @@ static void internal_copy_pointers_items(struct buffer_info *dest_bi, | |||
330 | memcpy(dc, B_N_CHILD(src, src_order), DC_SIZE * cpy_num); | 330 | memcpy(dc, B_N_CHILD(src, src_order), DC_SIZE * cpy_num); |
331 | 331 | ||
332 | /* prepare space for cpy_num - 1 item headers */ | 332 | /* prepare space for cpy_num - 1 item headers */ |
333 | key = B_N_PDELIM_KEY(dest, dest_order); | 333 | key = internal_key(dest, dest_order); |
334 | memmove(key + cpy_num - 1, key, | 334 | memmove(key + cpy_num - 1, key, |
335 | KEY_SIZE * (nr_dest - dest_order) + DC_SIZE * (nr_dest + | 335 | KEY_SIZE * (nr_dest - dest_order) + DC_SIZE * (nr_dest + |
336 | cpy_num)); | 336 | cpy_num)); |
337 | 337 | ||
338 | /* insert headers */ | 338 | /* insert headers */ |
339 | memcpy(key, B_N_PDELIM_KEY(src, src_order), KEY_SIZE * (cpy_num - 1)); | 339 | memcpy(key, internal_key(src, src_order), KEY_SIZE * (cpy_num - 1)); |
340 | 340 | ||
341 | /* sizes, item number */ | 341 | /* sizes, item number */ |
342 | set_blkh_nr_item(blkh, blkh_nr_item(blkh) + (cpy_num - 1)); | 342 | 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 | |||
429 | nr = blkh_nr_item(blkh); | 429 | nr = blkh_nr_item(blkh); |
430 | 430 | ||
431 | /* prepare space for inserting key */ | 431 | /* prepare space for inserting key */ |
432 | key = B_N_PDELIM_KEY(dest, dest_position_before); | 432 | key = internal_key(dest, dest_position_before); |
433 | memmove(key + 1, key, | 433 | memmove(key + 1, key, |
434 | (nr - dest_position_before) * KEY_SIZE + (nr + 1) * DC_SIZE); | 434 | (nr - dest_position_before) * KEY_SIZE + (nr + 1) * DC_SIZE); |
435 | 435 | ||
436 | /* insert key */ | 436 | /* insert key */ |
437 | memcpy(key, B_N_PDELIM_KEY(src, src_position), KEY_SIZE); | 437 | memcpy(key, internal_key(src, src_position), KEY_SIZE); |
438 | 438 | ||
439 | /* Change dirt, free space, item number fields. */ | 439 | /* Change dirt, free space, item number fields. */ |
440 | 440 | ||
@@ -717,7 +717,7 @@ static void replace_lkey(struct tree_balance *tb, int h, struct item_head *key) | |||
717 | if (B_NR_ITEMS(PATH_H_PBUFFER(tb->tb_path, h)) == 0) | 717 | if (B_NR_ITEMS(PATH_H_PBUFFER(tb->tb_path, h)) == 0) |
718 | return; | 718 | return; |
719 | 719 | ||
720 | memcpy(B_N_PDELIM_KEY(tb->CFL[h], tb->lkey[h]), key, KEY_SIZE); | 720 | memcpy(internal_key(tb->CFL[h], tb->lkey[h]), key, KEY_SIZE); |
721 | 721 | ||
722 | do_balance_mark_internal_dirty(tb, tb->CFL[h], 0); | 722 | do_balance_mark_internal_dirty(tb, tb->CFL[h], 0); |
723 | } | 723 | } |
@@ -732,7 +732,7 @@ static void replace_rkey(struct tree_balance *tb, int h, struct item_head *key) | |||
732 | "R[h] can not be empty if it exists (item number=%d)", | 732 | "R[h] can not be empty if it exists (item number=%d)", |
733 | B_NR_ITEMS(tb->R[h])); | 733 | B_NR_ITEMS(tb->R[h])); |
734 | 734 | ||
735 | memcpy(B_N_PDELIM_KEY(tb->CFR[h], tb->rkey[h]), key, KEY_SIZE); | 735 | memcpy(internal_key(tb->CFR[h], tb->rkey[h]), key, KEY_SIZE); |
736 | 736 | ||
737 | do_balance_mark_internal_dirty(tb, tb->CFR[h], 0); | 737 | do_balance_mark_internal_dirty(tb, tb->CFR[h], 0); |
738 | } | 738 | } |
@@ -997,7 +997,7 @@ int balance_internal(struct tree_balance *tb, /* tree_balance structure | |||
997 | /* new items don't fall into S_new */ | 997 | /* new items don't fall into S_new */ |
998 | /* store the delimiting key for the next level */ | 998 | /* store the delimiting key for the next level */ |
999 | /* new_insert_key = (n - snum)'th key in S[h] */ | 999 | /* new_insert_key = (n - snum)'th key in S[h] */ |
1000 | memcpy(&new_insert_key, B_N_PDELIM_KEY(tbSh, n - snum), | 1000 | memcpy(&new_insert_key, internal_key(tbSh, n - snum), |
1001 | KEY_SIZE); | 1001 | KEY_SIZE); |
1002 | /* last parameter is del_par */ | 1002 | /* last parameter is del_par */ |
1003 | internal_move_pointers_items(&dest_bi, &src_bi, | 1003 | internal_move_pointers_items(&dest_bi, &src_bi, |
@@ -1008,7 +1008,7 @@ int balance_internal(struct tree_balance *tb, /* tree_balance structure | |||
1008 | /* store the delimiting key for the next level */ | 1008 | /* store the delimiting key for the next level */ |
1009 | /* new_insert_key = (n + insert_item - snum)'th key in S[h] */ | 1009 | /* new_insert_key = (n + insert_item - snum)'th key in S[h] */ |
1010 | memcpy(&new_insert_key, | 1010 | memcpy(&new_insert_key, |
1011 | B_N_PDELIM_KEY(tbSh, n + insert_num - snum), | 1011 | internal_key(tbSh, n + insert_num - snum), |
1012 | KEY_SIZE); | 1012 | KEY_SIZE); |
1013 | /* last parameter is del_par */ | 1013 | /* last parameter is del_par */ |
1014 | internal_move_pointers_items(&dest_bi, &src_bi, | 1014 | internal_move_pointers_items(&dest_bi, &src_bi, |