[PATCH] Only walk a directory once in vfs dirsort module

Andreas Schneider asn at samba.org
Thu Feb 9 17:06:03 UTC 2017


currently in the dirsort module we walk a directory twice. First to count the 
file and allocate memory and then to fill it.

I created a patch to only walk it once. I have a customer who walks ~200k 
files. I optimized it to need not to much memory, so I don't double the memory 
allocation. For 200k files you need ~56MB. If the memory is out at 55 and we 
doulbe it, we would allocate 110 MB for a few more files.

The speed up is big enough to have a few more memory alloctation but don't use 
too much memory.

Review and push appreciated.



Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-vfs-Only-walk-the-directory-once-in-open_and_sort.patch
Type: text/x-patch
Size: 3203 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170209/548311c6/0001-s3-vfs-Only-walk-the-directory-once-in-open_and_sort.bin>

More information about the samba-technical mailing list