aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_qfq.c
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2013-02-27 20:06:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:24 -0500
commitb67bfe0d42cac56c512dd5da4b1b347a23f4b70a (patch)
tree3d465aea12b97683f26ffa38eba8744469de9997 /net/sched/sch_qfq.c
parent1e142b29e210b5dfb2deeb6ce2210b60af16d2a6 (diff)
hlist: drop the node parameter from iterators
I'm not sure why, but the hlist for each entry iterators were conceived list_for_each_entry(pos, head, member) The hlist ones were greedy and wanted an extra parameter: hlist_for_each_entry(tpos, pos, head, member) Why did they need an extra pos parameter? I'm not quite sure. Not only they don't really need it, it also prevents the iterator from looking exactly like the list iterator, which is unfortunate. Besides the semantic patch, there was some manual work required: - Fix up the actual hlist iterators in linux/list.h - Fix up the declaration of other iterators based on the hlist ones. - A very small amount of places were using the 'node' parameter, this was modified to use 'obj->member' instead. - Coccinelle didn't handle the hlist_for_each_entry_safe iterator properly, so those had to be fixed up manually. The semantic patch which is mostly the work of Peter Senna Tschudin is here: @@ iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host; type T; expression a,c,d,e; identifier b; statement S; @@ -T b; <+... when != b ( hlist_for_each_entry(a, - b, c, d) S | hlist_for_each_entry_continue(a, - b, c) S | hlist_for_each_entry_from(a, - b, c) S | hlist_for_each_entry_rcu(a, - b, c, d) S | hlist_for_each_entry_rcu_bh(a, - b, c, d) S | hlist_for_each_entry_continue_rcu_bh(a, - b, c) S | for_each_busy_worker(a, c, - b, d) S | ax25_uid_for_each(a, - b, c) S | ax25_for_each(a, - b, c) S | inet_bind_bucket_for_each(a, - b, c) S | sctp_for_each_hentry(a, - b, c) S | sk_for_each(a, - b, c) S | sk_for_each_rcu(a, - b, c) S | sk_for_each_from -(a, b) +(a) S + sk_for_each_from(a) S | sk_for_each_safe(a, - b, c, d) S | sk_for_each_bound(a, - b, c) S | hlist_for_each_entry_safe(a, - b, c, d, e) S | hlist_for_each_entry_continue_rcu(a, - b, c) S | nr_neigh_for_each(a, - b, c) S | nr_neigh_for_each_safe(a, - b, c, d) S | nr_node_for_each(a, - b, c) S | nr_node_for_each_safe(a, - b, c, d) S | - for_each_gfn_sp(a, c, d, b) S + for_each_gfn_sp(a, c, d) S | - for_each_gfn_indirect_valid_sp(a, c, d, b) S + for_each_gfn_indirect_valid_sp(a, c, d) S | for_each_host(a, - b, c) S | for_each_host_safe(a, - b, c, d) S | for_each_mesh_entry(a, - b, c, d) S ) ...+> [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c] [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c] [akpm@linux-foundation.org: checkpatch fixes] [akpm@linux-foundation.org: fix warnings] [akpm@linux-foudnation.org: redo intrusive kvm changes] Tested-by: Peter Senna Tschudin <peter.senna@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Gleb Natapov <gleb@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/sched/sch_qfq.c')
-rw-r--r--net/sched/sch_qfq.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index 6ed37652a4c3..e9a77f621c3d 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -276,9 +276,8 @@ static struct qfq_aggregate *qfq_find_agg(struct qfq_sched *q,
276 u32 lmax, u32 weight) 276 u32 lmax, u32 weight)
277{ 277{
278 struct qfq_aggregate *agg; 278 struct qfq_aggregate *agg;
279 struct hlist_node *n;
280 279
281 hlist_for_each_entry(agg, n, &q->nonfull_aggs, nonfull_next) 280 hlist_for_each_entry(agg, &q->nonfull_aggs, nonfull_next)
282 if (agg->lmax == lmax && agg->class_weight == weight) 281 if (agg->lmax == lmax && agg->class_weight == weight)
283 return agg; 282 return agg;
284 283
@@ -670,14 +669,13 @@ static void qfq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
670{ 669{
671 struct qfq_sched *q = qdisc_priv(sch); 670 struct qfq_sched *q = qdisc_priv(sch);
672 struct qfq_class *cl; 671 struct qfq_class *cl;
673 struct hlist_node *n;
674 unsigned int i; 672 unsigned int i;
675 673
676 if (arg->stop) 674 if (arg->stop)
677 return; 675 return;
678 676
679 for (i = 0; i < q->clhash.hashsize; i++) { 677 for (i = 0; i < q->clhash.hashsize; i++) {
680 hlist_for_each_entry(cl, n, &q->clhash.hash[i], common.hnode) { 678 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
681 if (arg->count < arg->skip) { 679 if (arg->count < arg->skip) {
682 arg->count++; 680 arg->count++;
683 continue; 681 continue;
@@ -1376,11 +1374,10 @@ static unsigned int qfq_drop_from_slot(struct qfq_sched *q,
1376 struct hlist_head *slot) 1374 struct hlist_head *slot)
1377{ 1375{
1378 struct qfq_aggregate *agg; 1376 struct qfq_aggregate *agg;
1379 struct hlist_node *n;
1380 struct qfq_class *cl; 1377 struct qfq_class *cl;
1381 unsigned int len; 1378 unsigned int len;
1382 1379
1383 hlist_for_each_entry(agg, n, slot, next) { 1380 hlist_for_each_entry(agg, slot, next) {
1384 list_for_each_entry(cl, &agg->active, alist) { 1381 list_for_each_entry(cl, &agg->active, alist) {
1385 1382
1386 if (!cl->qdisc->ops->drop) 1383 if (!cl->qdisc->ops->drop)
@@ -1459,11 +1456,10 @@ static void qfq_reset_qdisc(struct Qdisc *sch)
1459{ 1456{
1460 struct qfq_sched *q = qdisc_priv(sch); 1457 struct qfq_sched *q = qdisc_priv(sch);
1461 struct qfq_class *cl; 1458 struct qfq_class *cl;
1462 struct hlist_node *n;
1463 unsigned int i; 1459 unsigned int i;
1464 1460
1465 for (i = 0; i < q->clhash.hashsize; i++) { 1461 for (i = 0; i < q->clhash.hashsize; i++) {
1466 hlist_for_each_entry(cl, n, &q->clhash.hash[i], common.hnode) { 1462 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
1467 if (cl->qdisc->q.qlen > 0) 1463 if (cl->qdisc->q.qlen > 0)
1468 qfq_deactivate_class(q, cl); 1464 qfq_deactivate_class(q, cl);
1469 1465
@@ -1477,13 +1473,13 @@ static void qfq_destroy_qdisc(struct Qdisc *sch)
1477{ 1473{
1478 struct qfq_sched *q = qdisc_priv(sch); 1474 struct qfq_sched *q = qdisc_priv(sch);
1479 struct qfq_class *cl; 1475 struct qfq_class *cl;
1480 struct hlist_node *n, *next; 1476 struct hlist_node *next;
1481 unsigned int i; 1477 unsigned int i;
1482 1478
1483 tcf_destroy_chain(&q->filter_list); 1479 tcf_destroy_chain(&q->filter_list);
1484 1480
1485 for (i = 0; i < q->clhash.hashsize; i++) { 1481 for (i = 0; i < q->clhash.hashsize; i++) {
1486 hlist_for_each_entry_safe(cl, n, next, &q->clhash.hash[i], 1482 hlist_for_each_entry_safe(cl, next, &q->clhash.hash[i],
1487 common.hnode) { 1483 common.hnode) {
1488 qfq_destroy_class(sch, cl); 1484 qfq_destroy_class(sch, cl);
1489 } 1485 }