[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230425135617.77907-1-cai.huoqing@linux.dev>
Date: Tue, 25 Apr 2023 21:56:17 +0800
From: Cai Huoqing <cai.huoqing@...ux.dev>
To: cai.huoqing@...ux.dev
Cc: Thomas Graf <tgraf@...g.ch>,
Herbert Xu <herbert@...dor.apana.org.au>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] rhashtable-test: Make use of rhashtable_walk_peek
Add an example usage of rhashtable_walk_peek to test_bucket_stats.
Signed-off-by: Cai Huoqing <cai.huoqing@...ux.dev>
---
lib/test_rhashtable.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c
index c20f6cb4bf55..b1c3316b9bde 100644
--- a/lib/test_rhashtable.c
+++ b/lib/test_rhashtable.c
@@ -177,6 +177,7 @@ static void test_bucket_stats(struct rhashtable *ht, unsigned int entries)
unsigned int total = 0, chain_len = 0;
struct rhashtable_iter hti;
struct rhash_head *pos;
+ struct test_obj *obj;
rhashtable_walk_enter(ht, &hti);
rhashtable_walk_start(&hti);
@@ -192,6 +193,13 @@ static void test_bucket_stats(struct rhashtable *ht, unsigned int entries)
break;
}
+ /* Here's an example usage of rhashtable_walk_peek */
+ obj = rhashtable_walk_peek(&hti);
+ if (!obj) {
+ pr_warn("Test failed: rhashtable_walk_peek() error\n");
+ break;
+ }
+
total++;
}
--
2.34.1
Powered by blists - more mailing lists