okuyamak at dd.iij4u.or.jp
Tue Nov 7 01:12:51 GMT 2000
>>>>> "JA" == Jeremy Allison <jeremy at valinux.com> writes:
JA> The stat()/open() pair is inevitible due to the case insensitivity
JA> code. Imagine the following scenario :
JA> 1). On disk is the share relative pathname "An/upperCase/file/paTH"
JA> 2). Client sends an SMB open call for the pathname "AN/UPPERCASE/FILE/PATH".
JA> Now the statcache tries to convert this into the mixed case path on disk, it
JA> does this by trying to do a stat() on the (hopefully) cached pathname
Why? Why?? Whay??? Why do you look for file with stat(2)???
Why do you try to create "entire" pattern of what you want?
Don't "CREATE" world, "SEARCH"! Are you trying to search entire
2^19 patterns if you got filename like "/AN.UPPERCASE.FILE.PATH" ??
And find out that there's no such file?
Run readdir() for 'An/' 'An/upperCase/' 'An/upperCase/file/'.
# Well, it might be better with getdents(2).
This will give you entire list of what you have inside each
directory. That's only way to find the right answer. Or else,
your're only looking at "first" to find, not "ALL" the file.
#What do you do if you have both "An/upperCase/file/paTH" and
#"aN/UPPERcASE/FILE/PAth"? or "An/upperCase/file/pATH"?
# What is strategy for this treatment??
And once you read directory, you can cache it's information.
So, that second time if Samba was asked for something like
"AN/UPPERCASE/FILE/NAME", they can search both
"An/upperCase/file/" and "aN/UPPERcASE/FILE/" without re-reading
Kenichi Okuyama at Tokyo Research Lab. IBM-Japan, Co.
More information about the samba-technical