[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5048D6DE.8090805@gmail.com>
Date: Thu, 06 Sep 2012 19:01:18 +0200
From: Sasha Levin <levinsasha928@...il.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
CC: Steven Rostedt <rostedt@...dmis.org>,
Josh Triplett <josh@...htriplett.org>,
Pedro Alves <palves@...hat.com>, Tejun Heo <tj@...nel.org>,
torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
paul.gortmaker@...driver.com, davem@...emloft.net, mingo@...e.hu,
ebiederm@...ssion.com, aarcange@...hat.com, ericvh@...il.com,
netdev@...r.kernel.org, eric.dumazet@...il.com, axboe@...nel.dk,
agk@...hat.com, dm-devel@...hat.com, neilb@...e.de,
ccaulfie@...hat.com, teigland@...hat.com,
Trond.Myklebust@...app.com, bfields@...ldses.org,
fweisbec@...il.com, jesse@...ira.com,
venkat.x.venkatsubra@...cle.com, ejt@...hat.com,
snitzer@...hat.com, edumazet@...gle.com, linux-nfs@...r.kernel.org,
dev@...nvswitch.org, rds-devel@....oracle.com, lw@...fujitsu.com
Subject: Re: [PATCH v3 01/17] hashtable: introduce a small and naive hashtable
On 09/06/2012 06:50 PM, Mathieu Desnoyers wrote:
> * Sasha Levin (levinsasha928@...il.com) wrote:
>> On 09/06/2012 06:00 PM, Steven Rostedt wrote:
>>>>> I think that that code doesn't make sense. The users of hlist_for_each_* aren't
>>>>> supposed to be changing the loop cursor.
>>> I totally agree. Modifying the 'node' pointer is just asking for issues.
>>> Yes that is error prone, but not due to the double loop. It's due to the
>>> modifying of the node pointer that is used internally by the loop
>>> counter. Don't do that :-)
>>
>> While we're on this subject, I haven't actually seen hlist_for_each_entry() code
>> that even *touches* 'pos'.
>>
>> Will people yell at me loudly if I change the prototype of those macros to be:
>>
>> hlist_for_each_entry(tpos, head, member)
>>
>> (Dropping the 'pos' parameter), and updating anything that calls those macros to
>> drop it as well?
>
> I think the intent there is to keep hlist macros and list macros
> slightly in sync. Given those are vastly used, I'm not sure you want to
> touch them. But hey, that's just my 2 cents.
Actually, the corresponding list macro looks like this:
list_for_each_entry(pos, head, member)
With 'pos' being the equivalent of 'tpos' in the hlist macros (the type *).
Changing hlist macro will make them both look as follows:
hlist_for_each_entry(pos, head, member)
list_for_each_entry(pos, head, member)
So following this suggesting will actually bring them back to sync...
The only issue I can see is that as you've said, they're used almost everywhere,
so doing something to change that will require some coordination.
Thanks,
Sasha
--
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