[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20151013.185448.842417293758576210.davem@davemloft.net>
Date: Tue, 13 Oct 2015 18:54:48 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: xiyou.wangcong@...il.com
Cc: netdev@...r.kernel.org, jhs@...atatu.com
Subject: Re: [Patch net-next 1/4] net_sched: introduce qdisc_replace()
helper
From: Cong Wang <xiyou.wangcong@...il.com>
Date: Mon, 12 Oct 2015 11:38:00 -0700
> Remove nearly duplicated code and prepare for the following patch.
>
> Cc: Jamal Hadi Salim <jhs@...atatu.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
This isn't an equivalent transformation:
> +static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new,
> + struct Qdisc **pold)
> +{
> + struct Qdisc *old;
> +
> + sch_tree_lock(sch);
> + old = *pold;
> + *pold = new;
> + if (old != NULL) {
> + qdisc_tree_decrease_qlen(old, old->q.qlen);
> + qdisc_reset(old);
> + }
> + sch_tree_unlock(sch);
> +
> + return old;
> +}
> +
Is not the same as:
> diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
> index f26bdea..c76cdd4 100644
> --- a/net/sched/sch_drr.c
> +++ b/net/sched/sch_drr.c
> @@ -226,11 +226,7 @@ static int drr_graft_class(struct Qdisc *sch, unsigned long arg,
> new = &noop_qdisc;
> }
>
> - sch_tree_lock(sch);
> - drr_purge_queue(cl);
> - *old = cl->qdisc;
> - cl->qdisc = new;
> - sch_tree_unlock(sch);
> + *old = qdisc_replace(sch, new, &cl->qdisc);
> return 0;
> }
>
This.
If you want to change semantics, you must do it explicitly in a separate
commit with a detailed commit message explaining how and why.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists