From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABCF9C4332F for ; Wed, 21 Dec 2022 05:14:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED7EC8E0005; Wed, 21 Dec 2022 00:14:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E88C68E0001; Wed, 21 Dec 2022 00:14:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4FC38E0005; Wed, 21 Dec 2022 00:14:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C2DD88E0001 for ; Wed, 21 Dec 2022 00:14:56 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6ABA91407F9 for ; Wed, 21 Dec 2022 05:14:56 +0000 (UTC) X-FDA: 80265148992.14.C5B1B8D Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf20.hostedemail.com (Postfix) with ESMTP id C07DD1C0016 for ; Wed, 21 Dec 2022 05:14:54 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=M1Oddl2g; spf=pass (imf20.hostedemail.com: domain of vernon2gm@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=vernon2gm@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671599694; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=58KPHzr5CDwAEkwIK5uh0Ypn+WKmBYyNXwDDK5i4gXQ=; b=NtYEyAMG12v9IFfhTVcxUQZOQzpvSgstCtu1++SgpeOY6+w0Qt5wqU6Py1uh/RaK3+pkUC Z5SIYn5L7WRYW0tYz8PxMYj6OR7c3rNgQlMulU5j7dU+C3DWLiS85aLQOJBzG101/oJebP 8Wh45mvT2YrzN7nrH3+QYHKyUHZOmNs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=M1Oddl2g; spf=pass (imf20.hostedemail.com: domain of vernon2gm@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=vernon2gm@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671599694; a=rsa-sha256; cv=none; b=Vs0+y/ZgjyBMTuEi/ilNaJa6L1n+0+PV7aLOx34m/Nys6GwcXP0oPqsNjNUUa60Y/fU/ew Y+WF/Q7TUEtp5fl3F2LaeAnknYdXxqI7sUler/GmjsIsdIW4ebWnrk0FN9ch0x/VtfFYzP 7KL554OFl6fw8ZXfiDBBYewiJJRgAeg= Received: by mail-pj1-f49.google.com with SMTP id k88-20020a17090a4ce100b00219d0b857bcso994390pjh.1 for ; Tue, 20 Dec 2022 21:14:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=58KPHzr5CDwAEkwIK5uh0Ypn+WKmBYyNXwDDK5i4gXQ=; b=M1Oddl2gOUYbTrW4XB8DG47MMPushgPON4TF1M7LHhxcESU1HF6DYc3ehQ9/sSZYb4 VJ6SWVm06ro9wP7cEsBDXRC9m3FU7SBGVrn5gavydEyoJcl6m6NXVkOatc7KqNSBlPtp sDucdUbphnxPNxzzfWLfhCihtg43VQ++VhRjPBbCIS4AuZb5oe3kt/At9Xi80pOiTGsj Lu8BPcdD/cCXGOQictIf5oSN9Ch4rnDb/IwWqgUD1O/JzScQuaxspiK4xEOa7UBOi091 o/pRllQj1H+Pz1BN7DTn4Ylh4B91Wm0TOdDxUmNpb1ckscS/gLu6ERYXTCniMra8VqgS HmZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=58KPHzr5CDwAEkwIK5uh0Ypn+WKmBYyNXwDDK5i4gXQ=; b=Wm1IYLrzXGJ7pYBPdvmqZaGUP4A1iVq27Og90ceQcwRG1Zjz3xYDFeQivvfoPytKE8 PuRxHQ1jjoDD7txKZ2Be+O9TJfRS7XDuegJjECHKhZMWboO4rPPaKaYiAkDTXtjOCYDq sZ/JSTZyu0cmbzLkGBZ2N8klG2Y4Z9If4vb8Szim9v03EfpZRASDftAQlGLqKR+pw0O0 GGgt2H9BLAY5hnLWbLkdPjSxM7D25oChz7KlMBse5OC6HjiCXMMdB5AaWrmE4XeHfbe2 hTs9YhAogdd03F1RbelNwbozvT+Xgec3Qt7cVayrItdE1SDVhFJH5fW/1ZF45rrV6Vbv Vc9g== X-Gm-Message-State: AFqh2kpGPbz7cG6rTxpjgqyOp2pzYnSMHetvKDaZxGl9lV1iuvS9bmTk idRfZsSjrzQTm/hVmnFMuvo= X-Google-Smtp-Source: AMrXdXvv4OT1+XTFELG23gnsrUFM3riOp0HUS6LR7fuyRYoEazUkZB3ssZV2lapXKDi8/9vURCYC1A== X-Received: by 2002:a05:6a20:cb44:b0:af:e129:cc4 with SMTP id hd4-20020a056a20cb4400b000afe1290cc4mr991565pzb.41.1671599693593; Tue, 20 Dec 2022 21:14:53 -0800 (PST) Received: from vernon-pc ([114.231.52.81]) by smtp.gmail.com with ESMTPSA id b3-20020a636703000000b004768b74f208sm9248045pgc.4.2022.12.20.21.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 21:14:53 -0800 (PST) Date: Wed, 21 Dec 2022 13:14:48 +0800 From: Vernon Yang To: Liam Howlett Cc: "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 6/8] maple_tree: change return type of mas_commit_b_node() Message-ID: References: <20221220142606.1698836-2-vernon2gm@gmail.com> <20221220142606.1698836-7-vernon2gm@gmail.com> <20221220150310.kfzx5paymtaepbxk@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221220150310.kfzx5paymtaepbxk@revolver> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C07DD1C0016 X-Rspam-User: X-Stat-Signature: aaffsjjju658esmuob4yuyyyki5j1n6r X-HE-Tag: 1671599694-468610 X-HE-Meta: U2FsdGVkX19QOTBzg4FKUZ6M37xuujyopO6GnceBmv1S+nAkLgawNiZx2hHIto0dX5acRmr9ZCYkYnHxnwQ3WynfleZlZJvZSauIrM1v2jIq3dAjeGgGZxhxFD/soFW/AC71wXQbdVDu0wGWtzToDPujVSH8BYSO4HatwjwXdCYjPnQFcxih8NxcUUsJLvTpOhSIetNrhQMhjGH8d4cZRKmZDxQJclNPEQeSMXwgLAGatS+3s/FR2iIO+GhNIbPAd7XI7clrSgMrZJHcYPo26/cmhNXpayr07QAA8/4Yq/bff9KvMihC1X7WwkwsElAuInJj6YLYFqdjCKzQbFHwU+TziiJh7ncl55xtK57JMNwGVrtViKOJ8J/tYedlgFtUJ6lUtcgzujKotEC89etj9f7RlwwBBTrvtN0A8VjkjW9Y7FrRqwjOtctak9KxhBV96ZSOJ2GGNKxyQoYeemC2lTVhGYWzuEhr/2aV61Y2YCzqwoo4CaR8D798wAyxl5DlgSsUZroHBiqQvfBjdDrAX1pvVhUGbjJUswWZQAtHP2zdzTKRiGA63uDDfv6BqGs/seIb5w72AV/0xx5E3BKMr+8ydYHafpi0W3XPOV1t4NBdxfSmJwz5ineyPQU7kGUfv7UBDQf2H37jE70aK5JZKWAL4BO7Vl7gtHa2iY9f0kddlC2EFZgrAZZ6mHXdjuCJxA8UNBYk+RcMihVx0CpthiwbUzgcybw08KOSkd1k5GNCgVmuR7uOs2wGyBqZdEfBmXmYlAn/a53eASiePExJqRQ0MJvqTp96dLefudxHmItNiXwL2y3JMyfVrripjLOj7AjZj8p361VjoNoyh4LrkkyJcJoqco/CGCKfIZjYggVrrzod41pMDRQBDxt5LSRQdwrOD+uIbYE9MJxZTE/BohvAt2sR6IQbwDSbHgX+LBaYQ7XRGe9ElQLoUh6oY7BlvVHv4lZWpg2YG8Tb9/h sPM+quuO 4kYcwzm/sqLajhEXzbsd68jq/cFiZsKnBtoODqARXy2Wr0tAFGdEwL3Ce44Dm0kKUB5hBNbeDVUZ5Rwu8I3SQDij3pr5wLLr8Ltw3E57irP3BxhxSVTZkgiln7NCa8tGlZpGGkAad/CMRxyFNNaZidzMnZFSZt7l38AbCtttvlSK34dE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 20, 2022 at 03:03:36PM +0000, Liam Howlett wrote: > * Vernon Yang [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 > > --- > > 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? Oh, sorry, I forgot to changes the return value type of the mas_split() and mas_rebalance() > > 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. Yes, the return isn't used at all from this function, have noticed. Initially, I also wanted to change the return type void, but these functions have an error condition that returns early, so I'm more inclined to have an error value return so that it's clearer and for better readable. en... I temporarily remove this patch 6 > > > { > > 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 > > > >