* [PATCH] rhashtable-test: Make use of rhashtable_walk_peek
@ 2023-04-25 13:56 Cai Huoqing
2023-05-03 10:15 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2023-04-25 13:56 UTC (permalink / raw)
To: cai.huoqing; +Cc: Thomas Graf, Herbert Xu, netdev, linux-kernel
Add an example usage of rhashtable_walk_peek to test_bucket_stats.
Signed-off-by: Cai Huoqing <cai.huoqing@linux.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rhashtable-test: Make use of rhashtable_walk_peek
2023-04-25 13:56 [PATCH] rhashtable-test: Make use of rhashtable_walk_peek Cai Huoqing
@ 2023-05-03 10:15 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2023-05-03 10:15 UTC (permalink / raw)
To: Cai Huoqing; +Cc: Thomas Graf, netdev, linux-kernel
On Tue, Apr 25, 2023 at 09:56:17PM +0800, Cai Huoqing wrote:
> Add an example usage of rhashtable_walk_peek to test_bucket_stats.
>
> Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
> ---
> lib/test_rhashtable.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
This is supposed to be testing rhashtable code, it's not meant
to be an example of how to use the API.
> @@ -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;
> + }
> +
What is this meant to test?
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-03 10:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 13:56 [PATCH] rhashtable-test: Make use of rhashtable_walk_peek Cai Huoqing
2023-05-03 10:15 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).