diff mbox series

[08/11] NFS: Replace LOOKUPCACHE dfprintk statements with tracepoints

Message ID 1604325011-29427-9-git-send-email-dwysocha@redhat.com (mailing list archive)
State New
Headers show
Series Add NFS readdir tracepoints and improve performance of reading directories | expand

Commit Message

David Wysochanski Nov. 2, 2020, 1:50 p.m. UTC
Remove all the LOOKUPCACHE dfprintk statements in favor of
tracepoints based on existing tracing templates
DEFINE_NFS_LOOKUP_EVENT and DEFINE_NFS_LOOKUP_EVENT_DONE.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 fs/nfs/dir.c      | 27 ++++++++++++---------------
 fs/nfs/nfstrace.h |  8 ++++++++
 2 files changed, 20 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index d8c3c3fdea75..52e06c8fc7cd 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1226,8 +1226,7 @@  int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
 {
 	switch (error) {
 	case 1:
-		dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is valid\n",
-			__func__, dentry);
+		trace_nfs_lookup_revalidate_done_valid(dir, dentry, 0);
 		return 1;
 	case 0:
 		nfs_mark_for_revalidate(dir);
@@ -1243,12 +1242,10 @@  int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
 			if (IS_ROOT(dentry))
 				return 1;
 		}
-		dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n",
-				__func__, dentry);
+		trace_nfs_lookup_revalidate_done_invalid(dir, dentry, 0);
 		return 0;
 	}
-	dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) lookup returned error %d\n",
-				__func__, dentry, error);
+	trace_nfs_lookup_revalidate_done_exit(dir, dentry, 0, error);
 	return error;
 }
 
@@ -1344,12 +1341,14 @@  int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry,
 	nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
 	inode = d_inode(dentry);
 
-	if (!inode)
+	if (!inode) {
+		trace_nfs_lookup_revalidate_negative_inode(dir, dentry,
+							   flags);
 		return nfs_lookup_revalidate_negative(dir, dentry, flags);
+	}
 
 	if (is_bad_inode(inode)) {
-		dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
-				__func__, dentry);
+		trace_nfs_lookup_revalidate_bad_inode(dir, dentry, flags);
 		goto out_bad;
 	}
 
@@ -1436,20 +1435,18 @@  static int nfs_weak_revalidate(struct dentry *dentry, unsigned int flags)
 	 * eventually need to do something more here.
 	 */
 	if (!inode) {
-		dfprintk(LOOKUPCACHE, "%s: %pd2 has negative inode\n",
-				__func__, dentry);
+		trace_nfs_weak_revalidate_negative_inode(inode, dentry,
+							 flags);
 		return 1;
 	}
 
 	if (is_bad_inode(inode)) {
-		dfprintk(LOOKUPCACHE, "%s: %pd2 has dud inode\n",
-				__func__, dentry);
+		trace_nfs_weak_revalidate_bad_inode(inode, dentry, flags);
 		return 0;
 	}
 
 	error = nfs_lookup_verify_inode(inode, flags);
-	dfprintk(LOOKUPCACHE, "NFS: %s: inode %lu is %s\n",
-			__func__, inode->i_ino, error ? "invalid" : "valid");
+	trace_nfs_weak_revalidate_exit(inode, dentry, flags, error);
 	return !error;
 }
 
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index e28551f70eab..06b301da85a2 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -386,6 +386,14 @@ 
 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
+DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_negative_inode);
+DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_bad_inode);
+DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_done_valid);
+DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_done_invalid);
+DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_done_exit);
+DEFINE_NFS_LOOKUP_EVENT(nfs_weak_revalidate_negative_inode);
+DEFINE_NFS_LOOKUP_EVENT(nfs_weak_revalidate_bad_inode);
+DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_weak_revalidate_exit);
 
 TRACE_DEFINE_ENUM(O_WRONLY);
 TRACE_DEFINE_ENUM(O_RDWR);