diff options
author | Jeff Mahoney <jeffm@suse.com> | 2014-04-23 10:00:53 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-05-07 13:01:39 -0400 |
commit | 8c480ea1940ffad74af3bb0db8885e413e6aee0a (patch) | |
tree | c96109910139445a26816e438a697964ab167e6b /fs/reiserfs | |
parent | 9d496552b95e957b919f9934672ea1af6c0f3c6d (diff) |
reiserfs: balance_leaf refactor pull out balance_leaf_finish_node_insert
This patch factors out a new balance_leaf_finish_node_insert from the code
in balance_leaf responsible for inserting new items into S[0]
It has not been reformatted yet.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/do_balan.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c index db189cbfdaba..1c4b45993c79 100644 --- a/fs/reiserfs/do_balan.c +++ b/fs/reiserfs/do_balan.c | |||
@@ -962,6 +962,26 @@ static void balance_leaf_new_nodes_paste(struct tree_balance *tb, | |||
962 | 962 | ||
963 | } | 963 | } |
964 | 964 | ||
965 | static void balance_leaf_finish_node_insert(struct tree_balance *tb, | ||
966 | struct item_head *ih, | ||
967 | const char *body) | ||
968 | { | ||
969 | struct buffer_head *tbS0 = PATH_PLAST_BUFFER(tb->tb_path); | ||
970 | struct buffer_info bi; | ||
971 | buffer_info_init_tbS0(tb, &bi); | ||
972 | leaf_insert_into_buf(&bi, tb->item_pos, ih, | ||
973 | body, tb->zeroes_num); | ||
974 | |||
975 | /* | ||
976 | * If we insert the first key | ||
977 | * change the delimiting key | ||
978 | */ | ||
979 | if (tb->item_pos == 0) { | ||
980 | if (tb->CFL[0]) /* can be 0 in reiserfsck */ | ||
981 | replace_key(tb, tb->CFL[0], tb->lkey[0], tbS0, 0); | ||
982 | } | ||
983 | } | ||
984 | |||
965 | /** | 985 | /** |
966 | * balance_leaf - reiserfs tree balancing algorithm | 986 | * balance_leaf - reiserfs tree balancing algorithm |
967 | * @tb: tree balance state | 987 | * @tb: tree balance state |
@@ -1136,15 +1156,7 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, | |||
1136 | 1156 | ||
1137 | switch (flag) { | 1157 | switch (flag) { |
1138 | case M_INSERT: /* insert item into S[0] */ | 1158 | case M_INSERT: /* insert item into S[0] */ |
1139 | buffer_info_init_tbS0(tb, &bi); | 1159 | balance_leaf_finish_node_insert(tb, ih, body); |
1140 | leaf_insert_into_buf(&bi, tb->item_pos, ih, | ||
1141 | body, tb->zeroes_num); | ||
1142 | |||
1143 | /* If we insert the first key change the delimiting key */ | ||
1144 | if (tb->item_pos == 0) { | ||
1145 | if (tb->CFL[0]) /* can be 0 in reiserfsck */ | ||
1146 | replace_key(tb, tb->CFL[0], tb->lkey[0], tbS0, 0); | ||
1147 | } | ||
1148 | break; | 1160 | break; |
1149 | 1161 | ||
1150 | case M_PASTE:{ /* append item in S[0] */ | 1162 | case M_PASTE:{ /* append item in S[0] */ |