From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
liam.howlett@oracle.com, willy@infradead.org, surenb@google.com,
Sidhartha Kumar <sidhartha.kumar@oracle.com>
Subject: [PATCH v4 15/17] maple_tree: remove repeated sanity checks from write helper functions
Date: Wed, 14 Aug 2024 12:19:42 -0400 [thread overview]
Message-ID: <20240814161944.55347-16-sidhartha.kumar@oracle.com> (raw)
In-Reply-To: <20240814161944.55347-1-sidhartha.kumar@oracle.com>
These sanity checks are now redundant as they are already checked in
mas_wr_store_type(). We can remove them from mas_wr_append() and
mas_wr_node_store().
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
lib/maple_tree.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 5f79be184377..8c1a1a483395 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3816,11 +3816,6 @@ static inline bool mas_wr_node_store(struct ma_wr_state *wr_mas,
unsigned char copy_size, node_pivots = mt_pivots[wr_mas->type];
bool in_rcu = mt_in_rcu(mas->tree);
- /* Check if there is enough data. The room is enough. */
- if (!mte_is_root(mas->node) && (new_end < mt_min_slots[wr_mas->type]) &&
- !(mas->mas_flags & MA_STATE_BULK))
- return false;
-
if (mas->last == wr_mas->end_piv)
offset_end++; /* don't copy this offset */
else if (unlikely(wr_mas->r_max == ULONG_MAX))
@@ -4018,17 +4013,9 @@ static inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas)
static inline bool mas_wr_append(struct ma_wr_state *wr_mas,
unsigned char new_end)
{
- struct ma_state *mas;
+ struct ma_state *mas = wr_mas->mas;
void __rcu **slots;
- unsigned char end;
-
- mas = wr_mas->mas;
- if (mt_in_rcu(mas->tree))
- return false;
-
- end = mas->end;
- if (mas->offset != end)
- return false;
+ unsigned char end = mas->end;
if (new_end < mt_pivots[wr_mas->type]) {
wr_mas->pivots[new_end] = wr_mas->pivots[end];
--
2.46.0
next prev parent reply other threads:[~2024-08-14 16:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 16:19 [PATCH v4 00/17] Introduce a store type enum for the Maple tree Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 01/17] maple_tree: introduce store_type enum Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 02/17] maple_tree: introduce mas_wr_prealloc_setup() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 03/17] maple_tree: move up mas_wr_store_setup() and mas_wr_prealloc_setup() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 04/17] maple_tree: introduce mas_wr_store_type() Sidhartha Kumar
2024-09-25 2:04 ` Wei Yang
2024-09-25 19:33 ` Sid Kumar
2024-09-25 19:36 ` Sid Kumar
2024-09-25 22:59 ` Wei Yang
2024-08-14 16:19 ` [PATCH v4 05/17] maple_tree: remove mas_destroy() from mas_nomem() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 06/17] maple_tree: preallocate nodes in mas_erase() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 07/17] maple_tree: use mas_store_gfp() in mtree_store_range() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 08/17] maple_tree: print store type in mas_dump() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 09/17] maple_tree: use store type in mas_wr_store_entry() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 10/17] maple_tree: convert mas_insert() to preallocate nodes Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 11/17] maple_tree: simplify mas_commit_b_node() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 12/17] maple_tree: remove mas_wr_modify() Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 13/17] maple_tree: have mas_store() allocate nodes if needed Sidhartha Kumar
2024-08-14 16:19 ` [PATCH v4 14/17] maple_tree: remove node allocations from various write helper functions Sidhartha Kumar
2024-08-14 16:19 ` Sidhartha Kumar [this message]
2024-08-14 16:19 ` [PATCH v4 16/17] maple_tree: remove unneeded mas_wr_walk() in mas_store_prealloc() Sidhartha Kumar
2024-10-24 1:20 ` Wei Yang
2024-10-25 19:54 ` Sid Kumar
2024-10-25 23:58 ` Wei Yang
2024-10-29 15:46 ` Sid Kumar
2024-10-31 23:18 ` Wei Yang
2024-08-14 16:19 ` [PATCH v4 17/17] maple_tree: make write helper functions void Sidhartha Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240814161944.55347-16-sidhartha.kumar@oracle.com \
--to=sidhartha.kumar@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=liam.howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=surenb@google.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox