Message ID | 20230609151332.263152-3-pctammela@mojatatu.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | rhashtable: length helper for rhashtable and rhltable | expand |
Context | Check | Description |
---|---|---|
netdev/series_format | success | Posting correctly formatted |
netdev/tree_selection | success | Clearly marked for net-next, async |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 10 this patch: 10 |
netdev/cc_maintainers | success | CCed 3 of 3 maintainers |
netdev/build_clang | success | Errors and warnings before: 8 this patch: 8 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/deprecated_api | success | None detected |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 10 this patch: 10 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 19 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 6ae2ba8e06a2..1f8ca27af853 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -390,7 +390,7 @@ static int rhashtable_rehash_alloc(struct rhashtable *ht, static int rhashtable_shrink(struct rhashtable *ht) { struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); - unsigned int nelems = atomic_read(&ht->nelems); + unsigned int nelems = rhashtable_len(ht); unsigned int size = 0; if (nelems) diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c index c20f6cb4bf55..5853b83d9ad1 100644 --- a/lib/test_rhashtable.c +++ b/lib/test_rhashtable.c @@ -199,9 +199,9 @@ static void test_bucket_stats(struct rhashtable *ht, unsigned int entries) rhashtable_walk_exit(&hti); pr_info(" Traversal complete: counted=%u, nelems=%u, entries=%d, table-jumps=%u\n", - total, atomic_read(&ht->nelems), entries, chain_len); + total, rhashtable_len(ht), entries, chain_len); - if (total != atomic_read(&ht->nelems) || total != entries) + if (total != rhashtable_len(ht) || total != entries) pr_warn("Test failed: Total count mismatch ^^^"); }
Use the new length helpers instead of open coding the length read Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> --- lib/rhashtable.c | 2 +- lib/test_rhashtable.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)