From patchwork Fri Oct 18 02:39:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13841025 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 0B7DAD3C53F for ; Fri, 18 Oct 2024 02:40:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 470726B0085; Thu, 17 Oct 2024 22:40:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F8BC6B0088; Thu, 17 Oct 2024 22:40:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24BEB6B0089; Thu, 17 Oct 2024 22:40:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 052296B0085 for ; Thu, 17 Oct 2024 22:40:02 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B7848803BC for ; Fri, 18 Oct 2024 02:39:52 +0000 (UTC) X-FDA: 82685168160.29.B97E6BE Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf17.hostedemail.com (Postfix) with ESMTP id 9F95740013 for ; Fri, 18 Oct 2024 02:39:52 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="RN/mC4J6"; spf=pass (imf17.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=richard.weiyang@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=1729219054; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=SFbwtL/v7jj9bCRMSofMROxDTE33JMhX4NWUpP80bjY=; b=yHYa5wRZ1Ctv9EwGeJbaCt4+hpSNyE49WcdP53p/JoCw1BqS8V9yqLEpqnItTsL5Rm3+M6 MT1SI2GLKBxkFjlKxoLFVt3cvH+Ea3H0mzJ8i3FKfdj1+fh0t0h/PFx/ItsJvT3CMDz6Cu MAtaVZTQc4WdOzCFkZBhu8tAh35e8WY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729219054; a=rsa-sha256; cv=none; b=nCEvwciWlyPHWYe15aG8WEFrp4E+ZKBdEVkm4oJgHEjoRBLpUDfxd+m7mpseFpVZPH1TUF /9/5flvcsHZlODwqcLhqUvaK+5DAjVO7izeN6AnKkgGXmo6nEvG838ljVjnpMSwa0/lyoR XaAcud8bCelN4YvSCpR2DEg6B3RrTlI= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="RN/mC4J6"; spf=pass (imf17.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a9a0474e70eso217143066b.0 for ; Thu, 17 Oct 2024 19:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729219199; x=1729823999; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=SFbwtL/v7jj9bCRMSofMROxDTE33JMhX4NWUpP80bjY=; b=RN/mC4J6EFxTnqKRDYork559HZcjrPyIgSCb+Uf74owvOhzjxFCOfjk4jLRIZtVp98 +4xMSyHNeE3hON9K4eYzaYwvKCQ/FYC9UdnYk6V01j3sTglJv09p+b6n/UAfIK9VmhfY Js+OdlFhJ3v4Z5SPen7qvRiEGLblN1AxA7M/GIX06e60q3SrakMJj86jhtR6bYVfj+Q0 iNZhexXenr/SfA4NtlvZw/XPaiwkVm2qovx6uYilmm/L12vm/p28Ox2o6EKko71SQcYC Ngn2fZAdTetnMeV/QCu7ycT/s7sdFHrvAJzucM3fGVQIlZdAEW/cpb82GBqScoQ30tza fqXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729219199; x=1729823999; h=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=SFbwtL/v7jj9bCRMSofMROxDTE33JMhX4NWUpP80bjY=; b=g3B4LPQjOOhfifV/XoaVV0P7rQIScO6qLBg0nnyiHPrAizjHAo7C5omJFDKWQc1yHV mL3pwRT8gfxDQKdx0GfeMsXGtvOVOmVDkckP6wDqV+DVMiFCkqZzA4TklGMydhHJTSia X9DocbiuBemTB+L1bWAYV7LYA6IAghNsdLx5CdSFSWMpHN+oAyiHSztWsm3BW2b3Szhq I+yWSryuwi/U9mIgm8hf3zlWRh+GPlkRO57/z+WjMC7STqzjTlqF0Zrw3IkxgXzxkcmp D6S5hj2BDQ0hK5KJlz2qh8MiMmKlBIU3G/bq/n3MdOFThaiPXZUEn1yXSrn0C8DQeQIM dZqg== X-Forwarded-Encrypted: i=1; AJvYcCVR4bNYQ/yRdSjyK9dvW67mr1UDWbDiUnXdUVorw8zvlaTkNtLu8G9PqAdBb6WCa8Gz6jvp68nhzQ==@kvack.org X-Gm-Message-State: AOJu0YzSNSHh3jTEldRnleFDtS/xkK/KjCvG5lmDShiwZXRRjHQSQrij EMTtsVNCN/zzlqsrEn8rjQaXSVL+SLa1OjK4WHobE1oiXbYdUSmc X-Google-Smtp-Source: AGHT+IE6xf+aJ7YNspX7vW2u1TFTBJ9nWV/sT0ZqfHMj9ID48Tk0ct2pnIXD6gm33jf9p2/rA56hcg== X-Received: by 2002:a17:907:7205:b0:a9a:4e7d:b0a1 with SMTP id a640c23a62f3a-a9a69ccce61mr68689166b.49.1729219199220; Thu, 17 Oct 2024 19:39:59 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a68ad506asm34002066b.57.2024.10.17.19.39.56 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 19:39:57 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v3 1/5] maple_tree: print empty for an empty tree on mt_dump() Date: Fri, 18 Oct 2024 02:39:39 +0000 Message-Id: <20241018023943.13860-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241018023943.13860-1-richard.weiyang@gmail.com> References: <20241018023943.13860-1-richard.weiyang@gmail.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9F95740013 X-Stat-Signature: ppiixqhqcfk19869g69otqzym5un5mot X-HE-Tag: 1729219192-94015 X-HE-Meta: U2FsdGVkX1+yWOsY2HVB2UxA8f867bRy0Y67mgUskrFW5Pd9fMOeYMDtamlrgrJSTDWdwNjA6B0lQn30KjCi4jEvzLw+tsnASGhS+aLKCLHRSNM2neSCehjaAn/2QLjNuaZR+p8Xv8QJzxqSc1kqYWgPNgwR5o0i6XGxI7VlKmEg/4CqKrJsb8MX3jJkfbz6Lli1tKoCmqpZReVHyzhqXoMgwWfAgrBTt9D32CGq6cz/hTS3ke++D/XyTVEJfDGMiqlMbCd1m9c4zS7voKP9VQJ+gWSKINJOkM9g4RRPIP4JIRdy/ivq5GBM66p0dezRgX3k8z9dgdsIED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xnvxBxgmNbiyAHRme0M4+KhZAXJCZOrQAgHjfKcLvWhQsQa3h+raYVkue1os9ydk9BAdvWqoHladDNscrRTYNdwn3qzu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000025, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Currently for an empty tree, it would print: maple_tree(0x7ffcd02c6ee0) flags 1, height 0 root (nil) 0: (nil) This is a little misleading. Let's print (empty) for an empty tree. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 20990ecba2dd..ec746aca2510 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7287,10 +7287,12 @@ void mt_dump(const struct maple_tree *mt, enum mt_dump_format format) pr_info("maple_tree(%p) flags %X, height %u root %p\n", mt, mt->ma_flags, mt_height(mt), entry); - if (!xa_is_node(entry)) - mt_dump_entry(entry, 0, 0, 0, format); - else if (entry) + if (xa_is_node(entry)) mt_dump_node(mt, entry, 0, mt_node_max(entry), 0, format); + else if (entry) + mt_dump_entry(entry, 0, 0, 0, format); + else + pr_info("(empty)\n"); } EXPORT_SYMBOL_GPL(mt_dump);