rhashtable: Fix rhashtable_next_key() build warnings
Subsystems (3)
PATCH 1/1 rhashtable: Fix rhashtable_next_key() build warnings
From: Mykyta Yatsenko <[email protected]>
rhashtable.o builds with warnings as rhashtable_next_key() kdoc from lib/rhashtable.c does not have the arguments descriptions.
Move rhashtable_next_key() kdoc from header to c file, matching other functions.
Move rhashtable_next_key() next to the other forward declarations in the header file.
--- include/linux/rhashtable.h | 42 ++---------------------------------------- lib/rhashtable.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 41 deletions(-)
include/linux/rhashtable.h +2 -40
@@ -263,6 +263,8 @@ struct rhash_lock_head __rcu **__rht_bucket_nested(struct rhash_lock_head __rcu **rht_bucket_nested_insert (struct rhashtable *ht,struct bucket_table *tbl,unsigned int hash); +void *rhashtable_next_key (struct rhashtable *ht,const void *prev_key); +#define rht_dereference (p, ht) \ rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht))
@@ -650,46 +652,6 @@ static __always_inline struct rhash_head *__rhashtable_lookup(return NULL ; } -/** -* rhashtable_next_key - return next element after a given key -* @ht: hash table -* @prev_key: pointer to previous key, or NULL for the first element -* -* WARNING: this walk is highly unstable. Unlike rhashtable_walk_*(), -* it cannot detect a concurrent resize or rehash, so a full iteration -* is NOT guaranteed to terminate under adversarial or sustained -* rehashing. Callers MUST tolerate skipped and duplicated elements and -* SHOULD bound their loop externally. -* -* Returns the next element in best-effort iteration order, walking the -* @tbl chain (including any future_tbl in flight). Caller must hold RCU. -* -* Pass @prev_key == NULL to obtain the first element. To iterate, set -* @prev_key to the key of the previously returned element on each call, -* and stop when NULL is returned. -* -* Best-effort semantics: -* - Across the tbl->future_tbl chain, an element being migrated may -* transiently appear in both tables and be observed twice. -* - Concurrent inserts may or may not be observed. -* - Termination of a full iteration loop is NOT guaranteed under -* adversarial continuous rehash; callers MUST tolerate skips and -* repeats and SHOULD bound their loop externally. -* - Behavior on tables that contain duplicate keys is undefined: -* duplicates may be skipped, repeated, or trap the walk in a -* cycle. Callers requiring duplicate-key iteration must use -* rhashtable_walk_*() instead. -* - rhltable instances are not supported and return -* ERR_PTR(-EOPNOTSUPP). -* - If prev_key was concurrently deleted and is not present in any -* in-flight table, returns ERR_PTR(-ENOENT). -* -* Returns entry of the next element, or NULL when iteration is exhausted, -* or ERR_PTR(-ENOENT) if prev_key is not found, or -* ERR_PTR(-EOPNOTSUPP) if @ht is an rhltable. -*/ -void *rhashtable_next_key (struct rhashtable *ht,const void *prev_key); -/** * rhashtable_lookup - search hash table * @ht: hash table
lib/rhashtable.c +34 -1
@@ -730,8 +730,41 @@ static struct rhash_head *__rhashtable_next_in_table(/** * rhashtable_next_key - return next element after a given key +* @ht: hash table +* @prev_key: pointer to previous key, or NULL for the first element * -* See include/linux/rhashtable.h for the full contract. +* WARNING: this walk is highly unstable. Unlike rhashtable_walk_*(), +* it cannot detect a concurrent resize or rehash, so a full iteration +* is NOT guaranteed to terminate under adversarial or sustained +* rehashing. Callers MUST tolerate skipped and duplicated elements and +* SHOULD bound their loop externally. +* +* Returns the next element in best-effort iteration order, walking the +* @tbl chain (including any future_tbl in flight). Caller must hold RCU. +* +* Pass @prev_key == NULL to obtain the first element. To iterate, set +* @prev_key to the key of the previously returned element on each call, +* and stop when NULL is returned. +* +* Best-effort semantics: +* - Across the tbl->future_tbl chain, an element being migrated may +* transiently appear in both tables and be observed twice. +* - Concurrent inserts may or may not be observed. +* - Termination of a full iteration loop is NOT guaranteed under +* adversarial continuous rehash; callers MUST tolerate skips and +* repeats and SHOULD bound their loop externally. +* - Behavior on tables that contain duplicate keys is undefined: +* duplicates may be skipped, repeated, or trap the walk in a +* cycle. Callers requiring duplicate-key iteration must use +* rhashtable_walk_*() instead. +* - rhltable instances are not supported and return +* ERR_PTR(-EOPNOTSUPP). +* - If prev_key was concurrently deleted and is not present in any +* in-flight table, returns ERR_PTR(-ENOENT). +* +* Returns entry of the next element, or NULL when iteration is exhausted, +* or ERR_PTR(-ENOENT) if prev_key is not found, or +* ERR_PTR(-EOPNOTSUPP) if @ht is an rhltable. */ void *rhashtable_next_key (struct rhashtable *ht,const void *prev_key) {
---
base-commit: 5a9a7457df6ca17e8a4a4551781eea1f4b02a64e
change-id: 20260606-rhash_fixes_1-d2ebc816ea7e
Best regards,
Signature · 1 line
Mykyta Yatsenko <[email protected]>
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 9 lines · On Sat, 06 Jun 2026 10:30:32 -0700 you wrote:
From: Mykyta Yatsenko <[email protected]>
rhashtable.o builds with warnings as
rhashtable_next_key()kdoc fromlib/rhashtable.cdoes not have the arguments descriptions.Move
rhashtable_next_key()kdoc from header to c file, matching other functions.[...]
Here is the summary with links:
- [bpf-next] rhashtable: Fix rhashtable_next_key() build warnings
https://git.kernel.org/bpf/bpf-next/c/1444ee886e6f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html