From: Jeff Layton Date: Thu, 1 Aug 2019 18:08:29 +0000 (-0400) Subject: ceph: add tracepoints for async and sync unlink X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0022f464d605c107dc8150b5f0b7fccb117fac60;p=ceph-client.git ceph: add tracepoints for async and sync unlink For now, they just show the parent inode info and dentry name. Signed-off-by: Jeff Layton --- diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 10294f07f5f0..4addab0311d0 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -9,6 +9,7 @@ #include "super.h" #include "mds_client.h" +#include "trace.h" /* * Directory operations: readdir, lookup, create, link, unlink, @@ -1116,6 +1117,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry) get_caps_for_async_unlink(dir, dentry)) { dout("ceph: Async unlink on %lu/%.*s", dir->i_ino, dentry->d_name.len, dentry->d_name.name); + trace_ceph_async_unlink(dir, dentry); req->r_callback = ceph_async_unlink_cb; req->r_old_inode = d_inode(dentry); ihold(req->r_old_inode); @@ -1129,6 +1131,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry) d_delete(dentry); } } else { + trace_ceph_sync_unlink(dir, dentry); set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); err = ceph_mdsc_do_request(mdsc, dir, req); if (!err && !req->r_reply_info.head->is_dentry) diff --git a/fs/ceph/trace.h b/fs/ceph/trace.h index 3a9a7706c553..f425e19a6f39 100644 --- a/fs/ceph/trace.h +++ b/fs/ceph/trace.h @@ -49,6 +49,37 @@ DEFINE_CEPH_CAP_EVENT(add_cap); DEFINE_CEPH_CAP_EVENT(remove_cap); DEFINE_CEPH_CAP_EVENT(handle_cap_grant); +DECLARE_EVENT_CLASS(ceph_directory_class, + TP_PROTO( + const struct inode *dir, + const struct dentry *dentry + ), + TP_ARGS(dir, dentry), + TP_STRUCT__entry( + __field(u64, ino) + __field(u64, snap) + __string(name, dentry->d_name.name) + ), + TP_fast_assign( + __entry->ino = ceph_inode(dir)->i_vino.ino; + __entry->snap = ceph_inode(dir)->i_vino.snap; + __assign_str(name, dentry->d_name.name); + ), + TP_printk( + "name=%s:0x%llx/%s", + show_snapid(__entry->snap), __entry->ino, + __get_str(name) + ) +); + +#define DEFINE_CEPH_DIRECTORY_EVENT(name) \ +DEFINE_EVENT(ceph_directory_class, ceph_##name, \ + TP_PROTO(const struct inode *dir, const struct dentry *dentry), \ + TP_ARGS(dir, dentry)) + +DEFINE_CEPH_DIRECTORY_EVENT(async_unlink); +DEFINE_CEPH_DIRECTORY_EVENT(sync_unlink); + #endif /* _CEPH_TRACE_H */ #define TRACE_INCLUDE_PATH .