[PATCH 3/3 v3] vfs_glusterfs: Samba VFS module for glusterfs

Simo idra at samba.org
Thu May 23 10:37:20 MDT 2013


On 05/23/2013 10:27 AM, Christopher R. Hertel wrote:
> On Mon, May 20, 2013 at 04:10:32PM -0700, Anand Avati wrote:
>> On 5/20/13 3:38 PM, Andrew Bartlett wrote:
>>> On Mon, 2013-05-20 at 03:11 -0400, Anand Avati wrote:
>>>> Implement a Samba VFS plugin for glusterfs based on gluster's gfapi.
>>>> This is a "bottom" vfs plugin (not something to be stacked on top of
>>>> another module), and translates (most) calls into closest actions
>>>> on gfapi.
>>> Thanks for getting back to us.
>>>
>>> The comment I have is however still around the realloc stuff.  Is
>>> talloc_realloc() so slow that there is such value in having the code
>>> realloc 1024 or 16 more entries than are required?
>>>
>>> It would seem clearer if we just allocated exactly the array size
>>> needed.   That would also allow bounds checkers like valgrind to
>>> correctly know the 'real' allocated size.
>>>
>>> It just smells to me like premature optimisation, and means you have to
>>> do the partial array memset() which always makes me nervous.
>>>
>>> That said, this isn't an objection, just an observation.
>>>
>> It wasn't really about talloc_XXX() being slow. It is just a standard
>> technique generally used in many places. I can change the code to
>> increase allocation count by one if anybody else too shares your opinion.
> "Standard techniques" are, in general, only standard within the scope of
> one's experience.  The Samba Team has, over the course of 20+ years,
> developed many of their own standards.  What Abartlet is describing is an
> approach common to Samba.
>
> Since the module is to be included in the Samba distribution, I'd vote
> in favor of using Samba conventions.  That will help us get the code
> through the review process and into the Master branch.

There is no convention in samba for making code slower.
(higher number of memory allocations in a hot code path do just that).

Andrew just described his own preference. I used array preallocation 
before where useful, I believe in samba code as well.

Simo.



More information about the samba-technical mailing list