[9/9] ceph: add tracepoints for async and sync unlink
diff mbox series

Message ID 20190801202605.18172-10-jlayton@kernel.org
State New
Headers show
Series
  • ceph: add asynchronous unlink support
Related show

Commit Message

Jeff Layton Aug. 1, 2019, 8:26 p.m. UTC
For now, they just show the parent inode info and dentry name.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/dir.c   |  3 +++
 fs/ceph/trace.h | 31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

Patch
diff mbox series

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 2bd3e073249e..b318be1ff057 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,
@@ -1154,6 +1155,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);
@@ -1167,6 +1169,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 d1cf4bb8a21d..48e65075e4e3 100644
--- a/fs/ceph/trace.h
+++ b/fs/ceph/trace.h
@@ -48,6 +48,37 @@  DEFINE_EVENT(ceph_cap_class, ceph_##name,       \
 DEFINE_CEPH_CAP_EVENT(add_cap);
 DEFINE_CEPH_CAP_EVENT(remove_cap);
 
+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 .