diff options
author | Vernon Yang <vernon2gm@gmail.com> | 2022-12-21 14:00:58 +0800 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-01-18 17:12:47 -0800 |
commit | e11cb683b2ebc6699bc0ca200442f1b80a51553f (patch) | |
tree | 0d4b92a88d7dcc414cc08be4a8f28597cde36a62 /lib/maple_tree.c | |
parent | 46b345848261009477552d654cb2f65000c30e4d (diff) | |
download | lwn-e11cb683b2ebc6699bc0ca200442f1b80a51553f.tar.gz lwn-e11cb683b2ebc6699bc0ca200442f1b80a51553f.zip |
maple_tree: refine mab_calc_split function
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>
Diffstat (limited to 'lib/maple_tree.c')
-rw-r--r-- | lib/maple_tree.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d4554c11ec15..94f0053ec3e0 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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; } |