On Thu, Jan 14, 2010 at 1:04 PM, Erez Zilber <[email protected]> wrote: > On Thu, Jan 14, 2010 at 10:44 AM, Ulrich Windl > <[email protected]> wrote: >> On 13 Jan 2010 at 18:56, Erez Zilber wrote: >> >> Hi! >> >> I wonder whether the #define could be replaced with an inline function. >> The readability would be much better, and the code should be more or >> less the same, unless you need special macro processing. For code size >> we could even try to make it a "normal" routine (i.e. not inlined). The >> performance might suffer a little bit, however. >> >> Also: With "-O3" gcc usually automatically inlines short "static" >> (locally defined?) routines. >> > > We can make it inline instead of using a macro. I used macros because > this is what we had till now, and I didn't want to change that. The > only problem with inline functions is that it's up to the compiler to > decide if the function will be inlined. This may affect performance in > some cases. > > Erez >
One more thing: take a look at _iscsi_sw_tcp_log. If we have a large amount of contexts in the module (connection, session, error handling, data transfer, socket, module etc), the switch block may become quite large. I don't know if the compiler will decide to make such a function inline. Erez
-- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
