diff mbox series

[RFC,04/21] NFSD: Clean up the show_nf_may macro

Message ID 160029255410.29208.10420863210576888477.stgit@klimt.1015granger.net (mailing list archive)
State New, archived
Headers show
Series NFSD operation monitoring tracepoints | expand

Commit Message

Chuck Lever III Sept. 16, 2020, 9:42 p.m. UTC
Display all possible NFSD_MAY permission flags.

Rename show_nf_may with a more generic name because the NFSD_MAY
permission flags are used in other places besides the file cache.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/trace.h |   52 ++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h
index 1861db1bdc67..a8013338f4d5 100644
--- a/fs/nfsd/trace.h
+++ b/fs/nfsd/trace.h
@@ -12,6 +12,38 @@ 
 #include "export.h"
 #include "nfsfh.h"
 
+/*
+ * from fs/nfsd/vfs.h
+ */
+#define NFSD_PERMISSION_LIST						\
+	nfsd_perm_flag(EXEC)						\
+	nfsd_perm_flag(WRITE)						\
+	nfsd_perm_flag(READ)						\
+	nfsd_perm_flag(SATTR)						\
+	nfsd_perm_flag(TRUNC)						\
+	nfsd_perm_flag(LOCK)						\
+	nfsd_perm_flag(OWNER_OVERRIDE)					\
+	nfsd_perm_flag(LOCAL_ACCESS)					\
+	nfsd_perm_flag(BYPASS_GSS_ON_ROOT)				\
+	nfsd_perm_flag(NOT_BREAK_LEASE)					\
+	nfsd_perm_flag(BYPASS_GSS)					\
+	nfsd_perm_flag(READ_IF_EXEC)					\
+	nfsd_perm_flag_end(64BIT_COOKIE)
+
+#undef nfsd_perm_flag
+#undef nfsd_perm_flag_end
+#define nfsd_perm_flag(x)	TRACE_DEFINE_ENUM(NFSD_MAY_##x);
+#define nfsd_perm_flag_end(x)	TRACE_DEFINE_ENUM(NFSD_MAY_##x);
+
+NFSD_PERMISSION_LIST
+
+#undef nfsd_perm_flag
+#undef nfsd_perm_flag_end
+#define nfsd_perm_flag(x)	{ NFSD_MAY_##x, #x },
+#define nfsd_perm_flag_end(x)	{ NFSD_MAY_##x, #x }
+
+#define show_perm_flags(val)	__print_flags(val, "|", NFSD_PERMISSION_LIST)
+
 TRACE_EVENT(nfsd_compound,
 	TP_PROTO(const struct svc_rqst *rqst,
 		 u32 args_opcnt),
@@ -421,6 +453,9 @@  TRACE_EVENT(nfsd_clid_inuse_err,
 		__entry->cl_boot, __entry->cl_id)
 )
 
+/*
+ * from fs/nfsd/filecache.h
+ */
 TRACE_DEFINE_ENUM(NFSD_FILE_HASHED);
 TRACE_DEFINE_ENUM(NFSD_FILE_PENDING);
 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ);
@@ -435,13 +470,6 @@  TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED);
 		{ 1 << NFSD_FILE_BREAK_WRITE,	"BREAK_WRITE" },	\
 		{ 1 << NFSD_FILE_REFERENCED,	"REFERENCED"})
 
-/* FIXME: This should probably be fleshed out in the future. */
-#define show_nf_may(val)						\
-	__print_flags(val, "|",						\
-		{ NFSD_MAY_READ,		"READ" },		\
-		{ NFSD_MAY_WRITE,		"WRITE" },		\
-		{ NFSD_MAY_NOT_BREAK_LEASE,	"NOT_BREAK_LEASE" })
-
 DECLARE_EVENT_CLASS(nfsd_file_class,
 	TP_PROTO(struct nfsd_file *nf),
 	TP_ARGS(nf),
@@ -466,7 +494,7 @@  DECLARE_EVENT_CLASS(nfsd_file_class,
 		__entry->nf_inode,
 		__entry->nf_ref,
 		show_nf_flags(__entry->nf_flags),
-		show_nf_may(__entry->nf_may),
+		show_perm_flags(__entry->nf_may),
 		__entry->nf_file)
 )
 
@@ -492,10 +520,10 @@  TRACE_EVENT(nfsd_file_acquire,
 		__field(u32, xid)
 		__field(unsigned int, hash)
 		__field(void *, inode)
-		__field(unsigned int, may_flags)
+		__field(unsigned long, may_flags)
 		__field(int, nf_ref)
 		__field(unsigned long, nf_flags)
-		__field(unsigned char, nf_may)
+		__field(unsigned long, nf_may)
 		__field(struct file *, nf_file)
 		__field(u32, status)
 	),
@@ -514,9 +542,9 @@  TRACE_EVENT(nfsd_file_acquire,
 
 	TP_printk("xid=0x%x hash=0x%x inode=0x%p may_flags=%s ref=%d nf_flags=%s nf_may=%s nf_file=0x%p status=%u",
 			__entry->xid, __entry->hash, __entry->inode,
-			show_nf_may(__entry->may_flags), __entry->nf_ref,
+			show_perm_flags(__entry->may_flags), __entry->nf_ref,
 			show_nf_flags(__entry->nf_flags),
-			show_nf_may(__entry->nf_may), __entry->nf_file,
+			show_perm_flags(__entry->nf_may), __entry->nf_file,
 			__entry->status)
 );