Re: [PATCH] rhashtable-test: Make use of rhashtable_walk_peek

From: Herbert Xu
Date: Wed May 03 2023 - 06:15:57 EST


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@xxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt