diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2016-02-26 01:55:00 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-01 01:02:33 +0300 |
commit | 86a7996cc8a078793670d82ed97d5a99bb4e8496 (patch) | |
tree | 8e5d26eb9e58b0c362c66f73baa5261793223178 /net/sched/sch_htb.c | |
parent | f12d33f4d83c6837d176e1aef337914089c77957 (diff) | |
download | linux-86a7996cc8a078793670d82ed97d5a99bb4e8496.tar.xz |
net_sched: introduce qdisc_replace() helper
Remove nearly duplicated code and prepare for the following patch.
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r-- | net/sched/sch_htb.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 15ccd7f8fb2a..0efbcf358cd0 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -1163,14 +1163,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, cl->common.classid)) == NULL) return -ENOBUFS; - sch_tree_lock(sch); - *old = cl->un.leaf.q; - cl->un.leaf.q = new; - if (*old != NULL) { - qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); - qdisc_reset(*old); - } - sch_tree_unlock(sch); + *old = qdisc_replace(sch, new, &cl->un.leaf.q); return 0; } |