From 5615a9d2575d60cd3ae768dcad366ee2632a79d5 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Tue, 10 Dec 2019 15:22:18 -0500 Subject: [PATCH] ceph: add sync and async create tracepoints Signed-off-by: Jeff Layton --- fs/ceph/file.c | 3 +++ fs/ceph/trace.h | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 89e8b5c48975a..f9d0a76650dad 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -16,6 +16,7 @@ #include "mds_client.h" #include "cache.h" #include "io.h" +#include "trace.h" static __le32 ceph_flags_sys2wire(u32 flags) { @@ -653,6 +654,7 @@ retry: /* set up inode, dentry and return */ err = ceph_finish_async_open(dir, dentry, file, mode, req, &as_ctx); + trace_ceph_async_create(dir, dentry); goto out_req; case -ECHILD: /* do a sync create */ @@ -707,6 +709,7 @@ retry: out_fmode: if (!req->r_err && req->r_target_inode) ceph_put_fmode(ceph_inode(req->r_target_inode), req->r_fmode); + trace_ceph_sync_create(dir, dentry); out_req: ceph_mdsc_put_request(req); out_ctx: diff --git a/fs/ceph/trace.h b/fs/ceph/trace.h index f425e19a6f397..0438dd1cfa341 100644 --- a/fs/ceph/trace.h +++ b/fs/ceph/trace.h @@ -56,19 +56,21 @@ DECLARE_EVENT_CLASS(ceph_directory_class, ), TP_ARGS(dir, dentry), TP_STRUCT__entry( - __field(u64, ino) + __field(u64, pino) __field(u64, snap) + __field(u64, ino) __string(name, dentry->d_name.name) ), TP_fast_assign( - __entry->ino = ceph_inode(dir)->i_vino.ino; + __entry->pino = ceph_inode(dir)->i_vino.ino; __entry->snap = ceph_inode(dir)->i_vino.snap; + __entry->ino = d_inode(dentry) ? ceph_inode(d_inode(dentry))->i_vino.ino : 0; __assign_str(name, dentry->d_name.name); ), TP_printk( - "name=%s:0x%llx/%s", - show_snapid(__entry->snap), __entry->ino, - __get_str(name) + "name=%s:0x%llx/%s(0x%llx)", + show_snapid(__entry->snap), __entry->pino, + __get_str(name), __entry->ino ) ); @@ -79,6 +81,8 @@ DEFINE_EVENT(ceph_directory_class, ceph_##name, \ DEFINE_CEPH_DIRECTORY_EVENT(async_unlink); DEFINE_CEPH_DIRECTORY_EVENT(sync_unlink); +DEFINE_CEPH_DIRECTORY_EVENT(async_create); +DEFINE_CEPH_DIRECTORY_EVENT(sync_create); #endif /* _CEPH_TRACE_H */ -- 2.39.5