]> www.infradead.org Git - users/jedix/linux-maple.git/commit
maple_tree: refactor mas_wr_store_type()
authorSidhartha Kumar <sidhartha.kumar@oracle.com>
Fri, 11 Oct 2024 21:44:51 +0000 (17:44 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:29:06 +0000 (21:29 -0700)
commit712e052323b99dc45f79855d7bde32c1109c2939
tree2f85046837d7fff92ad91fdfc96cbda73a8a9bae
parent89277f49e4f9363c50f1eb5d738d74233e2fd078
maple_tree: refactor mas_wr_store_type()

In mas_wr_store_type(), we check if new_end < mt_slots[wr_mas->type].  If
this check fails, we know that ,after this, new_end is >= mt_min_slots.
Checking this again when we detect a wr_node_store later in the function
is reduntant.  Because this check is part of an OR statement, the
statement will always evaluate to true, therefore we can just get rid of
it.

We also refactor mas_wr_store_type() to return the store type rather than
set it directly as it greatly cleans up the function.

Link: https://lkml.kernel.org/r/20241011214451.7286-2-sidhartha.kumar@oracle.com
Signed-off-by: Sidhartha <sidhartha.kumar@oracle.com>
Suggested-by: Liam Howlett <liam.howlett@oracle.com>
Suggested-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Liam Howlett <liam.howlett@oracle.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c