From: Liam Howlett <liam.howlett@oracle.com>
To: Vernon Yang <vernon2gm@gmail.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/8] maple_tree: change return type of mas_commit_b_node()
Date: Tue, 20 Dec 2022 15:03:36 +0000 [thread overview]
Message-ID: <20221220150310.kfzx5paymtaepbxk@revolver> (raw)
In-Reply-To: <20221220142606.1698836-7-vernon2gm@gmail.com>
* Vernon Yang <vernon2gm@gmail.com> [221220 09:26]:
> The return value of mas_commit_b_node() function represents whether
> the submit b_node is successful, and can only be false and true, so
> the return value type is bool is more appropriate and for better
> readability.
>
> Signed-off-by: Vernon Yang <vernon2gm@gmail.com>
> ---
> lib/maple_tree.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index b3a215dd961e..e7dde4a1d6cb 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -3578,7 +3578,7 @@ static inline bool mas_reuse_node(struct ma_wr_state *wr_mas,
> * @b_node: The maple big node
> * @end: The end of the data.
> */
> -static inline int mas_commit_b_node(struct ma_wr_state *wr_mas,
> +static inline bool mas_commit_b_node(struct ma_wr_state *wr_mas,
> struct maple_big_node *b_node, unsigned char end)
mas_commit_b_node() can also return the ints from mas_split() and
mas_rebalance(). I'm fine with changing the return, but it seems odd to
only half-change it?
Initially I had a different intention for the return type of int, but it
seems the return isn't used at all from this function. We should
just change mas_commit_b_node(), mas_split(), and mas_rebalance() to
return type void if we're going to clean it up.
> {
> struct maple_node *node;
> @@ -3598,7 +3598,7 @@ static inline int mas_commit_b_node(struct ma_wr_state *wr_mas,
>
> mas_node_count(wr_mas->mas, 1);
> if (mas_is_err(wr_mas->mas))
> - return 0;
> + return false;
>
> node = mas_pop_node(wr_mas->mas);
> node->parent = mas_mn(wr_mas->mas)->parent;
> @@ -3607,7 +3607,7 @@ static inline int mas_commit_b_node(struct ma_wr_state *wr_mas,
> mas_replace(wr_mas->mas, false);
> reuse_node:
> mas_update_gap(wr_mas->mas);
> - return 1;
> + return true;
> }
>
> /*
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2022-12-20 15:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 14:25 [PATCH 1/8] maple_tree: remove extra space and blank line Vernon Yang
2022-12-20 14:26 ` [PATCH 2/8] maple_tree: remove extra return statement Vernon Yang
2022-12-20 14:26 ` [PATCH 3/8] maple_tree: use mt_node_max() instead of direct operations mt_max[] Vernon Yang
2022-12-20 14:26 ` [PATCH 4/8] maple_tree: use macro MA_ROOT_PARENT instead of number Vernon Yang
2022-12-20 14:26 ` [PATCH 5/8] maple_tree: remove the redundant code Vernon Yang
2022-12-20 14:26 ` [PATCH 6/8] maple_tree: change return type of mas_commit_b_node() Vernon Yang
2022-12-20 15:03 ` Liam Howlett [this message]
2022-12-21 5:14 ` Vernon Yang
2022-12-20 14:26 ` [PATCH 7/8] maple_tree: refine ma_state init from mas_start() Vernon Yang
2022-12-20 14:26 ` [PATCH 8/8] maple_tree: refine mab_calc_split function Vernon Yang
2022-12-20 15:05 ` Liam Howlett
2022-12-21 5:18 ` Vernon Yang
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=20221220150310.kfzx5paymtaepbxk@revolver \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vernon2gm@gmail.com \
/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