Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5201306rwd; Tue, 23 May 2023 20:39:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5w2w0RIOvEFnkI9rFq/0Y9ZUJLBR6dT44t2U/yRLj2/1Kf4F3fgeBcxUnQVrV24i8lnFJ/ X-Received: by 2002:a05:6a20:6a28:b0:10b:2ed8:1859 with SMTP id p40-20020a056a206a2800b0010b2ed81859mr11623655pzk.6.1684899546423; Tue, 23 May 2023 20:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684899546; cv=none; d=google.com; s=arc-20160816; b=jSwaMfrBt49ET71nzFWsRlHKrCRtpGdYh4n4Z7GZNt+6ctxcJkz/UJQaKlF3nW141Q aDAPlTi+Ke0RNtBSazCWgD4Z887ZgDBdaZeLTcxOM6+vs62xa42q2EmSLunwXExAqnWw hr5gaIX0gumOiFpe8MiJYWI1MZBxx5LCI9X13rIcq3dQIEJg8txGXv0bZ9MZdC60u6V3 CzT4oZLKS1YlqAead4G89TzpR6MQHdMAxOy4CyfAGtBq1WfK1CC46Db6hJG7wtCDlwzJ JUH//FDObGgm5Auu9huGULvqddLAvFNgy2m83e750a6FYvoWWZEVJRW/APIcJZ7RSft8 US/A== 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:date:subject:cc:to:from :dkim-signature; bh=ho+8AxwCMUO1UZDPlZ+RxzprWSmT0wiRibYRYtQid4k=; b=aifLm3bVtcdetEwlR7BA1TLLolipIFtQT/HCwe9i6/GUfOCRhVlDa8e9YBZnTIUrrw 4OOvFwBCEuPU9rEJ0o+xIq4NPJ6AW/GdHdR7Bl8IZjItGSxC1De0+ctxr8bjeAbHTlBl Ol6KSXL6vfQ9YIB66TWFS0xetuSBhZMiO5ljtxZNmYVJWh5dEdyJTiPs2wdrTXF1yzRK dULL/zXMJbs4PsyTHfnyU4nkAQdHmp2cTNqD7rhPbYt91jS/wW5HY/M8i7lZvJ1pxZf+ IW/O9i5T/co6NA4c4Oduf9oTsQJZ9Ygyo5G4zzlTg01dRWzYcQymRpKcb89mxqzZO+xC VF6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=kvoX8rfQ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q134-20020a632a8c000000b0052c89d50011si5604302pgq.676.2023.05.23.20.38.50; Tue, 23 May 2023 20:39:06 -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=@bytedance.com header.s=google header.b=kvoX8rfQ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239303AbjEXDNt (ORCPT + 99 others); Tue, 23 May 2023 23:13:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239279AbjEXDNf (ORCPT ); Tue, 23 May 2023 23:13:35 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEE9E54 for ; Tue, 23 May 2023 20:13:27 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1ae4c5e12edso3553435ad.3 for ; Tue, 23 May 2023 20:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1684898007; x=1687490007; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ho+8AxwCMUO1UZDPlZ+RxzprWSmT0wiRibYRYtQid4k=; b=kvoX8rfQyN2AB0Gr43+8rZLVHFEmrrDTqutZAx5YmjW/kGuQGJ0PYvltnv5oe+C2Dz 5qJCza00ybILWo0O75SnzamE/deaG5NaRNh5OG1IFwsc87i9gFW9INu037TjJF1yAJNr iKqeDs5Fp+AscJaCq4eKX+NBdfovr1pTO1C+zYi0UA+vOAW7Uvs4emRsWyygLkp27mAF Fbpqj8PxnSGvAO2m8iSuM2zxRZIZL0nARH7uV4WpbZ5mrUUSxTHDwmBAevUUz6oEWcPc IrnFnja7kLA1sl5ZZz0CUVqI6joBnhibcFuTnaVKHI+e0tnVt9HoS5U4VDbwvQOLyBDy AVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684898007; x=1687490007; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ho+8AxwCMUO1UZDPlZ+RxzprWSmT0wiRibYRYtQid4k=; b=GrilAXFPEmLJMdshvD6+IT5nGfwZ5n+sF45Ycpic/wJJS9aihtu2IhOsuW9q5JjJYa cEEQ1CfN50yKBG0iqQczzfT8wtOJx3ygmJvQhi0H/xPPDzS987Fs1mF6bsjTAlFiTD04 EJUvVgYd1k+T/k0ZZRORqoBpm7pGitmU4Vas0xOn4+FPQn4w+vDYHPoK7azfrAiTCPQi Ih6UmqJTYA3a0UNEyZn6JInKb8uySI4JYq+uGw2qXfm79mHKQDVnEDmyV0gzRecTW6X+ 2qSJNc+JbINxRCUMfr/x+mwUQEXfT/PZ5NK/12fh4mchnpYGKt1mN2skRvHuztaoh967 QSXg== X-Gm-Message-State: AC+VfDyQuF9jnSZBtr9j3zdC/F5QF2I4nUCJHr5Vl+PcqgyONHLgfwOL bBX4ETpFl3bA3IUvtsOj028mRg== X-Received: by 2002:a17:903:2287:b0:1ad:b5f4:dfd5 with SMTP id b7-20020a170903228700b001adb5f4dfd5mr19242735plh.32.1684898007229; Tue, 23 May 2023 20:13:27 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([139.177.225.249]) by smtp.gmail.com with ESMTPSA id i4-20020a17090332c400b001ab061e352bsm7480769plr.195.2023.05.23.20.13.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 May 2023 20:13:27 -0700 (PDT) From: Peng Zhang To: Liam.Howlett@oracle.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, Peng Zhang Subject: [PATCH v4 05/10] maple_tree: Make the code symmetrical in mas_wr_extend_null() Date: Wed, 24 May 2023 11:12:42 +0800 Message-Id: <20230524031247.65949-6-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230524031247.65949-1-zhangpeng.00@bytedance.com> References: <20230524031247.65949-1-zhangpeng.00@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Just make the code symmetrical to improve readability. Signed-off-by: Peng Zhang Reviewed-by: Liam R. Howlett --- lib/maple_tree.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 41a105e76e22..e6e42e1ba44c 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4264,19 +4264,21 @@ static inline void mas_wr_extend_null(struct ma_wr_state *wr_mas) { struct ma_state *mas = wr_mas->mas; - if (mas->last < wr_mas->end_piv && !wr_mas->slots[wr_mas->offset_end]) + if (!wr_mas->slots[wr_mas->offset_end]) { + /* If this one is null, the next and prev are not */ mas->last = wr_mas->end_piv; - - /* Check next slot(s) if we are overwriting the end */ - if ((mas->last == wr_mas->end_piv) && - (wr_mas->node_end != wr_mas->offset_end) && - !wr_mas->slots[wr_mas->offset_end + 1]) { - wr_mas->offset_end++; - if (wr_mas->offset_end == wr_mas->node_end) - mas->last = mas->max; - else - mas->last = wr_mas->pivots[wr_mas->offset_end]; - wr_mas->end_piv = mas->last; + } else { + /* Check next slot(s) if we are overwriting the end */ + if ((mas->last == wr_mas->end_piv) && + (wr_mas->node_end != wr_mas->offset_end) && + !wr_mas->slots[wr_mas->offset_end + 1]) { + wr_mas->offset_end++; + if (wr_mas->offset_end == wr_mas->node_end) + mas->last = mas->max; + else + mas->last = wr_mas->pivots[wr_mas->offset_end]; + wr_mas->end_piv = mas->last; + } } if (!wr_mas->content) { -- 2.20.1