From d1c34d405421e2969d6cf4fc7438f783e7d6b0a5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 15 Nov 2009 10:46:23 +0100 Subject: 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. --- source3/smbd/msdfs.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'source3/smbd/msdfs.c') 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) { -- cgit