]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph_new: add profiling support
authorShweta Sodani <sodanishweta@gmail.com>
Thu, 2 Jan 2025 13:42:08 +0000 (19:12 +0530)
committerGünther Deschner <gd@samba.org>
Mon, 13 Jan 2025 21:26:34 +0000 (21:26 +0000)
Signed-off-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Mon Jan 13 21:26:34 UTC 2025 on atb-devel-224

source3/modules/vfs_ceph_new.c

index 808cdb548ab7061abb139465baf737ced3908fb1..0798b57c726e316e730585cfda371606902948b4 100644 (file)
@@ -2005,6 +2005,7 @@ static DIR *vfs_ceph_fdopendir(struct vfs_handle_struct *handle,
        void *result = NULL;
        struct vfs_ceph_fh *cfh = NULL;
 
+       START_PROFILE(syscall_fdopendir);
        DBG_DEBUG("[CEPH] fdopendir(%p, %p)\n", handle, fsp);
        ret = vfs_ceph_fetch_fh(handle, fsp, &cfh);
        if (ret != 0) {
@@ -2021,6 +2022,7 @@ out:
        if (ret != 0) {
                errno = -ret;
        }
+       END_PROFILE(syscall_fdopendir);
        return (DIR *)result;
 }
 
@@ -2033,12 +2035,13 @@ static struct dirent *vfs_ceph_readdir(struct vfs_handle_struct *handle,
        int saved_errno = errno;
        int ret = -1;
 
+       START_PROFILE(syscall_readdir);
        DBG_DEBUG("[CEPH] readdir(%p, %p)\n", handle, dirp);
 
        result = vfs_ceph_get_fh_dirent(dircfh);
        if (result == NULL) {
                /* Memory allocation failure */
-               return NULL;
+               goto out;
        }
 
        /* The low-level call uses 'dircfh->de' which is now 'result' */
@@ -2058,6 +2061,8 @@ static struct dirent *vfs_ceph_readdir(struct vfs_handle_struct *handle,
                DBG_DEBUG("[CEPH] readdir(...) = %p\n", result);
        }
        errno = saved_errno;
+out:
+       END_PROFILE(syscall_readdir);
        return result;
 }
 
@@ -2065,8 +2070,10 @@ static void vfs_ceph_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
 {
        const struct vfs_ceph_fh *dircfh = (const struct vfs_ceph_fh *)dirp;
 
+       START_PROFILE(syscall_rewinddir);
        DBG_DEBUG("[CEPH] rewinddir(%p, %p)\n", handle, dirp);
        vfs_ceph_ll_rewinddir(handle, dircfh);
+       END_PROFILE(syscall_rewinddir);
 }
 
 static int vfs_ceph_mkdirat(struct vfs_handle_struct *handle,
@@ -2079,6 +2086,7 @@ static int vfs_ceph_mkdirat(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *dircfh = NULL;
        struct vfs_ceph_iref iref = {0};
 
+       START_PROFILE(syscall_mkdirat);
        DBG_DEBUG("[CEPH] mkdirat(%p, %s)\n", handle, name);
        result = vfs_ceph_fetch_fh(handle, dirfsp, &dircfh);
        if (result != 0) {
@@ -2089,6 +2097,7 @@ static int vfs_ceph_mkdirat(struct vfs_handle_struct *handle,
        vfs_ceph_iput(handle, &iref);
 out:
        DBG_DEBUG("[CEPH] mkdirat(...) = %d\n", result);
+       END_PROFILE(syscall_mkdirat);
        return status_code(result);
 }
 
@@ -2097,11 +2106,13 @@ static int vfs_ceph_closedir(struct vfs_handle_struct *handle, DIR *dirp)
        int result;
        struct vfs_ceph_fh *cfh = (struct vfs_ceph_fh *)dirp;
 
+       START_PROFILE(syscall_closedir);
        DBG_DEBUG("[CEPH] closedir(%p, %p)\n", handle, dirp);
        result = vfs_ceph_ll_releasedir(handle, cfh);
        vfs_ceph_release_fh(cfh);
        vfs_ceph_remove_fh(handle, cfh->fsp);
        DBG_DEBUG("[CEPH] closedir(...) = %d\n", result);
+       END_PROFILE(syscall_closedir);
        return status_code(result);
 }
 
@@ -2119,14 +2130,15 @@ static int vfs_ceph_openat(struct vfs_handle_struct *handle,
        mode_t mode = how->mode;
        int result = -ENOENT;
 
+       START_PROFILE(syscall_openat);
        if (how->resolve != 0) {
-               errno = ENOSYS;
-               return -1;
+               result = -ENOSYS;
+               goto err_out;
        }
 
        if (smb_fname->stream_name) {
-               errno = ENOENT;
-               return -1;
+               result = -ENOENT;
+               goto err_out;
        }
 
 #ifdef O_PATH
@@ -2191,7 +2203,9 @@ static int vfs_ceph_openat(struct vfs_handle_struct *handle,
 out:
        vfs_ceph_iput(handle, &diref);
        fsp->fsp_flags.have_proc_fds = false;
+err_out:
        DBG_DEBUG("[CEPH] open(...) = %d\n", result);
+       END_PROFILE(syscall_openat);
        return status_code(result);
 }
 
@@ -2200,6 +2214,7 @@ static int vfs_ceph_close(struct vfs_handle_struct *handle, files_struct *fsp)
        int result;
        struct vfs_ceph_fh *cfh = NULL;
 
+       START_PROFILE(syscall_close);
        DBG_DEBUG("[CEPH] close(%p, %p)\n", handle, fsp);
        result = vfs_ceph_fetch_fh(handle, fsp, &cfh);
        if (result != 0) {
@@ -2210,6 +2225,7 @@ static int vfs_ceph_close(struct vfs_handle_struct *handle, files_struct *fsp)
        vfs_ceph_remove_fh(handle, fsp);
 out:
        DBG_DEBUG("[CEPH] close(...) = %d\n", result);
+       END_PROFILE(syscall_close);
        return status_code(result);
 }
 
@@ -2222,6 +2238,7 @@ static ssize_t vfs_ceph_pread(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *cfh = NULL;
        ssize_t result;
 
+       START_PROFILE_BYTES(syscall_pread, n);
        DBG_DEBUG("[CEPH] pread(%p, %p, %p, %llu, %llu)\n",
                  handle,
                  fsp,
@@ -2237,6 +2254,7 @@ static ssize_t vfs_ceph_pread(struct vfs_handle_struct *handle,
        result = vfs_ceph_ll_read(handle, cfh, offset, n, data);
 out:
        DBG_DEBUG("[CEPH] pread(...) = %llu\n", llu(result));
+       END_PROFILE_BYTES(syscall_pread);
        return lstatus_code(result);
 }
 
@@ -2313,6 +2331,7 @@ static ssize_t vfs_ceph_pwrite(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *cfh = NULL;
        ssize_t result;
 
+       START_PROFILE_BYTES(syscall_pwrite, n);
        DBG_DEBUG("[CEPH] pwrite(%p, %p, %p, %llu, %llu)\n",
                  handle,
                  fsp,
@@ -2327,6 +2346,7 @@ static ssize_t vfs_ceph_pwrite(struct vfs_handle_struct *handle,
        result = vfs_ceph_ll_write(handle, cfh, offset, n, data);
 out:
        DBG_DEBUG("[CEPH] pwrite(...) = %llu\n", llu(result));
+       END_PROFILE_BYTES(syscall_pwrite);
        return lstatus_code(result);
 }
 
@@ -2403,6 +2423,7 @@ static off_t vfs_ceph_lseek(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *cfh = NULL;
        intmax_t result = 0;
 
+       START_PROFILE(syscall_lseek);
        DBG_DEBUG(
                "[CEPH] lseek(%p, %p, %zd, %d)\n", handle, fsp, offset, whence);
        result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
@@ -2412,6 +2433,7 @@ static off_t vfs_ceph_lseek(struct vfs_handle_struct *handle,
 
        result = vfs_ceph_ll_lseek(handle, cfh, offset, whence);
 out:
+       END_PROFILE(syscall_lseek);
        return lstatus_code(result);
 }
 
@@ -2466,6 +2488,7 @@ static int vfs_ceph_renameat(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *dst_dircfh = NULL;
        int result = -1;
 
+       START_PROFILE(syscall_renameat);
        DBG_DEBUG("[CEPH] renameat(%p, %p, %s, %p, %s)\n",
                  handle,
                  srcfsp,
@@ -2474,13 +2497,13 @@ static int vfs_ceph_renameat(struct vfs_handle_struct *handle,
                  smb_fname_dst->base_name);
 
        if (smb_fname_src->stream_name || smb_fname_dst->stream_name) {
-               errno = ENOENT;
-               return result;
+               result = -ENOENT;
+               goto out;
        }
 
        if (how->flags != 0) {
-               errno = EINVAL;
-               return -1;
+               result = -EINVAL;
+               goto out;
        }
 
        result = vfs_ceph_fetch_fh(handle, srcfsp, &src_dircfh);
@@ -2499,6 +2522,7 @@ static int vfs_ceph_renameat(struct vfs_handle_struct *handle,
                                    dst_dircfh,
                                    smb_fname_dst->base_name);
 out:
+       END_PROFILE(syscall_renameat);
        return status_code(result);
 }
 
@@ -2566,13 +2590,14 @@ static int vfs_ceph_stat(struct vfs_handle_struct *handle,
        int result = -1;
        struct vfs_ceph_iref iref = {0};
 
+       START_PROFILE(syscall_stat);
        DBG_DEBUG("[CEPH] stat(%p, %s)\n",
                  handle,
                  smb_fname_str_dbg(smb_fname));
 
        if (smb_fname->stream_name) {
-               errno = ENOENT;
-               return result;
+               result = -ENOENT;
+               goto out;
        }
 
        result = vfs_ceph_iget_by_fname(handle, smb_fname, &iref);
@@ -2588,6 +2613,7 @@ static int vfs_ceph_stat(struct vfs_handle_struct *handle,
        DBG_DEBUG("[CEPH] mode = 0x%x\n", smb_fname->st.st_ex_mode);
 out:
        vfs_ceph_iput(handle, &iref);
+       END_PROFILE(syscall_stat);
        return status_code(result);
 }
 
@@ -2598,6 +2624,7 @@ static int vfs_ceph_fstat(struct vfs_handle_struct *handle,
        int result = -1;
        struct vfs_ceph_fh *cfh = NULL;
 
+       START_PROFILE(syscall_fstat);
        DBG_DEBUG("[CEPH] fstat(%p)\n", handle);
 
        result = vfs_ceph_fetch_fh(handle, fsp, &cfh);
@@ -2612,6 +2639,7 @@ static int vfs_ceph_fstat(struct vfs_handle_struct *handle,
        DBG_DEBUG("[CEPH] mode = 0x%x\n", sbuf->st_ex_mode);
 out:
        DBG_DEBUG("[CEPH] fstat(...) = %d\n", result);
+       END_PROFILE(syscall_fstat);
        return status_code(result);
 }
 
@@ -2625,6 +2653,7 @@ static int vfs_ceph_fstatat(struct vfs_handle_struct *handle,
        struct vfs_ceph_iref iref = {0};
        struct vfs_ceph_fh *dircfh = NULL;
 
+       START_PROFILE(syscall_fstatat);
        DBG_DEBUG("[CEPH] fstatat(%p, %s)\n", handle, smb_fname->base_name);
 
        result = vfs_ceph_fetch_fh(handle, dirfsp, &dircfh);
@@ -2647,6 +2676,7 @@ static int vfs_ceph_fstatat(struct vfs_handle_struct *handle,
 out:
        vfs_ceph_iput(handle, &iref);
        DBG_DEBUG("[CEPH] fstatat(...) = %d\n", result);
+       END_PROFILE(syscall_fstatat);
        return status_code(result);
 }
 
@@ -2656,13 +2686,14 @@ static int vfs_ceph_lstat(struct vfs_handle_struct *handle,
        int result = -1;
        struct vfs_ceph_iref iref = {0};
 
+       START_PROFILE(syscall_lstat);
        DBG_DEBUG("[CEPH] lstat(%p, %s)\n",
                  handle,
                  smb_fname_str_dbg(smb_fname));
 
        if (smb_fname->stream_name) {
-               errno = ENOENT;
-               return result;
+               result = -ENOENT;
+               goto out;
        }
 
        result = vfs_ceph_igetl(handle, smb_fname, &iref);
@@ -2677,6 +2708,7 @@ static int vfs_ceph_lstat(struct vfs_handle_struct *handle,
 out:
        vfs_ceph_iput(handle, &iref);
        DBG_DEBUG("[CEPH] lstat(...) = %d\n", result);
+       END_PROFILE(syscall_lstat);
        return status_code(result);
 }
 
@@ -2687,6 +2719,7 @@ static int vfs_ceph_fntimes(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *cfh = NULL;
        int result;
 
+       START_PROFILE(syscall_fntimes);
        result = vfs_ceph_fetch_fh(handle, fsp, &cfh);
        if (result != 0) {
                goto out;
@@ -2705,6 +2738,7 @@ static int vfs_ceph_fntimes(struct vfs_handle_struct *handle,
                  handle, fsp_str_dbg(fsp), ft->mtime.tv_sec, ft->atime.tv_sec,
                  ft->ctime.tv_sec, ft->create_time.tv_sec, result);
 out:
+       END_PROFILE(syscall_fntimes);
        return status_code(result);
 }
 
@@ -2717,13 +2751,14 @@ static int vfs_ceph_unlinkat(struct vfs_handle_struct *handle,
        const char *name = smb_fname->base_name;
        int result = -1;
 
+       START_PROFILE(syscall_unlinkat);
        DBG_DEBUG("[CEPH] unlinkat(%p, %s)\n",
                  handle,
                  smb_fname_str_dbg(smb_fname));
 
        if (smb_fname->stream_name) {
-               errno = ENOENT;
-               return result;
+               result = -ENOENT;
+               goto out;
        }
 
        result = vfs_ceph_fetch_fh(handle, dirfsp, &dircfh);
@@ -2738,6 +2773,7 @@ static int vfs_ceph_unlinkat(struct vfs_handle_struct *handle,
        }
 out:
        DBG_DEBUG("[CEPH] unlinkat(...) = %d\n", result);
+       END_PROFILE(syscall_unlinkat);
        return status_code(result);
 }
 
@@ -2748,6 +2784,7 @@ static int vfs_ceph_fchmod(struct vfs_handle_struct *handle,
        int result;
        struct vfs_ceph_fh *cfh = NULL;
 
+       START_PROFILE(syscall_fchmod);
        DBG_DEBUG("[CEPH] fchmod(%p, %p, %d)\n", handle, fsp, mode);
        result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
        if (result != 0) {
@@ -2757,6 +2794,7 @@ static int vfs_ceph_fchmod(struct vfs_handle_struct *handle,
        result = vfs_ceph_ll_fchmod(handle, cfh, mode);
 out:
        DBG_DEBUG("[CEPH] fchmod(...) = %d\n", result);
+       END_PROFILE(syscall_fchmod);
        return status_code(result);
 }
 
@@ -2768,6 +2806,7 @@ static int vfs_ceph_fchown(struct vfs_handle_struct *handle,
        int result;
        struct vfs_ceph_fh *cfh = NULL;
 
+       START_PROFILE(syscall_fchown);
        DBG_DEBUG("[CEPH] fchown(%p, %p, %d, %d)\n", handle, fsp, uid, gid);
        result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
        if (result != 0) {
@@ -2776,6 +2815,7 @@ static int vfs_ceph_fchown(struct vfs_handle_struct *handle,
        result = vfs_ceph_ll_fchown(handle, cfh, uid, gid);
 out:
        DBG_DEBUG("[CEPH] fchown(...) = %d\n", result);
+       END_PROFILE(syscall_fchown);
        return status_code(result);
 }
 
@@ -2787,6 +2827,7 @@ static int vfs_ceph_lchown(struct vfs_handle_struct *handle,
        int result;
        struct vfs_ceph_iref iref = {0};
 
+       START_PROFILE(syscall_lchown);
        DBG_DEBUG("[CEPH] lchown(%p, %s, %d, %d)\n",
                  handle,
                  smb_fname->base_name,
@@ -2802,6 +2843,7 @@ static int vfs_ceph_lchown(struct vfs_handle_struct *handle,
        vfs_ceph_iput(handle, &iref);
 out:
        DBG_DEBUG("[CEPH] lchown(...) = %d\n", result);
+       END_PROFILE(syscall_lchown);
        return status_code(result);
 }
 
@@ -2811,12 +2853,14 @@ static int vfs_ceph_chdir(struct vfs_handle_struct *handle,
        int result = -1;
        struct vfs_ceph_config *config = NULL;
 
+       START_PROFILE(syscall_chdir);
        SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
                                return -ENOMEM);
 
        DBG_DEBUG("[CEPH] chdir(%p, %s)\n", handle, smb_fname->base_name);
        result = config->ceph_chdir_fn(config->mount, smb_fname->base_name);
        DBG_DEBUG("[CEPH] chdir(...) = %d\n", result);
+       END_PROFILE(syscall_chdir);
        return status_code(result);
 }
 
@@ -2826,11 +2870,13 @@ static struct smb_filename *vfs_ceph_getwd(struct vfs_handle_struct *handle,
        const char *cwd = NULL;
        struct vfs_ceph_config *config = NULL;
 
+       START_PROFILE(syscall_getwd);
        SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_ceph_config,
                                return NULL);
 
        cwd = config->ceph_getcwd_fn(config->mount);
        DBG_DEBUG("[CEPH] getwd(%p) = %s\n", handle, cwd);
+       END_PROFILE(syscall_getwd);
        return synthetic_smb_fname(ctx, cwd, NULL, NULL, 0, 0);
 }
 
@@ -2883,9 +2929,11 @@ static int vfs_ceph_ftruncate(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *cfh = NULL;
        int result = -1;
 
+       START_PROFILE(syscall_ftruncate);
        DBG_DEBUG("[CEPH] ftruncate(%p, %p, %llu\n", handle, fsp, llu(len));
 
        if (lp_strict_allocate(SNUM(fsp->conn))) {
+               END_PROFILE(syscall_ftruncate);
                return strict_allocate_ftruncate(handle, fsp, len);
        }
 
@@ -2895,6 +2943,7 @@ static int vfs_ceph_ftruncate(struct vfs_handle_struct *handle,
        }
        result = vfs_ceph_ll_ftruncate(handle, cfh, len);
 out:
+       END_PROFILE(syscall_ftruncate);
        return status_code(result);
 }
 
@@ -2907,6 +2956,7 @@ static int vfs_ceph_fallocate(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *cfh = NULL;
        int result;
 
+       START_PROFILE(syscall_fallocate);
        DBG_DEBUG("[CEPH] fallocate(%p, %p, %u, %llu, %llu\n",
                  handle, fsp, mode, llu(offset), llu(len));
        result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
@@ -2918,6 +2968,7 @@ static int vfs_ceph_fallocate(struct vfs_handle_struct *handle,
        result = vfs_ceph_ll_fallocate(handle, cfh, mode, offset, len);
 out:
        DBG_DEBUG("[CEPH] fallocate(...) = %d\n", result);
+       END_PROFILE(syscall_fallocate);
        return status_code(result);
 }
 
@@ -2955,12 +3006,15 @@ static int vfs_ceph_filesystem_sharemode(struct vfs_handle_struct *handle,
 static int vfs_ceph_fcntl(vfs_handle_struct *handle,
                          files_struct *fsp, int cmd, va_list cmd_arg)
 {
+       int result = 0;
+
+       START_PROFILE(syscall_fcntl);
        /*
         * SMB_VFS_FCNTL() is currently only called by vfs_set_blocking() to
         * clear O_NONBLOCK, etc for LOCK_MAND and FIFOs. Ignore it.
         */
        if (cmd == F_GETFL) {
-               return 0;
+               goto out;
        } else if (cmd == F_SETFL) {
                va_list dup_cmd_arg;
                int opt;
@@ -2969,15 +3023,18 @@ static int vfs_ceph_fcntl(vfs_handle_struct *handle,
                opt = va_arg(dup_cmd_arg, int);
                va_end(dup_cmd_arg);
                if (opt == 0) {
-                       return 0;
+                       goto out;
                }
                DBG_ERR("unexpected fcntl SETFL(%d)\n", opt);
                goto err_out;
        }
        DBG_ERR("unexpected fcntl: %d\n", cmd);
 err_out:
+       result = -1;
        errno = EINVAL;
-       return -1;
+out:
+       END_PROFILE(syscall_fcntl);
+       return result;
 }
 
 static bool vfs_ceph_getlock(struct vfs_handle_struct *handle,
@@ -3002,6 +3059,7 @@ static int vfs_ceph_symlinkat(struct vfs_handle_struct *handle,
        struct vfs_ceph_fh *dircfh = NULL;
        int result = -1;
 
+       START_PROFILE(syscall_symlinkat);
        DBG_DEBUG("[CEPH] symlinkat(%p, %s, %s)\n",
                  handle,
                  link_target->base_name,
@@ -3023,6 +3081,7 @@ static int vfs_ceph_symlinkat(struct vfs_handle_struct *handle,
        vfs_ceph_iput(handle, &iref);
 out:
        DBG_DEBUG("[CEPH] symlinkat(...) = %d\n", result);
+       END_PROFILE(syscall_symlinkat);
        return status_code(result);
 }
 
@@ -3035,6 +3094,7 @@ static int vfs_ceph_readlinkat(struct vfs_handle_struct *handle,
        int result = -1;
        struct vfs_ceph_fh *dircfh = NULL;
 
+       START_PROFILE(syscall_readlinkat);
        DBG_DEBUG("[CEPH] readlinkat(%p, %s, %p, %llu)\n",
                  handle,
                  smb_fname->base_name,
@@ -3070,6 +3130,7 @@ static int vfs_ceph_readlinkat(struct vfs_handle_struct *handle,
        }
 out:
        DBG_DEBUG("[CEPH] readlinkat(...) = %d\n", result);
+       END_PROFILE(syscall_readlinkat);
        return status_code(result);
 }
 
@@ -3087,10 +3148,11 @@ static int vfs_ceph_linkat(struct vfs_handle_struct *handle,
        const char *newname = new_smb_fname->base_name;
        int result = -1;
 
+       START_PROFILE(syscall_linkat);
        /* Prevent special linkat modes until it is required by VFS layer */
        if (flags & (AT_EMPTY_PATH | AT_SYMLINK_FOLLOW)) {
-               errno = ENOTSUP;
-               return -1;
+               result = -ENOTSUP;
+               goto out;
        }
 
        DBG_DEBUG("[CEPH] link(%p, %s, %s)\n", handle, name, newname);
@@ -3118,6 +3180,7 @@ static int vfs_ceph_linkat(struct vfs_handle_struct *handle,
        vfs_ceph_iput(handle, &iref);
 out:
        DBG_DEBUG("[CEPH] link(...) = %d\n", result);
+       END_PROFILE(syscall_linkat);
        return status_code(result);
 }
 
@@ -3132,6 +3195,7 @@ static int vfs_ceph_mknodat(struct vfs_handle_struct *handle,
        const char *name = smb_fname->base_name;
        int result = -1;
 
+       START_PROFILE(syscall_mknodat);
        result = vfs_ceph_fetch_fh(handle, dirfsp, &dircfh);
        if (result != 0) {
                goto out;
@@ -3147,6 +3211,7 @@ static int vfs_ceph_mknodat(struct vfs_handle_struct *handle,
        vfs_ceph_iput(handle, &iref);
 out:
        DBG_DEBUG("[CEPH] mknodat(...) = %d\n", result);
+       END_PROFILE(syscall_mknodat);
        return status_code(result);
 }
 
@@ -3164,6 +3229,7 @@ static struct smb_filename *vfs_ceph_realpath(struct vfs_handle_struct *handle,
        size_t len = strlen(path);
        struct smb_filename *result_fname = NULL;
 
+       START_PROFILE(syscall_realpath);
        if (path[0] == '/') {
                result = talloc_strdup(ctx, path);
        } else if ((len >= 2) && (path[0] == '.') && (path[1] == '/')) {
@@ -3177,12 +3243,14 @@ static struct smb_filename *vfs_ceph_realpath(struct vfs_handle_struct *handle,
        }
 
        if (result == NULL) {
-               return NULL;
+               goto out;
        }
 
        DBG_DEBUG("[CEPH] realpath(%p, %s) = %s\n", handle, path, result);
        result_fname = synthetic_smb_fname(ctx, result, NULL, NULL, 0, 0);
        TALLOC_FREE(result);
+out:
+       END_PROFILE(syscall_realpath);
        return result_fname;
 }