ANDROID: maple_tree: Move mas_wr_modify node size calculation to mas_wr_node_size()
Create a new function to get the size of the mas_wr_node_size() since it
will be used elsewhere soon.
Drop the incrementing of the node size if this is the left-most node.
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Link: d781921bc8
[surenb: due to the differences with upstream kernel where the node size
can be obtained using mas_wr_new_end() function, this patch is not
applicable upstream. The patch was obtained from the author's tree]
Bug: 274059236
Change-Id: I9f0b5238294d0842b4c2717437ed7288b17c7617
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
parent
b6734cb2ce
commit
ce9ebd83aa
1 changed files with 6 additions and 3 deletions
|
|
@ -4386,6 +4386,11 @@ static void mas_wr_bnode(struct ma_wr_state *wr_mas)
|
|||
mas_commit_b_node(wr_mas, &b_node, wr_mas->node_end);
|
||||
}
|
||||
|
||||
static inline unsigned char mas_wr_node_size(struct ma_wr_state *wr_mas)
|
||||
{
|
||||
return wr_mas->node_end - wr_mas->offset_end + wr_mas->mas->offset + 2;
|
||||
}
|
||||
|
||||
static inline void mas_wr_modify(struct ma_wr_state *wr_mas)
|
||||
{
|
||||
unsigned char node_slots;
|
||||
|
|
@ -4402,9 +4407,7 @@ static inline void mas_wr_modify(struct ma_wr_state *wr_mas)
|
|||
|
||||
/* Attempt to append */
|
||||
node_slots = mt_slots[wr_mas->type];
|
||||
node_size = wr_mas->node_end - wr_mas->offset_end + mas->offset + 2;
|
||||
if (mas->max == ULONG_MAX)
|
||||
node_size++;
|
||||
node_size = mas_wr_node_size(wr_mas);
|
||||
|
||||
/* slot and node store will not fit, go to the slow path */
|
||||
if (unlikely(node_size >= node_slots))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue