[patch]: optimization for findfirst when in case-sensitive mode
Matt Mitchell
mmitchell at virtualproperties.com
Fri Dec 10 23:41:08 GMT 2004
Jeremy (and all),
Here is a first crack at a patch implementing an optimization where,
given that
- the connection is case-sensitive
- the request is not for a wildcard
- the client is doing a FINDFIRST (i.e. is looking for a particular file)
the smbd process will not perform a potentially costly OpenDir but
instead will just use the SMB_VFS_STAT's answer to determine whether or
not the file exists.
I originally implemented the patch against 3.0.8 (said patch is also
attached) but reworked it against HEAD.
The populate_lanman2_dir_entry function (which was needed to avoid the
OpenDir in get_lanman2_dir_entry) should be generalized and shared among
the other functions that return lanman dir information. I did not
undertake this for this patch, rather thinking that I would like
feedback first.
The motivation behind this patch was to eliminate the unnecessary
readdirs when the server is in case-sensitive mode. Our particular
problem was in migrating huge directories (100ks of files) from Win to
Linux, and it happens that our app enforces case sensitivity anyway, so
we don't need it. The old algorithm slows proportionally to the number
of files in a directory; this will run as fast as the underlying vfs stat.
Any comments or slams appreciated. Yes, it is a hack.
-m
More information about the samba-technical
mailing list