[sheepdog] [PATCH V2 1/2] sheep: simplify client_decref() and move it into free_request() and add a helper function

Yunkai Zhang yunkai.me at gmail.com
Fri Jul 6 12:24:14 CEST 2012


On Fri, Jul 6, 2012 at 6:13 PM, Christoph Hellwig <hch at infradead.org> wrote:
>> +static void clear_client(struct client_info *ci)
>> +{
>> +     if (!list_empty(&ci->conn.blocking_siblings))
>> +             list_del_init(&ci->conn.blocking_siblings);
>> +
>> +     unregister_event(ci->conn.fd);
>
> Is a double unregister-event fine?  It seems like we don't protect
> against that here.

I think it's no harm, unregister_event will call lookup_event() to check it.

>
>>  static void client_decref(struct client_info *ci)
>>  {
>> -     if (ci && --ci->refcnt == 0)
>> -             destroy_client(ci);
>> +     if (ci)
>> +             ci->refcnt--;
>
> It seems like client_incref / client_decref should just go away,
> they contain an unneeded NULL check and otherwise just do a trivial
> -- / ++ operation and only have a singler caller each.

Right, I can drop these two functions if these series have not other problem.

>



-- 
Yunkai Zhang
Work at Taobao



More information about the sheepdog mailing list