From patchwork Sat Oct 19 02:37:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13842540 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 B3D38D3E1AC for ; Sat, 19 Oct 2024 02:37:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37F5A6B009F; Fri, 18 Oct 2024 22:37:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 309FA6B00A0; Fri, 18 Oct 2024 22:37:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 184FE6B00A2; Fri, 18 Oct 2024 22:37:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E63486B009F for ; Fri, 18 Oct 2024 22:37:30 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6276D1C515E for ; Sat, 19 Oct 2024 02:37:16 +0000 (UTC) X-FDA: 82688790114.01.99ABC61 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by imf16.hostedemail.com (Postfix) with ESMTP id 3492F18000C for ; Sat, 19 Oct 2024 02:37:16 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KFNNPwPQ; spf=pass (imf16.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.128.45 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=1729305374; 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=Jx6ql30Rr7ZGGutsXY5/Qe08rpu2wxuP38RHd5eAMEY=; b=x8pfxTtafkrkIEPiO3Y6/oTFHizljB6hDyyB9G5lyYbT0O5hIp8xIJK+YEw2/O56NLyJh+ +GgFrMmdkE6v7Kw3cPvfdL4lK3k4bBz98lXvMvYyN26UPQfk+vrOgZCg7XqT8x7wZHMVyB Rnx8RPSlQGv82TnFH6h6tKc0l7JhAnU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KFNNPwPQ; spf=pass (imf16.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729305374; a=rsa-sha256; cv=none; b=RZ6I6wWzmQwWA1cEBnEEDtqs6jfBGGtxrFGkd2ZvwwGOnp8FF2VHOsOFOKoT5BKaZzFGLo CcZLpHV0+kE4aCgIYt0O1Vb4a4K3WsVz6pVxrB7XjHYQ0ToGep5H68ht+J+G6Tmr90bHD+ fhTqT8JbkkzplhFtWDTvV+AfNkn1Bi0= Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-430ee5c9570so34720245e9.3 for ; Fri, 18 Oct 2024 19:37:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729305447; x=1729910247; 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=Jx6ql30Rr7ZGGutsXY5/Qe08rpu2wxuP38RHd5eAMEY=; b=KFNNPwPQDsS2dNxTK+1r1M4GAP9SCYidCUgfE1il8j6+MNQlRFlyN3TNKwMJW99jZH IEZ2zD0vNJczUVP//IbGUkJ1HZH0fozRnEAuAOf9nhnDTXyy1DpWNw8VvCfJ44LptOfC Z+9wIPtFcYrPBnWta+BDf+G3qRA40z8HJ3p9NTy8lBQE3edIMbuv+AVY+TrXSU7Mn5VD VE6GsdadgxcObolxT0VYJ9ttw1l5Zc7RjUgU50SD9YPKek7xqg1svwbevE+ZEKDtxbdA KUHyK5RnFrhJxp4zWnYfoagCnVGoYBW1Po8F1/PbxP6m0PRJ3vVkIwnfKo9VR9oY6H56 z4rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729305447; x=1729910247; 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=Jx6ql30Rr7ZGGutsXY5/Qe08rpu2wxuP38RHd5eAMEY=; b=mHzln52RVw5qWQdaMtJJuRvzx4COsUv/xVjleVF9OcgKP0FxlXsyMpFJcJ5iz4Kv2l ljTbSxcmlJe6WN9WGmacfyQwfh21m6BwAJUnWew1X4GHdKC6GuLLQvNUx0UWuE/gA0E0 QQpNBYd3DF5iQUbwM/5BLhFCROTQ3pOh/U3PYQoMnPqL8JJvWuUyKNheD4bbmYq4u25/ pZY6LR+haT5s2vqpKJCyO5iDur0CYE2tx+bxyI9w5jKEMEZ64ORs8loMTAsFOQ8/IwNL HOxubNhDyTKIqEuZnHeRjaTC0z/XqGaHS7JRaksOX4BACKdxBwmsWAJfDy6mFGyU+q29 JvIQ== X-Forwarded-Encrypted: i=1; AJvYcCWQw3ZFBz6npFlSMYzwZIk1juYl0Ou+TDbXuuAEYUKTE1on4kR1oaBCgdPGKfy9WWAf3ZcmxsJA9A==@kvack.org X-Gm-Message-State: AOJu0Yzq+Sd4KvYytav2tmwgEwSrNxysIE463GfE1Y9OmzeR1+noAQfo bDteusNA3nRh3QBRaPJ77+hEqBaNKroUJSe1WvdRUU+XSxmDuvA4 X-Google-Smtp-Source: AGHT+IGIHZkEoFqLWfqtGRFgQmOc/J5heOsC9fAcjW/+zZ16nr4IesZJpB/0P7/fzIeAQ0jTAp8sNA== X-Received: by 2002:adf:f84d:0:b0:37d:4b26:54ca with SMTP id ffacd0b85a97d-37ea21d8635mr4140684f8f.14.1729305447209; Fri, 18 Oct 2024 19:37:27 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a68a8e763sm160919566b.23.2024.10.18.19.37.24 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Oct 2024 19:37:25 -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 v4 1/5] maple_tree: print empty for an empty tree on mt_dump() Date: Sat, 19 Oct 2024 02:37:12 +0000 Message-Id: <20241019023716.4516-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241019023716.4516-1-richard.weiyang@gmail.com> References: <20241019023716.4516-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 3492F18000C X-Stat-Signature: jxdfnpmxok8yzpz3kiar8m778rz6ewfi X-HE-Tag: 1729305436-776392 X-HE-Meta: U2FsdGVkX18+YLsCW0Gqj/skZ+U++1hKOGUANq0VPXLj401YyRmnMOXe+0ggdCwQvsrOEKoI4P8dzuHlJiX2oQkZ0Bq5/SrbmYgnRNny7v6eO+s+9Fxh2nGQCXhjq7s3x/7GAFqptCtVEgDblSFxNoIP1AC4hA4itlaSBau0SnIcW9OWLSmwh3Aa+XTeOcyKeAsV3w2AocOIm5JQo1gmfu8lnN2iGucszYwxLTphnKyg+5locrwl4EEqCEeEKyQXNb6Y83nqm34waJnTnBVFGG/WXzRl7+H4TupZ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GFlJMaVskVNPOqrwisx2JvRrAyfNXkfDJhIeKC8mOCttAAFv7W6q3qvJckRNtXOpGdfeg3avwfC4BNIpA5PH2OZESYK8cAgDuuGgH0AM17KknaLIg6w1n6gGUju3a37TqAh60zoRYJH4wp X-Bogosity: Ham, tests=bogofilter, spamicity=0.000044, 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 Reviewed-by: Liam R. Howlett --- 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 3619301dda2e..21e6895b7aef 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);