[for-6.11 PATCH 14/29] NFS: Add tracepoints for nfs_local_enable and nfs_local_disable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>

Allow tracing of when local I/O begins and ends.

Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx>
---
 fs/nfs/localio.c  |  5 ++---
 fs/nfs/nfstrace.h | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index 5c69eb0fe7b6..5939ca2216be 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -195,7 +195,6 @@ nfs_local_put_lookup_ctx(void)
 		spin_unlock(&ctx->lock);
 		if (fn)
 			symbol_put(nfsd_open_local_fh);
-		dprintk("destroy lookup context\n");
 	}
 }
 
@@ -206,8 +205,8 @@ void
 nfs_local_enable(struct nfs_client *clp)
 {
 	if (nfs_local_get_lookup_ctx()) {
-		dprintk("enabled local i/o\n");
 		set_bit(NFS_CS_LOCAL_IO, &clp->cl_flags);
+		trace_nfs_local_enable(clp);
 	}
 }
 EXPORT_SYMBOL_GPL(nfs_local_enable);
@@ -219,7 +218,7 @@ void
 nfs_local_disable(struct nfs_client *clp)
 {
 	if (test_and_clear_bit(NFS_CS_LOCAL_IO, &clp->cl_flags)) {
-		dprintk("disabled local i/o\n");
+		trace_nfs_local_disable(clp);
 		nfs_local_put_lookup_ctx();
 	}
 }
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 45d4086cdeb1..95a2c19a9172 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1710,6 +1710,38 @@ TRACE_EVENT(nfs_local_open_fh,
 		)
 );
 
+DECLARE_EVENT_CLASS(nfs_local_client_event,
+		TP_PROTO(
+			const struct nfs_client *clp
+		),
+
+		TP_ARGS(clp),
+
+		TP_STRUCT__entry(
+			__field(unsigned int, protocol)
+			__string(server, clp->cl_hostname)
+		),
+
+		TP_fast_assign(
+			__entry->protocol = clp->rpc_ops->version;
+			__assign_str(server);
+		),
+
+		TP_printk(
+			"server=%s NFSv%u", __get_str(server), __entry->protocol
+		)
+);
+
+#define DEFINE_NFS_LOCAL_CLIENT_EVENT(name) \
+	DEFINE_EVENT(nfs_local_client_event, name, \
+			TP_PROTO( \
+				const struct nfs_client *clp \
+			), \
+			TP_ARGS(clp))
+
+DEFINE_NFS_LOCAL_CLIENT_EVENT(nfs_local_enable);
+DEFINE_NFS_LOCAL_CLIENT_EVENT(nfs_local_disable);
+
 DECLARE_EVENT_CLASS(nfs_xdr_event,
 		TP_PROTO(
 			const struct xdr_stream *xdr,
-- 
2.44.0





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux