summaryrefslogtreecommitdiff
path: root/source3/smbd/statcache.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-15 10:46:23 +0100
committerVolker Lendecke <vl@samba.org>2009-11-18 23:16:13 +0100
commitd1c34d405421e2969d6cf4fc7438f783e7d6b0a5 (patch)
tree031d6a32c255db2a6a13d3a04bc4ea881129585d /source3/smbd/statcache.c
parentf6650f5d19ad90b8e1f392efbe211c4ffa0e70c0 (diff)
downloadsamba-d1c34d405421e2969d6cf4fc7438f783e7d6b0a5.tar.gz
samba-d1c34d405421e2969d6cf4fc7438f783e7d6b0a5.tar.bz2
samba-d1c34d405421e2969d6cf4fc7438f783e7d6b0a5.zip
s3: Replace some create_synthetic_smb_fname() calls
In very hot codepaths like the statcache copy_smb_filename and the subsequent recursive talloc_free is noticable in the CPU load.
Diffstat (limited to 'source3/smbd/statcache.c')
-rw-r--r--source3/smbd/statcache.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index da52cc05d4..db347b5b7e 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -175,8 +175,7 @@ bool stat_cache_lookup(connection_struct *conn,
DATA_BLOB data_val;
char *name;
TALLOC_CTX *ctx = talloc_tos();
- struct smb_filename *smb_fname = NULL;
- NTSTATUS status;
+ struct smb_filename smb_fname;
*pp_dirpath = NULL;
*pp_start = *pp_name;
@@ -276,25 +275,18 @@ bool stat_cache_lookup(connection_struct *conn,
"-> [%s]\n", chk_name, translated_path ));
DO_PROFILE_INC(statcache_hits);
- status = create_synthetic_smb_fname(talloc_tos(), translated_path,
- NULL, NULL, &smb_fname);
- if (!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(chk_name);
- TALLOC_FREE(translated_path);
- return false;
- }
+ ZERO_STRUCT(smb_fname);
+ smb_fname.base_name = translated_path;
- if (SMB_VFS_STAT(conn, smb_fname) != 0) {
+ if (SMB_VFS_STAT(conn, &smb_fname) != 0) {
/* Discard this entry - it doesn't exist in the filesystem. */
memcache_delete(smbd_memcache(), STAT_CACHE,
data_blob_const(chk_name, strlen(chk_name)));
TALLOC_FREE(chk_name);
TALLOC_FREE(translated_path);
- TALLOC_FREE(smb_fname);
return False;
}
- *pst = smb_fname->st;
- TALLOC_FREE(smb_fname);
+ *pst = smb_fname.st;
if (!sizechanged) {
memcpy(*pp_name, translated_path,