Message ID | 20240924123954.18933-3-richard.weiyang@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | cleanup maple_alloc related functions | expand |
* Wei Yang <richard.weiyang@gmail.com> [240924 08:41]: > If it jumps to nomem_one, the total allocated number is not changed. So > we don't need to adjust it. > > For the nomem_bulk case, we know there is a valid mas->alloc. So we > don't need to do the check. > > Signed-off-by: Wei Yang <richard.weiyang@gmail.com> > CC: Liam R. Howlett <Liam.Howlett@Oracle.com> > CC: Sidhartha Kumar <sidhartha.kumar@oracle.com> Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com> > --- > lib/maple_tree.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > index 75be2c81f0e2..c1fb67540cc9 100644 > --- a/lib/maple_tree.c > +++ b/lib/maple_tree.c > @@ -1279,10 +1279,9 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp) > nomem_bulk: > /* Clean up potential freed allocations on bulk failure */ > memset(slots, 0, max_req * sizeof(unsigned long)); > + mas->alloc->total = allocated; > nomem_one: > mas_set_alloc_req(mas, requested); > - if (mas->alloc && !(((unsigned long)mas->alloc & 0x1))) > - mas->alloc->total = allocated; > mas_set_err(mas, -ENOMEM); > } > > -- > 2.34.1 >
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 75be2c81f0e2..c1fb67540cc9 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1279,10 +1279,9 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp) nomem_bulk: /* Clean up potential freed allocations on bulk failure */ memset(slots, 0, max_req * sizeof(unsigned long)); + mas->alloc->total = allocated; nomem_one: mas_set_alloc_req(mas, requested); - if (mas->alloc && !(((unsigned long)mas->alloc & 0x1))) - mas->alloc->total = allocated; mas_set_err(mas, -ENOMEM); }
If it jumps to nomem_one, the total allocated number is not changed. So we don't need to adjust it. For the nomem_bulk case, we know there is a valid mas->alloc. So we don't need to do the check. Signed-off-by: Wei Yang <richard.weiyang@gmail.com> CC: Liam R. Howlett <Liam.Howlett@Oracle.com> CC: Sidhartha Kumar <sidhartha.kumar@oracle.com> --- lib/maple_tree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)