rhashtable: Change rhashtable_walk_start to return void
Most callers of rhashtable_walk_start don't care about a resize event which is indicated by a return value of -EAGAIN. So calls to rhashtable_walk_start are wrapped wih code to ignore -EAGAIN. Something like this is common: ret = rhashtable_walk_start(rhiter); if (ret && ret != -EAGAIN) goto out; Since zero and -EAGAIN are the only possible return values from the function this check is pointless. The condition never evaluates to true. This patch changes rhashtable_walk_start to return void. This simplifies code for the callers that ignore -EAGAIN. For the few cases where the caller cares about the resize event, particularly where the table can be walked in mulitple parts for netlink or seq file dump, the function rhashtable_walk_start_check has been added that returns -EAGAIN on a resize event. Signed-off-by: Tom Herbert <tom@quantonium.net> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
a0b586fa75
commit
97a6ec4ac0
@@ -257,9 +257,7 @@ __mesh_path_lookup_by_idx(struct mesh_table *tbl, int idx)
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
ret = rhashtable_walk_start(&iter);
|
||||
if (ret && ret != -EAGAIN)
|
||||
goto err;
|
||||
rhashtable_walk_start(&iter);
|
||||
|
||||
while ((mpath = rhashtable_walk_next(&iter))) {
|
||||
if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
|
||||
@@ -269,7 +267,6 @@ __mesh_path_lookup_by_idx(struct mesh_table *tbl, int idx)
|
||||
if (i++ == idx)
|
||||
break;
|
||||
}
|
||||
err:
|
||||
rhashtable_walk_stop(&iter);
|
||||
rhashtable_walk_exit(&iter);
|
||||
|
||||
@@ -513,9 +510,7 @@ void mesh_plink_broken(struct sta_info *sta)
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
ret = rhashtable_walk_start(&iter);
|
||||
if (ret && ret != -EAGAIN)
|
||||
goto out;
|
||||
rhashtable_walk_start(&iter);
|
||||
|
||||
while ((mpath = rhashtable_walk_next(&iter))) {
|
||||
if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
|
||||
@@ -535,7 +530,6 @@ void mesh_plink_broken(struct sta_info *sta)
|
||||
WLAN_REASON_MESH_PATH_DEST_UNREACHABLE, bcast);
|
||||
}
|
||||
}
|
||||
out:
|
||||
rhashtable_walk_stop(&iter);
|
||||
rhashtable_walk_exit(&iter);
|
||||
}
|
||||
@@ -584,9 +578,7 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta)
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
ret = rhashtable_walk_start(&iter);
|
||||
if (ret && ret != -EAGAIN)
|
||||
goto out;
|
||||
rhashtable_walk_start(&iter);
|
||||
|
||||
while ((mpath = rhashtable_walk_next(&iter))) {
|
||||
if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
|
||||
@@ -597,7 +589,7 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta)
|
||||
if (rcu_access_pointer(mpath->next_hop) == sta)
|
||||
__mesh_path_del(tbl, mpath);
|
||||
}
|
||||
out:
|
||||
|
||||
rhashtable_walk_stop(&iter);
|
||||
rhashtable_walk_exit(&iter);
|
||||
}
|
||||
@@ -614,9 +606,7 @@ static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
ret = rhashtable_walk_start(&iter);
|
||||
if (ret && ret != -EAGAIN)
|
||||
goto out;
|
||||
rhashtable_walk_start(&iter);
|
||||
|
||||
while ((mpath = rhashtable_walk_next(&iter))) {
|
||||
if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
|
||||
@@ -627,7 +617,7 @@ static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
|
||||
if (ether_addr_equal(mpath->mpp, proxy))
|
||||
__mesh_path_del(tbl, mpath);
|
||||
}
|
||||
out:
|
||||
|
||||
rhashtable_walk_stop(&iter);
|
||||
rhashtable_walk_exit(&iter);
|
||||
}
|
||||
@@ -642,9 +632,7 @@ static void table_flush_by_iface(struct mesh_table *tbl)
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
ret = rhashtable_walk_start(&iter);
|
||||
if (ret && ret != -EAGAIN)
|
||||
goto out;
|
||||
rhashtable_walk_start(&iter);
|
||||
|
||||
while ((mpath = rhashtable_walk_next(&iter))) {
|
||||
if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
|
||||
@@ -653,7 +641,7 @@ static void table_flush_by_iface(struct mesh_table *tbl)
|
||||
break;
|
||||
__mesh_path_del(tbl, mpath);
|
||||
}
|
||||
out:
|
||||
|
||||
rhashtable_walk_stop(&iter);
|
||||
rhashtable_walk_exit(&iter);
|
||||
}
|
||||
@@ -873,9 +861,7 @@ void mesh_path_tbl_expire(struct ieee80211_sub_if_data *sdata,
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
ret = rhashtable_walk_start(&iter);
|
||||
if (ret && ret != -EAGAIN)
|
||||
goto out;
|
||||
rhashtable_walk_start(&iter);
|
||||
|
||||
while ((mpath = rhashtable_walk_next(&iter))) {
|
||||
if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
|
||||
@@ -887,7 +873,7 @@ void mesh_path_tbl_expire(struct ieee80211_sub_if_data *sdata,
|
||||
time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
|
||||
__mesh_path_del(tbl, mpath);
|
||||
}
|
||||
out:
|
||||
|
||||
rhashtable_walk_stop(&iter);
|
||||
rhashtable_walk_exit(&iter);
|
||||
}
|
||||
|
Reference in New Issue
Block a user