On Fri, Feb 01, 2013 at 11:04:36PM +0800, Feng Gao wrote:
>    Hi Greg,
>    I have a question.
>    There are two duplicated lines now.
>                           dh->expires = now +
>    msecs_to_jiffies(hinfo->cfg.expire);
>                           rateinfo_recalc(dh, now, hinfo->cfg.mode);
>    1# case: The dsthash_find return a valid dh;
>    2# case: There is a race. The race is true.
>    Why we could not adopt the method I sent before.
>        dh = dsthash_find(hinfo, &dst);
>        if (dh == NULL) {
>            dh = dsthash_alloc_init(hinfo, &dst, &new_node);
>            if (dh == NULL) {
>                rcu_read_unlock_bh();
>                goto hotdrop;
>            }
>        }
>        if (new_node) {
>            dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire);
>            rateinfo_init(dh, hinfo);
>        } else {
>            /* update expiration timeout */
>            dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire);
>            rateinfo_recalc(dh, now, hinfo->cfg.mode);
>        }
>    I think it could avoid the two duplicated lines.

That's a cleanup, send me a follow up patch for that if you want.

Greg, please, don't back down this patch, it's fixing a real problem.

Gao is proposing some code refactoring to save line a couple of lines
of code.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to