Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5167408rwj; Tue, 20 Dec 2022 21:57:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsVO8V3hpbVFmWknVYDDYVqcRicR5XtRVlKidgfvwzD/EeyIRJCgEZ83i8A/1SvCxydo9rX X-Received: by 2002:a05:6a20:1e50:b0:b0:57d4:c026 with SMTP id cy16-20020a056a201e5000b000b057d4c026mr1145154pzb.21.1671602260615; Tue, 20 Dec 2022 21:57:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671602260; cv=none; d=google.com; s=arc-20160816; b=uB5PaMOROl6EYKv3DJTz2XLoNI62bpkobc4pT0ZeQUoP45XxcjyacJkpA7mCMNcqMy JK73mwlkyXbBPl0iBY5pMjBY4VSOfMXnAL+RiHnyV0Tew95e57bLB/HrKvoTop7GT6xX a+i2CgeaEcDhqqKiS8bAM7AESHMC2CQ0+NLrXr4VQ6mvsc+a8ZkKPS69xpL+gHZouwIV Zz3R+RFQsP/EdzpzoPCWHH4rfniJMyE4BP25gQXm2ui8JoLbQOPNlOKsbZDE5W3TYLGW iAP+hh9WW+mDykxR8DqVT0jCiw8q4KxCdTPVWFDtUtu4BT1JIzSgZyJaE37hXyrsSdI4 9V/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=58KPHzr5CDwAEkwIK5uh0Ypn+WKmBYyNXwDDK5i4gXQ=; b=wsNT3VFlrmIk3MQJG2JiSWE39S/lxIfxFJz5Z3hkPuXjUVN/U8uXj7U3cTyZBcY2Ks eMKyBKl+93df3dd2l5CV9qvIibG1+RWIDZx6ez3zIt2W7kd7ChzFNuKqLTBPT6Sjr7kl coTXbFUEx3j7WBtXdrs5JYcWeMNRkHEqyLDmh8QGxWfc8/hW89T7CNl3uyqn94c3ccwN SZO9HuRTWGMlEUhgqJzMjmeCycwbkryG84JpZc8bHFr1ogZ+HrT/uakp4VbPC/Jza6LI CMhr1GzhtQs+R1X/Yqxm3F/x15qt+sC0jhsm0GQFRHNdwj02xVC028sYsr197WavDeav xNqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=M1Oddl2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x17-20020a633111000000b00476f59d84a6si17033010pgx.214.2022.12.20.21.57.31; Tue, 20 Dec 2022 21:57:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=M1Oddl2g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234210AbiLUFO5 (ORCPT + 69 others); Wed, 21 Dec 2022 00:14:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbiLUFOz (ORCPT ); Wed, 21 Dec 2022 00:14:55 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B811AF1D for ; Tue, 20 Dec 2022 21:14:54 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id v23so9374631pju.3 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=fY+gB7DBbhKIjt7XR5NmFRqiT2p01nD+oi+RPN5rendKlXi7VbVvp0Eq6SRkN2GbWk RwKBHigx6r7pJxUUvtOa9obtbM0t6sZ1NaUjnJZM89EQBGFAAwByL65B/fiRQkkxHaCW YEB7fW/+I5i+AG+ndPcbZnZzuNc/+sfqSl7NtCkppyxOZQOwOWoPgfdl+Mdnm9Y64oKK G2mc7CvW0aAh9lMvvvgvd4p45b0yuu5cRRc5rvGCiMZ0ypnj517t48edLbvGk/6sFBRi DNiWGnXCHRO410l1tlDK62xrOYksx4AJKyrenDe1Pvjt55YTbVrCIuw5GNfOIuQ3+Mes quQA== X-Gm-Message-State: AFqh2koLjnXxaZ9TMuTE7FZMHCNoDZABSsT+eN/ZLQLqUrIePWUBy3iN ooxE/1rWpoiQfqy/JrtMXdOtVn8f4XjYLNKR 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > >