Message ID | 20241116014805.11547-4-richard.weiyang@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mas_anode_descend() related cleanup | expand |
* Wei Yang <richard.weiyang@gmail.com> [241115 20:48]: > When mas_anode_descend() not find gap, it sets -EBUSY instead of setting > offset to MAPLE_NODE_SLOTS. This is for mas_start(), which I think is not necessary anymore. > > Signed-off-by: Wei Yang <richard.weiyang@gmail.com> > CC: Liam R. Howlett <Liam.Howlett@Oracle.com> > CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> > CC: Sidhartha Kumar <sidhartha.kumar@oracle.com> > --- > lib/maple_tree.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > index ab235d0194f7..b67dae356182 100644 > --- a/lib/maple_tree.c > +++ b/lib/maple_tree.c > @@ -5011,8 +5011,8 @@ static inline void mas_awalk(struct ma_state *mas, unsigned long size) > * There are 4 options: > * go to child (descend) > * go back to parent (ascend) > - * no gap found. (return, slot == MAPLE_NODE_SLOTS) > - * found the gap. (return, slot != MAPLE_NODE_SLOTS) > + * no gap found. (return, error == -EBUSY) > + * found the gap. (return) > */ > while (!mas_is_err(mas) && !mas_anode_descend(mas, size)) { > if (last == mas->node) > @@ -5097,9 +5097,6 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, > return xa_err(mas->node); > > offset = mas->offset; > - if (unlikely(offset == MAPLE_NODE_SLOTS)) > - return -EBUSY; > - > node = mas_mn(mas); > mt = mte_node_type(mas->node); > pivots = ma_pivots(node, mt); > -- > 2.34.1 >
On Mon, Nov 18, 2024 at 03:50:49PM -0500, Liam R. Howlett wrote: >* Wei Yang <richard.weiyang@gmail.com> [241115 20:48]: >> When mas_anode_descend() not find gap, it sets -EBUSY instead of setting >> offset to MAPLE_NODE_SLOTS. > >This is for mas_start(), which I think is not necessary anymore. You mean mas_start() would set offset to MAPLE_NODE_SLOTS on ma_none and ma_root? Thanks for the information, I didn't realize this. These two cases are handled by mas_sparse_area().
* Wei Yang <richard.weiyang@gmail.com> [241118 21:15]: > On Mon, Nov 18, 2024 at 03:50:49PM -0500, Liam R. Howlett wrote: > >* Wei Yang <richard.weiyang@gmail.com> [241115 20:48]: > >> When mas_anode_descend() not find gap, it sets -EBUSY instead of setting > >> offset to MAPLE_NODE_SLOTS. > > > >This is for mas_start(), which I think is not necessary anymore. > > You mean mas_start() would set offset to MAPLE_NODE_SLOTS on ma_none and > ma_root? > > Thanks for the information, I didn't realize this. > > These two cases are handled by mas_sparse_area(). Yeah, I'm not sure that needing this lived to the released code.
On Tue, Nov 19, 2024 at 08:58:06AM -0500, Liam R. Howlett wrote: >* Wei Yang <richard.weiyang@gmail.com> [241118 21:15]: >> On Mon, Nov 18, 2024 at 03:50:49PM -0500, Liam R. Howlett wrote: >> >* Wei Yang <richard.weiyang@gmail.com> [241115 20:48]: >> >> When mas_anode_descend() not find gap, it sets -EBUSY instead of setting >> >> offset to MAPLE_NODE_SLOTS. >> > >> >This is for mas_start(), which I think is not necessary anymore. >> >> You mean mas_start() would set offset to MAPLE_NODE_SLOTS on ma_none and >> ma_root? >> >> Thanks for the information, I didn't realize this. >> >> These two cases are handled by mas_sparse_area(). > >Yeah, I'm not sure that needing this lived to the released code. I don't get you clearly. What should I do next?
* Wei Yang <richard.weiyang@gmail.com> [241121 02:15]: > On Tue, Nov 19, 2024 at 08:58:06AM -0500, Liam R. Howlett wrote: > >* Wei Yang <richard.weiyang@gmail.com> [241118 21:15]: > >> On Mon, Nov 18, 2024 at 03:50:49PM -0500, Liam R. Howlett wrote: > >> >* Wei Yang <richard.weiyang@gmail.com> [241115 20:48]: > >> >> When mas_anode_descend() not find gap, it sets -EBUSY instead of setting > >> >> offset to MAPLE_NODE_SLOTS. > >> > > >> >This is for mas_start(), which I think is not necessary anymore. > >> > >> You mean mas_start() would set offset to MAPLE_NODE_SLOTS on ma_none and > >> ma_root? > >> > >> Thanks for the information, I didn't realize this. > >> > >> These two cases are handled by mas_sparse_area(). > > > >Yeah, I'm not sure that needing this lived to the released code. > > I don't get you clearly. > > What should I do next? This looks good. Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ab235d0194f7..b67dae356182 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5011,8 +5011,8 @@ static inline void mas_awalk(struct ma_state *mas, unsigned long size) * There are 4 options: * go to child (descend) * go back to parent (ascend) - * no gap found. (return, slot == MAPLE_NODE_SLOTS) - * found the gap. (return, slot != MAPLE_NODE_SLOTS) + * no gap found. (return, error == -EBUSY) + * found the gap. (return) */ while (!mas_is_err(mas) && !mas_anode_descend(mas, size)) { if (last == mas->node) @@ -5097,9 +5097,6 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, return xa_err(mas->node); offset = mas->offset; - if (unlikely(offset == MAPLE_NODE_SLOTS)) - return -EBUSY; - node = mas_mn(mas); mt = mte_node_type(mas->node); pivots = ma_pivots(node, mt);
When mas_anode_descend() not find gap, it sets -EBUSY instead of setting offset to MAPLE_NODE_SLOTS. Signed-off-by: Wei Yang <richard.weiyang@gmail.com> CC: Liam R. Howlett <Liam.Howlett@Oracle.com> CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> CC: Sidhartha Kumar <sidhartha.kumar@oracle.com> --- lib/maple_tree.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)