]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: add tracepoints for async and sync unlink
authorJeff Layton <jlayton@kernel.org>
Thu, 1 Aug 2019 18:08:29 +0000 (14:08 -0400)
committerJeff Layton <jlayton@kernel.org>
Fri, 10 Jan 2020 16:54:26 +0000 (11:54 -0500)
For now, they just show the parent inode info and dentry name.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/dir.c
fs/ceph/trace.h

index 10294f07f5f0b2aea38c03615fa4778b8bbfb894..4addab0311d0566bba6858f972c422abf0c5000d 100644 (file)
@@ -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)
index 3a9a7706c55370cdf49c190c483a1a66f7e465cb..f425e19a6f3972bd3deb66ee219db2825d2e543c 100644 (file)
@@ -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 .