Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10974850rwr; Fri, 12 May 2023 16:31:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6UsVpVF5U23yqKiOzjvOkfJm/npuTdM+vjDmXQyHwa0xIJFuXHp3/sknregq8EZgbFKaZq X-Received: by 2002:a05:6a20:a10f:b0:ff:b9c4:a0aa with SMTP id q15-20020a056a20a10f00b000ffb9c4a0aamr31920531pzk.48.1683934315121; Fri, 12 May 2023 16:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683934315; cv=none; d=google.com; s=arc-20160816; b=1DOSkeTUWfEGhCQx3vZafBI7+3i5HCFjaf/Ex4wmo6x5GaTIMznHden2tqSqRhi9k5 u50AsCr04LLtlfjbCDzBWfFxPlLf44JtVhJWUjvqgc2wnbcPS/Llc1FBTCYW907Op8T8 vs0sI2mJ4VzdLVvrdes1bI8DEpRv0S4jIFmYr/w6vX+djwQEL4x18SP0KhRoy1ZLLv3j xusD3BvLzm5rVN7G6EL3Vn4rIdLCqUhXb3GLF6R1YhT49sikUWegAXVNpWC3UldT1+zO Qd8B0IUUo/qhfNua9CeZoEWVS4bUDfxlPjBowkl4dG8ToEmmc3YkSSLutMy3LW2f9vpD 1lqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Pp8jBp+PsN/KMldJE1rQSHhwMY1J2qwORnODvcuEea0=; b=Scj1IPJW0CmBMmxwrnlL52pE2qOjpOUirW4mQmM/vlnOxZutE2AVW/eUHamcsq1N8B X38COMTCDXpEx83JRU9D1tW6IBMtXGYHVxf/fYksHFfXPJxDoKUqoRzJnC9C6ZJgfzl6 0rGaUPpUppapIrT/VVM1jyrzAtsG9ScKod4qtSo89zAip1OKLgC3FiZjPKB6AM+mb/TS DsIUa39mYlS1TbqUbdMaPt3IKjnGerby9A+W5aeiL6HiVzAh4u3zinLKKYwVMAwtJ+go Zf+oxxIUTx0V2w+IHEs0RaEZpHuutE3SX8IUFbi92JWCb5LfXSe2QxxbknOggcK8+ZC0 JQZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=c0MRyYLX; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a633749000000b005307598826csi4867182pgn.87.2023.05.12.16.31.40; Fri, 12 May 2023 16:31:55 -0700 (PDT) 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=@linux-foundation.org header.s=korg header.b=c0MRyYLX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240219AbjELXJB (ORCPT + 99 others); Fri, 12 May 2023 19:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239142AbjELXJA (ORCPT ); Fri, 12 May 2023 19:09:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77FB06A64 for ; Fri, 12 May 2023 16:08:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E55263BA8 for ; Fri, 12 May 2023 23:08:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49237C433EF; Fri, 12 May 2023 23:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1683932938; bh=Mk0cOSfhCixEuDzvt2XiRg0i4N/m7HIfr5wXU41qV0E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=c0MRyYLX6acmKF76NQOtyZWZ9eRLBl4A06U2rk+oVL2P9zyDaObrSP7IdDzbnbF0+ iDssMPwLUZTXENtU80yA+bqatKc+THPd/I/uQv0Kpr7wn81R8cxMFIucaB7RCbqq7f 5Q2a4Y0kTItOMXArku6gJoTnGpKBrIgcWIamEAbQ= Date: Fri, 12 May 2023 16:08:57 -0700 From: Andrew Morton To: "Liam R. Howlett" Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 28/35] maple_tree: Add mas_next_range() and mas_find_range() interfaces Message-Id: <20230512160857.820fc7a14256c1031c586113@linux-foundation.org> In-Reply-To: <20230512182036.359030-29-Liam.Howlett@oracle.com> References: <20230512182036.359030-1-Liam.Howlett@oracle.com> <20230512182036.359030-29-Liam.Howlett@oracle.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Fri, 12 May 2023 14:20:29 -0400 "Liam R. Howlett" wrote: > Some users of the maple tree may want to move to the next range in the > tree, even if it stores a NULL. This family of function provides that > functionality by advancing one slot at a time and returning the result, > while mas_contiguous() will iterate over the range and stop on > encountering the first NULL. > > ... > > +/** > + * mas_contiguous() - Iterate over a contiguous range of the maple tree. > + * @__mas: Maple Tree operation state (maple_state) > + * @__entry: Entry retrieved from the tree > + * @__max: maximum index to retrieve from the tree > + * > + * When returned, mas->index and mas->last will hold the entire range of the > + * entry. The loop will terminate on the first NULL encountered. > + * > + * Note: may return the zero entry. > + */ > +#define mas_contiguous(__mas, __entry, __max) \ > + while (((__entry) = mas_find_range((__mas), (__max))) != NULL) > I can's say I'm a fan of this. The name doesn't imply that this is a looping construct. I can't say much more because mas_contiguous() has no users..