Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp999179rdh; Sun, 24 Sep 2023 23:10:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKc9DAbHuTPeqKa3K9Z64Yz33e5eFVTBQ0uNhmMMpBgan5vCRT6EMWQy6pNCG9zRqwrRed X-Received: by 2002:a17:90b:4b81:b0:274:755b:63b8 with SMTP id lr1-20020a17090b4b8100b00274755b63b8mr5340771pjb.43.1695622224307; Sun, 24 Sep 2023 23:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695622224; cv=none; d=google.com; s=arc-20160816; b=hQtMHydA71U7pT67bb4T8nTuYSsaxTs6GJExVAYBpGwPjsgsgc+oaGYByto1eZmxFl XMxL5YQM7GPr6qjQMKxGVCMvNdMluwWXh+Oyjs+umpyg+GJ6Pzg12SqU5gbdpDVRIAfU c159qP6AbaRVhavg9jE2l+urOCf+0RjJbjjQuASkm/sv5L/iSRhKamr2GTzqQV45EBP7 hW+AwIqqps8JO3Epq+lWoD5DkLxVGMO4MSSBTHasmfxhEYczRZS3xUK+I/iqu+b1GxWF qCKZi3iAhJZuGIjp3v/1HPAG9/KG6cqWd/APViVLHocWrI7gvEBPzCYMiuKwRRk1E9y4 xXyQ== 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=mGF6lWn34y725CVIBLiDuCLlZ/D9mfCg2VPUJce9YQs=; fh=uq6KVc+CzZ80ucpwrp8f3d+Fe7Ue0w5J0Au2lk064nU=; b=Q0Kp1PQkr9QU3GjE1Ac1/RaxLgSnnvpnz3DfUmRlrNwnyySowXKDRXKKGC7YlLYPgC szoeLZEWCWoycFm59PZrBhoQryY+ai3m4DeWwCDm4xyTg984W9pKbrOYco8WyaU2B3o5 6YBjWXz01FL0xgLzybDqLuSPskzi94IBtentP8QLJ0gD52a7Utc//HG74RX+F0jhlIhZ gZSouTthCopLLlHIdaX3WZ8sjiOZuP/FSUxC3xJfd6f8WqfEGVXuGv7U4xgrGTD+P68l CKBx8sapFfR4Q3lzfIgZBWDqJOFZYe7MqZNLhQgm0KaRLEUKD3PRDF7eW9uObk+KSym3 aAcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="M/v/vjTr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id y10-20020a17090ad70a00b002774b340c1fsi2471830pju.69.2023.09.24.23.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 23:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="M/v/vjTr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 671978131C1F; Sun, 24 Sep 2023 20:59:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231492AbjIYD7v (ORCPT + 99 others); Sun, 24 Sep 2023 23:59:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231799AbjIYD7Y (ORCPT ); Sun, 24 Sep 2023 23:59:24 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F221210D for ; Sun, 24 Sep 2023 20:58:41 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-690d8fb3b7eso4946932b3a.1 for ; Sun, 24 Sep 2023 20:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1695614321; x=1696219121; darn=vger.kernel.org; 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=mGF6lWn34y725CVIBLiDuCLlZ/D9mfCg2VPUJce9YQs=; b=M/v/vjTrVyE+W85fdWa0awcxSStSWeglGcdH015ydpFVQEh4YokywwsZPSRplczS6s kZrsuIanxSb1vmhLk6aIFRWc0+NvuYshY7BLiPJ94xHxcm3SHiXR3l84vbUT4jIZgiDz kiFYJaP7UcFP5Hf1iseif2xwPz/9hB2j1+oUZX/0QXBQ+3sg0hfwvCMfbchrypuKa9SE 4Wj+MqmJxuQ5ikjNi4bDoNTaQjDXP5XlfJkPbzdQqhekugZIUBtJiph/PiiJsfgmUN3i XwN4nTIiDSETUudLS69n9v+6jRBMk35f3BRE2sdh/mxcKX7b2P4Ef+LDBEbcNoSVjviz difg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695614321; x=1696219121; 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=mGF6lWn34y725CVIBLiDuCLlZ/D9mfCg2VPUJce9YQs=; b=MT3BfMUdQNrefQCaze+9dY7Sa5mmdzINRyorduTuGMZQo97cmT5dTS7vHI2Er5BisZ kIuO6NsTNOGbgWa6geCf+MgDg2tWfh8TQDJndURFNOrHNZ2BZ2Sk8L61l20VV28092Ku 4kPZgYlnWjbMEdLo/q03rzqrRyD/QHTa2hEVDdLeAQVObbByxTlulKiETBJXFnQFgqQk x2leH9+QZC42rF8Uxljsm2z7HDPiTXfX0TgXe4lNvXn32BcEz0AHqJkvbryreSefjBee yYvaXwogH/NdztalODHKvL4fPCofQ5ig+IwwmHOtRSgpXQoAK6xeXKavSl5IE91Mhz7i Gz6w== X-Gm-Message-State: AOJu0Yy0pBi35pMCNAIcLrxbTkW69ez3i1Bd7IPK8tGQ28aqYwTzY6rr HKDTC34EtzsCKXuDMLSpwPFoOQ== X-Received: by 2002:a05:6a00:228a:b0:692:b8b9:f728 with SMTP id f10-20020a056a00228a00b00692b8b9f728mr7716486pfe.30.1695614321440; Sun, 24 Sep 2023 20:58:41 -0700 (PDT) Received: from GL4FX4PXWL.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id fm1-20020a056a002f8100b00679a4b56e41sm7025387pfb.43.2023.09.24.20.58.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 24 Sep 2023 20:58:40 -0700 (PDT) From: Peng Zhang To: Liam.Howlett@oracle.com, corbet@lwn.net, akpm@linux-foundation.org, willy@infradead.org, brauner@kernel.org, surenb@google.com, michael.christie@oracle.com, mjguzik@gmail.com, mathieu.desnoyers@efficios.com, npiggin@gmail.com, peterz@infradead.org, oliver.sang@intel.com Cc: zhangpeng.00@bytedance.com, maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v3 8/9] maple_tree: Preserve the tree attributes when destroying maple tree Date: Mon, 25 Sep 2023 11:56:16 +0800 Message-Id: <20230925035617.84767-9-zhangpeng.00@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230925035617.84767-1-zhangpeng.00@bytedance.com> References: <20230925035617.84767-1-zhangpeng.00@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 24 Sep 2023 20:59:51 -0700 (PDT) When destroying maple tree, preserve its attributes and then turn it into an empty tree. This allows it to be reused without needing to be reinitialized. Signed-off-by: Peng Zhang --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ed8847b4f1ff..ad06105f1a54 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -6670,7 +6670,7 @@ void __mt_destroy(struct maple_tree *mt) if (xa_is_node(root)) mte_destroy_walk(root, mt); - mt->ma_flags = 0; + mt->ma_flags = mt_attr(mt); } EXPORT_SYMBOL_GPL(__mt_destroy); -- 2.20.1