From patchwork Thu Oct 17 13:46:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13840066 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 C98B1D37492 for ; Thu, 17 Oct 2024 13:46:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 446EF6B0082; Thu, 17 Oct 2024 09:46:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BFA06B0083; Thu, 17 Oct 2024 09:46:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 287726B0088; Thu, 17 Oct 2024 09:46:29 -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 F3BF16B0082 for ; Thu, 17 Oct 2024 09:46:28 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E07A1AC8C1 for ; Thu, 17 Oct 2024 13:46:06 +0000 (UTC) X-FDA: 82683218226.17.D66E8E6 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf09.hostedemail.com (Postfix) with ESMTP id B00FC140004 for ; Thu, 17 Oct 2024 13:46:19 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KQ5p3fTY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729172753; a=rsa-sha256; cv=none; b=192T+un0LivE3lGTuQbWfPn4HX6yyIAmW5JnhiInpNDwLoQJnXad5AAGxjc77BHXSj1XnR dkYrT/sMD3epDCEqHe8M88JeM0xSf76TvEzb6xz0s2V0H71VizvoC8O4xIOqVo3vD1PG2M zThiWOjklVpxSTHt8I7F3sLFJZ0TQH4= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KQ5p3fTY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729172753; 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=gd/gvzJZk2byqAlrxbcyfUB6NXNbKaEpQPGd+XTepUQ=; b=cV3BAsTjD/Mo2nH9JyHtU1S1Nvq8erUAtHwWCua/94b+V5pdVr4tPPU8ixWcCFypsXHgKx Bpj5rq9jSDeTlOUErgENmkkcS1yI8i0j7XFL6jVlvnTXCdtFPknQv2IqbIW+Vl/LB33CwD IAJsaNjJz/NL/rAvBwayp1Tsha3dmTc= Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5c40aea5c40so1745784a12.0 for ; Thu, 17 Oct 2024 06:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172785; x=1729777585; 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=gd/gvzJZk2byqAlrxbcyfUB6NXNbKaEpQPGd+XTepUQ=; b=KQ5p3fTYCl7V6HknpcVwkHUEV8FSlr6jojLEf0X4HTJyBU6iVPmxpGu64nX2M5G9Wx ovQZxbjK8yhDuRJCMmTKHxSLSC8KGNEUb8nebXaW3BUlsM//YL+yAQMZl/R29ZKKQ+OZ PKM1tBUssberiIYtMNErOXLv7KIPUVFh828WAinhlFrEsy1WbE/AzThEggDIns8fyMjT EBV1R7HtBOVG3DWP6kAkulj6TYf4crjo5P7h1VFOZ2w1YhaGVpFs5HM6UZVOoy1XqNH/ K8zL4RvlrSiH4yR2zd85LWwIi3lcr5J2IpmqktCgGwIYwERxohU8eCkhI+NKZ9sW7OyC b3kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172785; x=1729777585; 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=gd/gvzJZk2byqAlrxbcyfUB6NXNbKaEpQPGd+XTepUQ=; b=I9Ntb7LrrkRcPWSOBrlfl2nfAYStfTjqk1viGbd1dXJqBw7IQ6j3r4o2chQ1nnPcGW aQ7s37d8NCfpQS05vn2b9LuBhT6kAOoRvVjZ20VnU1pGvDWE3DEeRLaCB1e0r/g4Diyq uOqNgi4IRcFp/UOt6uFxMX/7XML/8zhYnWkld+GIWjTFhCJHnDeeXQ1co1DyHeH5HgOk ws+w4GJHkRKeA9f3DX5dS+qIoT4Fq0Z9DQ/yyQXgZjYnNS9Rlk8oO1OmAJGbSEXXHD86 S+jBvuUoYlHAo7+TcGREN1q20LA5uRB5XtM0GMMpjGykqpKIdtlZGkS0zbHWxUO+taBv 7QSg== X-Forwarded-Encrypted: i=1; AJvYcCVpNaVmqVfU9JSoBe0tGSkCNDDk16/VOK8qcvkEImROug79mgE72VGa/p84GJfYZkoJcJwkEXlzWw==@kvack.org X-Gm-Message-State: AOJu0Yxwcz4452zwm4VHyaM4f3ouyr6b6zU5DwRCM+Mdq76SE7MBHpW5 h5JbhuGJOoBR/XeVSMWtBCNpBDJKrQj/N1wOPLX0gs0O4U/JoOU/ X-Google-Smtp-Source: AGHT+IG27tQSBevQcbOxDL6VorRxQSCki9fKb1svCCWOQ7EVnG8t1SQDqyzEwKRIyygydNdrwskYnA== X-Received: by 2002:a05:6402:90e:b0:5c9:6c7:8b56 with SMTP id 4fb4d7f45d1cf-5c9a5a1c04fmr3409607a12.7.1729172785213; Thu, 17 Oct 2024 06:46:25 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c98d4f9612sm2788184a12.32.2024.10.17.06.46.23 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 06:46:23 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 1/5] maple_tree: print empty for an empty tree on mt_dump() Date: Thu, 17 Oct 2024 13:46:03 +0000 Message-Id: <20241017134607.30206-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241017134607.30206-1-richard.weiyang@gmail.com> References: <20241017134607.30206-1-richard.weiyang@gmail.com> X-Rspam-User: X-Stat-Signature: tts89fxgqosfrgw5grfhn697e9dzqzmx X-Rspamd-Queue-Id: B00FC140004 X-Rspamd-Server: rspam02 X-HE-Tag: 1729172779-406733 X-HE-Meta: U2FsdGVkX1/Vu3lSAYdc3Sr0fExM5ICnKMf3hKmpBiKyzOBHf7OfTCHguhL63Wx2jkevif4/McTXEYpXA5qQTquLwUz7T2SjmaEOTjcg3nKNlAxRtCc0key5nWOSqpOH9Xy9ZSQwC4MR9L8VupaEQU3un4Cq29VxuwbTY+ORSuwhvvkgQAyzN/J+A3sFHaKGy+AGQI51C0xbpQNCmhdBWhgCAEQp8iYqgjqi2hto6RrjRKwb8+JE9P75oWpZzMhgo1MCV8H/E3Xoq8rQNIeBlneutMNcgQ06sueMkZm+D+EcGgv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jmD6ZoeAXpc+vYetZJBQ7HibfK+Rbq06qUyhySSOrmkbKFVBzge56xGxFYFTM8zxsl5GMJZzU5YCxyPx0+EllNCVtglwTSlflRw414Fp9xmNPWUddV X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 db3de0b9aa9a..63a969d581f2 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7204,10 +7204,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);