Skip to content

Commit

Permalink
maple_tree: refine mab_calc_split function
Browse files Browse the repository at this point in the history
Invert the conditional judgment of the mid_split, to focus the return
statement in the last statement, which is easier to understand and for
better readability.

Link: https://lkml.kernel.org/r/20221221060058.609003-8-vernon2gm@gmail.com
Signed-off-by: Vernon Yang <vernon2gm@gmail.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Vernon Yang authored and Andrew Morton committed Jan 19, 2023
1 parent 46b3458 commit e11cb68
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/maple_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1882,10 +1882,9 @@ static inline int mab_calc_split(struct ma_state *mas,

/* Avoid ending a node on a NULL entry */
split = mab_no_null_split(bn, split, slot_count);
if (!(*mid_split))
return split;

*mid_split = mab_no_null_split(bn, *mid_split, slot_count);
if (unlikely(*mid_split))
*mid_split = mab_no_null_split(bn, *mid_split, slot_count);

return split;
}
Expand Down

0 comments on commit e11cb68

Please sign in to comment.