Re: [PATCH 1/5] slab: rename obj_reallen to obj_size

Manfred Spraul
2005-11-19T12:34:44Z

Pekka Enberg wrote:

>user_offset is more readable.
>
>
>
Ok.

>>+ int user_size;
>>
>>
>
>
>
>> #endif
>> };
>>-static int obj_dbghead(kmem_cache_t *cachep)
>>+static int obj_user_off(kmem_cache_t *cachep)
>>
>>
>
>So why not call the above obj_offset() ?
>
>
>
It would just cause confusion: The name of the function and the name of
the member must be identical.
The purpose of obj_user_off() is to hide an optimization:
cachep->user_off is always 0 when debugging is disabled. Therefore the
member doesn't even exist with CONFIG_DEBUG_SLAB=n, and all accesses are
hardcoded to 0.
This is achieved by using obj_user_off(cachep) instead of
cachep->user_off. If the name of the helper and the name of the struct
member differ, then noone would understand the code.
I'll do a new patch with user_offset instead of user_off, ok?

--
Manfred