diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-15 10:46:23 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-11-18 23:16:13 +0100 |
commit | d1c34d405421e2969d6cf4fc7438f783e7d6b0a5 (patch) | |
tree | 031d6a32c255db2a6a13d3a04bc4ea881129585d /source3/smbd/msdfs.c | |
parent | f6650f5d19ad90b8e1f392efbe211c4ffa0e70c0 (diff) | |
download | samba-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/msdfs.c')
-rw-r--r-- | source3/smbd/msdfs.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index fce8417045..dcef75e094 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -419,8 +419,7 @@ static bool is_msdfs_link_internal(TALLOC_CTX *ctx, #endif size_t bufsize = 0; char *link_target = NULL; - struct smb_filename *smb_fname = NULL; - NTSTATUS status; + struct smb_filename smb_fname; if (pp_link_target) { bufsize = 1024; @@ -434,28 +433,22 @@ static bool is_msdfs_link_internal(TALLOC_CTX *ctx, link_target = link_target_buf; } - status = create_synthetic_smb_fname(talloc_tos(), path, NULL, NULL, - &smb_fname); - if (!NT_STATUS_IS_OK(status)) { - goto err; - } + ZERO_STRUCT(smb_fname); + smb_fname.base_name = discard_const_p(char, path); - if (SMB_VFS_LSTAT(conn, smb_fname) != 0) { + if (SMB_VFS_LSTAT(conn, &smb_fname) != 0) { DEBUG(5,("is_msdfs_link_read_target: %s does not exist.\n", path)); - TALLOC_FREE(smb_fname); goto err; } - if (!S_ISLNK(smb_fname->st.st_ex_mode)) { + if (!S_ISLNK(smb_fname.st.st_ex_mode)) { DEBUG(5,("is_msdfs_link_read_target: %s is not a link.\n", path)); - TALLOC_FREE(smb_fname); goto err; } if (sbufp != NULL) { - *sbufp = smb_fname->st; + *sbufp = smb_fname.st; } - TALLOC_FREE(smb_fname); referral_len = SMB_VFS_READLINK(conn, path, link_target, bufsize - 1); if (referral_len == -1) { |