[PATCH 05/11] NFS: Add tracepoints for opendir, closedir, fsync_dir and llseek_dir

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

 



Add a few more directory operation tracepoints and remove a few
more dfprintks.

Signed-off-by: Dave Wysochanski <dwysocha@xxxxxxxxxx>
---
 fs/nfs/dir.c      | 10 +++++---
 fs/nfs/nfstrace.h | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 227cddc12983..e4cd9789ebb5 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -109,7 +109,7 @@ static void put_nfs_open_dir_context(struct inode *dir, struct nfs_open_dir_cont
 	int res = 0;
 	struct nfs_open_dir_context *ctx;
 
-	dfprintk(FILE, "NFS: open dir(%pD2)\n", filp);
+	trace_nfs_opendir_enter(file_inode(filp), file_dentry(filp));
 
 	nfs_inc_stats(inode, NFSIOS_VFSOPEN);
 
@@ -120,13 +120,16 @@ static void put_nfs_open_dir_context(struct inode *dir, struct nfs_open_dir_cont
 	}
 	filp->private_data = ctx;
 out:
+	trace_nfs_opendir_exit(file_inode(filp), file_dentry(filp), res);
 	return res;
 }
 
 static int
 nfs_closedir(struct inode *inode, struct file *filp)
 {
+	trace_nfs_closedir_enter(file_inode(filp), file_dentry(filp));
 	put_nfs_open_dir_context(file_inode(filp), filp->private_data);
+	trace_nfs_closedir_exit(file_inode(filp), file_dentry(filp), 0);
 	return 0;
 }
 
@@ -943,8 +946,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
 	struct inode *inode = file_inode(filp);
 	struct nfs_open_dir_context *dir_ctx = filp->private_data;
 
-	dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n",
-			filp, offset, whence);
+	trace_nfs_llseek_dir_enter(inode, offset, whence);
 
 	switch (whence) {
 	default:
@@ -985,7 +987,7 @@ static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end,
 {
 	struct inode *inode = file_inode(filp);
 
-	dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync);
+	trace_nfs_fsync_dir_enter(inode, start, end, datasync);
 
 	inode_lock(inode);
 	nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index e6a946b83330..0ed330f323bb 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -667,6 +667,79 @@
 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
 DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
+DEFINE_NFS_DIRECTORY_EVENT(nfs_opendir_enter);
+DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_opendir_exit);
+DEFINE_NFS_DIRECTORY_EVENT(nfs_closedir_enter);
+DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_closedir_exit);
+
+TRACE_EVENT(nfs_llseek_dir_enter,
+		TP_PROTO(
+			const struct inode *inode,
+			u64 offset,
+			int whence
+		),
+
+		TP_ARGS(inode, offset, whence),
+
+		TP_STRUCT__entry(
+			__field(dev_t, dev)
+			__field(u32, fhandle)
+			__field(u64, fileid)
+			__field(u64, offset)
+			__field(unsigned long, whence)
+		),
+
+		TP_fast_assign(
+			__entry->dev = inode->i_sb->s_dev;
+			__entry->fileid = NFS_FILEID(inode);
+			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
+			__entry->offset = offset;
+			__entry->whence = whence;
+		),
+
+		TP_printk(
+			"fileid=%02x:%02x:%llu handle=0x%08x offset=0x%08llx whence=%lu",
+			MAJOR(__entry->dev), MINOR(__entry->dev),
+			(unsigned long long)__entry->fileid,
+			__entry->fhandle, __entry->offset, __entry->whence
+		)
+);
+
+TRACE_EVENT(nfs_fsync_dir_enter,
+		TP_PROTO(
+			const struct inode *inode,
+			u64 start,
+			u64 end,
+			int datasync
+		),
+
+		TP_ARGS(inode, start, end, datasync),
+
+		TP_STRUCT__entry(
+			__field(dev_t, dev)
+			__field(u32, fhandle)
+			__field(u64, fileid)
+			__field(u64, start)
+			__field(u64, end)
+			__field(unsigned long, datasync)
+		),
+
+		TP_fast_assign(
+			__entry->dev = inode->i_sb->s_dev;
+			__entry->fileid = NFS_FILEID(inode);
+			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
+			__entry->start = start;
+			__entry->end = end;
+			__entry->datasync = datasync;
+		),
+
+		TP_printk(
+			"fileid=%02x:%02x:%llu handle=0x%08x start=0x%08llx end=0x%08llx datasync=%lu",
+			MAJOR(__entry->dev), MINOR(__entry->dev),
+			(unsigned long long)__entry->fileid,
+			__entry->fhandle, __entry->start, __entry->end, __entry->datasync
+		)
+);
 
 TRACE_EVENT(nfs_readdir_enter,
 		TP_PROTO(
-- 
1.8.3.1




[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