The Samba-Bugzilla – Attachment 7893 Details for
Bug 9161
We should re-add the vfs_Chdir() cache I removed.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.0.0.
0001-Sigh-.-Removing-optimization-prematurely-is-the-root.patch (text/plain), 2.51 KB, created by
Jeremy Allison
on 2012-09-13 19:56:43 UTC
(
hide
)
Description:
git-am fix for 4.0.0.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2012-09-13 19:56:43 UTC
Size:
2.51 KB
patch
obsolete
>From 56b752512597acaffa94a979ef9140760e0f5cf3 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 13 Sep 2012 10:13:21 -0700 >Subject: [PATCH] Sigh :-(. Removing optimization prematurely is the root of > all evil :-(. > >Sorry for the mistake, but the LastDir singleton cache in vfs_ChDir() >actually plays an important role. When we're processing a stream of >SMB1/SMB2/SMB3 requests we don't want to add a chdir()/getcwd() >system call pair on every request if they're all on the same connection >and dealing with the same base path. > >I did some testing with a program that times 1,000,000 chdir() >requests vs. 1,000,000 strcmp requests and it's a penalty of 10x >doing the system calls. > >Just because it's old code, doesn't mean it's bad :-(. > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Thu Sep 13 21:31:42 CEST 2012 on sn-devel-104 >--- > source3/smbd/globals.c | 1 + > source3/smbd/globals.h | 1 + > source3/smbd/vfs.c | 13 +++++++++++++ > 3 files changed, 15 insertions(+), 0 deletions(-) > >diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c >index 874f35d..80f6a66 100644 >--- a/source3/smbd/globals.c >+++ b/source3/smbd/globals.c >@@ -85,6 +85,7 @@ int conn_ctx_stack_ndx = 0; > > struct vfs_init_function_entry *backends = NULL; > char *sparse_buf = NULL; >+char *LastDir = NULL; > > struct smbd_parent_context *am_parent = NULL; > struct memcache *smbd_memcache_ctx = NULL; >diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h >index 1cefe51..566f04d 100644 >--- a/source3/smbd/globals.h >+++ b/source3/smbd/globals.h >@@ -101,6 +101,7 @@ extern int conn_ctx_stack_ndx; > struct vfs_init_function_entry; > extern struct vfs_init_function_entry *backends; > extern char *sparse_buf; >+extern char *LastDir; > > struct smbd_parent_context; > extern struct smbd_parent_context *am_parent; >diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c >index 7d19440..fe99ee2 100644 >--- a/source3/smbd/vfs.c >+++ b/source3/smbd/vfs.c >@@ -801,14 +801,27 @@ int vfs_ChDir(connection_struct *conn, const char *path) > { > int ret; > >+ if (!LastDir) { >+ LastDir = SMB_STRDUP(""); >+ } >+ > if (strcsequal(path,".")) { > return 0; > } > >+ if (*path == '/' && strcsequal(LastDir,path)) { >+ return 0; >+ } >+ > DEBUG(4,("vfs_ChDir to %s\n",path)); > > ret = SMB_VFS_CHDIR(conn,path); > if (ret == 0) { >+ /* Global cache. */ >+ SAFE_FREE(LastDir); >+ LastDir = SMB_STRDUP(path); >+ >+ /* conn cache. */ > TALLOC_FREE(conn->cwd); > conn->cwd = vfs_GetWd(conn, conn); > DEBUG(4,("vfs_ChDir got %s\n",conn->cwd)); >-- >1.7.7.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
vl
:
review+
Actions:
View
Attachments on
bug 9161
: 7893