Skip to content

Commit

Permalink
rhashtable: Remove obsolete rhashtable_walk_init function
Browse files Browse the repository at this point in the history
The rhashtable_walk_init function has been obsolete for more than
two years.  This patch finally converts its last users over to
rhashtable_walk_enter and removes it.

Signed-off-by: Herbert Xu <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
herbertx authored and jmberg-intel committed Feb 22, 2019
1 parent 3692293 commit 6c4128f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 37 deletions.
8 changes: 0 additions & 8 deletions include/linux/rhashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -1113,14 +1113,6 @@ static inline int rhashtable_replace_fast(
return err;
}

/* Obsolete function, do not use in new code. */
static inline int rhashtable_walk_init(struct rhashtable *ht,
struct rhashtable_iter *iter, gfp_t gfp)
{
rhashtable_walk_enter(ht, iter);
return 0;
}

/**
* rhltable_walk_enter - Initialise an iterator
* @hlt: Table to walk over
Expand Down
2 changes: 1 addition & 1 deletion lib/rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ EXPORT_SYMBOL_GPL(rhashtable_walk_enter);
* rhashtable_walk_exit - Free an iterator
* @iter: Hash table Iterator
*
* This function frees resources allocated by rhashtable_walk_init.
* This function frees resources allocated by rhashtable_walk_enter.
*/
void rhashtable_walk_exit(struct rhashtable_iter *iter)
{
Expand Down
9 changes: 2 additions & 7 deletions lib/test_rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,11 @@ static int __init test_rht_lookup(struct rhashtable *ht, struct test_obj *array,

static void test_bucket_stats(struct rhashtable *ht, unsigned int entries)
{
unsigned int err, total = 0, chain_len = 0;
unsigned int total = 0, chain_len = 0;
struct rhashtable_iter hti;
struct rhash_head *pos;

err = rhashtable_walk_init(ht, &hti, GFP_KERNEL);
if (err) {
pr_warn("Test failed: allocation error");
return;
}

rhashtable_walk_enter(ht, &hti);
rhashtable_walk_start(&hti);

while ((pos = rhashtable_walk_next(&hti))) {
Expand Down
15 changes: 3 additions & 12 deletions net/ipv6/ila/ila_xlat.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,7 @@ int ila_xlat_nl_cmd_flush(struct sk_buff *skb, struct genl_info *info)
spinlock_t *lock;
int ret;

ret = rhashtable_walk_init(&ilan->xlat.rhash_table, &iter, GFP_KERNEL);
if (ret)
goto done;

rhashtable_walk_enter(&ilan->xlat.rhash_table, &iter);
rhashtable_walk_start(&iter);

for (;;) {
Expand Down Expand Up @@ -509,23 +506,17 @@ int ila_xlat_nl_dump_start(struct netlink_callback *cb)
struct net *net = sock_net(cb->skb->sk);
struct ila_net *ilan = net_generic(net, ila_net_id);
struct ila_dump_iter *iter;
int ret;

iter = kmalloc(sizeof(*iter), GFP_KERNEL);
if (!iter)
return -ENOMEM;

ret = rhashtable_walk_init(&ilan->xlat.rhash_table, &iter->rhiter,
GFP_KERNEL);
if (ret) {
kfree(iter);
return ret;
}
rhashtable_walk_enter(&ilan->xlat.rhash_table, &iter->rhiter);

iter->skip = 0;
cb->args[0] = (long)iter;

return ret;
return 0;
}

int ila_xlat_nl_dump_done(struct netlink_callback *cb)
Expand Down
10 changes: 1 addition & 9 deletions net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2549,15 +2549,7 @@ struct nl_seq_iter {

static int netlink_walk_start(struct nl_seq_iter *iter)
{
int err;

err = rhashtable_walk_init(&nl_table[iter->link].hash, &iter->hti,
GFP_KERNEL);
if (err) {
iter->link = MAX_LINKS;
return err;
}

rhashtable_walk_enter(&nl_table[iter->link].hash, &iter->hti);
rhashtable_walk_start(&iter->hti);

return 0;
Expand Down

0 comments on commit 6c4128f

Please sign in to comment.