Samba caseinsensitive lookup benchmark
James Peach
jamespeach at mac.com
Sat Apr 12 02:05:31 GMT 2008
On 11/04/2008, at 6:52 PM, Jeremy Allison wrote:
> On Fri, Apr 11, 2008 at 06:27:33PM -0700, James Peach wrote:
>>
>> errr ... looks like I already pushed this patch a while ago.
>
> Ah, didn't notice :-).
>
>> Here's the cleanup you suggest. I didn't alter the test in
>> unix_convert()
>> because it's testing !(conn->case_sensitive), rather than the
>> reverse.
>
> Broken mailer, wrapping @ 80 columns.
Broken mail reader doesn't understand format-flowed :P
> Can you resend as an attachment
> else your name won't be on it :-) ?
-------------- next part --------------
commit c019110592c4bd5e7911cb6286e1562b04eb5687
Author: James Peach <jpeach at samba.org>
Date: Fri Apr 11 18:27:47 2008 -0700
Tidy the cas-insensitive filesytem tests by introducing the
NO_CASE_MATCHING_SEARCH and FS_IS_CASE_INSENSITIVE macros.
diff --git a/source/include/smb.h b/source/include/smb.h
index d52d849..da60daf 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -674,6 +674,16 @@ typedef struct connection_struct {
struct notify_context *notify_ctx;
} connection_struct;
+/* True if the underlying filesystem for this connection is case-insensitive. */
+#define FS_IS_CASE_INSENSITIVE(conn) \
+ (! ((conn)->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH) )
+
+/* True if we should avoid doing case-matching filename searches on this
+ * connection.
+ */
+#define NO_CASE_MATCHING_SEARCH(conn) \
+ ( FS_IS_CASE_INSENSITIVE(conn) || ((conn)->case_sensitive) )
+
struct current_user {
connection_struct *conn;
uint16 vuid;
diff --git a/source/smbd/dir.c b/source/smbd/dir.c
index 6e02401..e207ddc 100644
--- a/source/smbd/dir.c
+++ b/source/smbd/dir.c
@@ -651,8 +651,7 @@ const char *dptr_ReadDirName(TALLOC_CTX *ctx,
* filesystem is case sensitive.
*/
- if (dptr->conn->case_sensitive ||
- !(dptr->conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) {
+ if (NO_CASE_MATCHING_SEARCH(dptr->conn)) {
/* We need to set the underlying dir_hnd offset to -1 also as
this function is usually called with the output from TellDir. */
dptr->dir_hnd->offset = *poffset = END_OF_DIRECTORY_OFFSET;
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index 4323e84..280edc1 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -250,7 +250,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
* authoratitive. JRA.
*/
- if((!conn->case_sensitive || !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) &&
+ if((!conn->case_sensitive || FS_IS_CASE_INSENSITIVE(conn)) &&
stat_cache_lookup(conn, &name, &dirpath, &start, &st)) {
*pst = st;
goto done;
@@ -301,7 +301,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
* won't help.
*/
- if ((conn->case_sensitive || !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) &&
+ if ((conn->case_sensitive || FS_IS_CASE_INSENSITIVE(conn)) &&
!mangle_is_mangled(name, conn->params)) {
goto done;
}
@@ -790,7 +790,7 @@ static bool scan_directory(connection_struct *conn, const char *path,
* good to search for a name. If a case variation of the name was
* there, then the original stat(2) would have found it.
*/
- if (!mangled && !(conn->fs_capabilities & FILE_CASE_SENSITIVE_SEARCH)) {
+ if (!mangled && NO_CASE_MATCHING_SEARCH(conn)) {
errno = ENOENT;
return False;
}
-------------- next part --------------
More information about the samba-technical
mailing list