NFS: Update symbolic flags displayed by trace events

Add missing symbolic flag names and display flags variables in
hexadecimal to improve observability.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Chuck Lever 2019-06-19 10:34:03 -04:00 committed by Anna Schumaker
parent 38a638a72a
commit 7d4006c161
1 changed files with 124 additions and 26 deletions

View File

@ -11,6 +11,16 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
#include <linux/iversion.h> #include <linux/iversion.h>
TRACE_DEFINE_ENUM(DT_UNKNOWN);
TRACE_DEFINE_ENUM(DT_FIFO);
TRACE_DEFINE_ENUM(DT_CHR);
TRACE_DEFINE_ENUM(DT_DIR);
TRACE_DEFINE_ENUM(DT_BLK);
TRACE_DEFINE_ENUM(DT_REG);
TRACE_DEFINE_ENUM(DT_LNK);
TRACE_DEFINE_ENUM(DT_SOCK);
TRACE_DEFINE_ENUM(DT_WHT);
#define nfs_show_file_type(ftype) \ #define nfs_show_file_type(ftype) \
__print_symbolic(ftype, \ __print_symbolic(ftype, \
{ DT_UNKNOWN, "UNKNOWN" }, \ { DT_UNKNOWN, "UNKNOWN" }, \
@ -23,25 +33,57 @@
{ DT_SOCK, "SOCK" }, \ { DT_SOCK, "SOCK" }, \
{ DT_WHT, "WHT" }) { DT_WHT, "WHT" })
TRACE_DEFINE_ENUM(NFS_INO_INVALID_DATA);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_ATIME);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACCESS);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACL);
TRACE_DEFINE_ENUM(NFS_INO_REVAL_PAGECACHE);
TRACE_DEFINE_ENUM(NFS_INO_REVAL_FORCED);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_LABEL);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_CHANGE);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_CTIME);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_MTIME);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_SIZE);
TRACE_DEFINE_ENUM(NFS_INO_INVALID_OTHER);
#define nfs_show_cache_validity(v) \ #define nfs_show_cache_validity(v) \
__print_flags(v, "|", \ __print_flags(v, "|", \
{ NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \
{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \ { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \ { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \ { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \ { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
{ NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \ { NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \ { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" }) { NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
{ NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" })
TRACE_DEFINE_ENUM(NFS_INO_ADVISE_RDPLUS);
TRACE_DEFINE_ENUM(NFS_INO_STALE);
TRACE_DEFINE_ENUM(NFS_INO_ACL_LRU_SET);
TRACE_DEFINE_ENUM(NFS_INO_INVALIDATING);
TRACE_DEFINE_ENUM(NFS_INO_FSCACHE);
TRACE_DEFINE_ENUM(NFS_INO_FSCACHE_LOCK);
TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMIT);
TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMITTING);
TRACE_DEFINE_ENUM(NFS_INO_LAYOUTSTATS);
TRACE_DEFINE_ENUM(NFS_INO_ODIRECT);
#define nfs_show_nfsi_flags(v) \ #define nfs_show_nfsi_flags(v) \
__print_flags(v, "|", \ __print_flags(v, "|", \
{ 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \ { BIT(NFS_INO_ADVISE_RDPLUS), "ADVISE_RDPLUS" }, \
{ 1 << NFS_INO_STALE, "STALE" }, \ { BIT(NFS_INO_STALE), "STALE" }, \
{ 1 << NFS_INO_INVALIDATING, "INVALIDATING" }, \ { BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
{ 1 << NFS_INO_FSCACHE, "FSCACHE" }, \ { BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
{ 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \ { BIT(NFS_INO_FSCACHE), "FSCACHE" }, \
{ 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" }) { BIT(NFS_INO_FSCACHE_LOCK), "FSCACHE_LOCK" }, \
{ BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
{ BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
DECLARE_EVENT_CLASS(nfs_inode_event, DECLARE_EVENT_CLASS(nfs_inode_event,
TP_PROTO( TP_PROTO(
@ -110,7 +152,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event_done,
TP_printk( TP_printk(
"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
"type=%u (%s) version=%llu size=%lld " "type=%u (%s) version=%llu size=%lld "
"cache_validity=%lu (%s) nfs_flags=%ld (%s)", "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
-__entry->error, nfs_show_status(__entry->error), -__entry->error, nfs_show_status(__entry->error),
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
(unsigned long long)__entry->fileid, (unsigned long long)__entry->fileid,
@ -158,13 +200,41 @@ DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
DEFINE_NFS_INODE_EVENT(nfs_access_enter); DEFINE_NFS_INODE_EVENT(nfs_access_enter);
DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit); DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit);
TRACE_DEFINE_ENUM(LOOKUP_FOLLOW);
TRACE_DEFINE_ENUM(LOOKUP_DIRECTORY);
TRACE_DEFINE_ENUM(LOOKUP_AUTOMOUNT);
TRACE_DEFINE_ENUM(LOOKUP_PARENT);
TRACE_DEFINE_ENUM(LOOKUP_REVAL);
TRACE_DEFINE_ENUM(LOOKUP_RCU);
TRACE_DEFINE_ENUM(LOOKUP_NO_REVAL);
TRACE_DEFINE_ENUM(LOOKUP_NO_EVAL);
TRACE_DEFINE_ENUM(LOOKUP_OPEN);
TRACE_DEFINE_ENUM(LOOKUP_CREATE);
TRACE_DEFINE_ENUM(LOOKUP_EXCL);
TRACE_DEFINE_ENUM(LOOKUP_RENAME_TARGET);
TRACE_DEFINE_ENUM(LOOKUP_JUMPED);
TRACE_DEFINE_ENUM(LOOKUP_ROOT);
TRACE_DEFINE_ENUM(LOOKUP_EMPTY);
TRACE_DEFINE_ENUM(LOOKUP_DOWN);
#define show_lookup_flags(flags) \ #define show_lookup_flags(flags) \
__print_flags((unsigned long)flags, "|", \ __print_flags(flags, "|", \
{ LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \ { LOOKUP_FOLLOW, "FOLLOW" }, \
{ LOOKUP_DIRECTORY, "DIRECTORY" }, \ { LOOKUP_DIRECTORY, "DIRECTORY" }, \
{ LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
{ LOOKUP_PARENT, "PARENT" }, \
{ LOOKUP_REVAL, "REVAL" }, \
{ LOOKUP_RCU, "RCU" }, \
{ LOOKUP_NO_REVAL, "NO_REVAL" }, \
{ LOOKUP_NO_EVAL, "NO_EVAL" }, \
{ LOOKUP_OPEN, "OPEN" }, \ { LOOKUP_OPEN, "OPEN" }, \
{ LOOKUP_CREATE, "CREATE" }, \ { LOOKUP_CREATE, "CREATE" }, \
{ LOOKUP_EXCL, "EXCL" }) { LOOKUP_EXCL, "EXCL" }, \
{ LOOKUP_RENAME_TARGET, "RENAME_TARGET" }, \
{ LOOKUP_JUMPED, "JUMPED" }, \
{ LOOKUP_ROOT, "ROOT" }, \
{ LOOKUP_EMPTY, "EMPTY" }, \
{ LOOKUP_DOWN, "DOWN" })
DECLARE_EVENT_CLASS(nfs_lookup_event, DECLARE_EVENT_CLASS(nfs_lookup_event,
TP_PROTO( TP_PROTO(
@ -176,7 +246,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event,
TP_ARGS(dir, dentry, flags), TP_ARGS(dir, dentry, flags),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned int, flags) __field(unsigned long, flags)
__field(dev_t, dev) __field(dev_t, dev)
__field(u64, dir) __field(u64, dir)
__string(name, dentry->d_name.name) __string(name, dentry->d_name.name)
@ -190,7 +260,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event,
), ),
TP_printk( TP_printk(
"flags=%u (%s) name=%02x:%02x:%llu/%s", "flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
__entry->flags, __entry->flags,
show_lookup_flags(__entry->flags), show_lookup_flags(__entry->flags),
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
@ -220,7 +290,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event_done,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, error) __field(unsigned long, error)
__field(unsigned int, flags) __field(unsigned long, flags)
__field(dev_t, dev) __field(dev_t, dev)
__field(u64, dir) __field(u64, dir)
__string(name, dentry->d_name.name) __string(name, dentry->d_name.name)
@ -235,7 +305,7 @@ DECLARE_EVENT_CLASS(nfs_lookup_event_done,
), ),
TP_printk( TP_printk(
"error=%ld (%s) flags=%u (%s) name=%02x:%02x:%llu/%s", "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
-__entry->error, nfs_show_status(__entry->error), -__entry->error, nfs_show_status(__entry->error),
__entry->flags, __entry->flags,
show_lookup_flags(__entry->flags), show_lookup_flags(__entry->flags),
@ -260,15 +330,43 @@ DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter); DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit); DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
TRACE_DEFINE_ENUM(O_WRONLY);
TRACE_DEFINE_ENUM(O_RDWR);
TRACE_DEFINE_ENUM(O_CREAT);
TRACE_DEFINE_ENUM(O_EXCL);
TRACE_DEFINE_ENUM(O_NOCTTY);
TRACE_DEFINE_ENUM(O_TRUNC);
TRACE_DEFINE_ENUM(O_APPEND);
TRACE_DEFINE_ENUM(O_NONBLOCK);
TRACE_DEFINE_ENUM(O_DSYNC);
TRACE_DEFINE_ENUM(O_DIRECT);
TRACE_DEFINE_ENUM(O_LARGEFILE);
TRACE_DEFINE_ENUM(O_DIRECTORY);
TRACE_DEFINE_ENUM(O_NOFOLLOW);
TRACE_DEFINE_ENUM(O_NOATIME);
TRACE_DEFINE_ENUM(O_CLOEXEC);
#define show_open_flags(flags) \ #define show_open_flags(flags) \
__print_flags((unsigned long)flags, "|", \ __print_flags(flags, "|", \
{ O_WRONLY, "O_WRONLY" }, \
{ O_RDWR, "O_RDWR" }, \
{ O_CREAT, "O_CREAT" }, \ { O_CREAT, "O_CREAT" }, \
{ O_EXCL, "O_EXCL" }, \ { O_EXCL, "O_EXCL" }, \
{ O_NOCTTY, "O_NOCTTY" }, \
{ O_TRUNC, "O_TRUNC" }, \ { O_TRUNC, "O_TRUNC" }, \
{ O_APPEND, "O_APPEND" }, \ { O_APPEND, "O_APPEND" }, \
{ O_NONBLOCK, "O_NONBLOCK" }, \
{ O_DSYNC, "O_DSYNC" }, \ { O_DSYNC, "O_DSYNC" }, \
{ O_DIRECT, "O_DIRECT" }, \ { O_DIRECT, "O_DIRECT" }, \
{ O_DIRECTORY, "O_DIRECTORY" }) { O_LARGEFILE, "O_LARGEFILE" }, \
{ O_DIRECTORY, "O_DIRECTORY" }, \
{ O_NOFOLLOW, "O_NOFOLLOW" }, \
{ O_NOATIME, "O_NOATIME" }, \
{ O_CLOEXEC, "O_CLOEXEC" })
TRACE_DEFINE_ENUM(FMODE_READ);
TRACE_DEFINE_ENUM(FMODE_WRITE);
TRACE_DEFINE_ENUM(FMODE_EXEC);
#define show_fmode_flags(mode) \ #define show_fmode_flags(mode) \
__print_flags(mode, "|", \ __print_flags(mode, "|", \
@ -286,7 +384,7 @@ TRACE_EVENT(nfs_atomic_open_enter,
TP_ARGS(dir, ctx, flags), TP_ARGS(dir, ctx, flags),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned int, flags) __field(unsigned long, flags)
__field(unsigned int, fmode) __field(unsigned int, fmode)
__field(dev_t, dev) __field(dev_t, dev)
__field(u64, dir) __field(u64, dir)
@ -302,7 +400,7 @@ TRACE_EVENT(nfs_atomic_open_enter,
), ),
TP_printk( TP_printk(
"flags=%u (%s) fmode=%s name=%02x:%02x:%llu/%s", "flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
__entry->flags, __entry->flags,
show_open_flags(__entry->flags), show_open_flags(__entry->flags),
show_fmode_flags(__entry->fmode), show_fmode_flags(__entry->fmode),
@ -324,7 +422,7 @@ TRACE_EVENT(nfs_atomic_open_exit,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, error) __field(unsigned long, error)
__field(unsigned int, flags) __field(unsigned long, flags)
__field(unsigned int, fmode) __field(unsigned int, fmode)
__field(dev_t, dev) __field(dev_t, dev)
__field(u64, dir) __field(u64, dir)
@ -341,7 +439,7 @@ TRACE_EVENT(nfs_atomic_open_exit,
), ),
TP_printk( TP_printk(
"error=%ld (%s) flags=%u (%s) fmode=%s " "error=%ld (%s) flags=0x%lx (%s) fmode=%s "
"name=%02x:%02x:%llu/%s", "name=%02x:%02x:%llu/%s",
-__entry->error, nfs_show_status(__entry->error), -__entry->error, nfs_show_status(__entry->error),
__entry->flags, __entry->flags,
@ -363,7 +461,7 @@ TRACE_EVENT(nfs_create_enter,
TP_ARGS(dir, dentry, flags), TP_ARGS(dir, dentry, flags),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned int, flags) __field(unsigned long, flags)
__field(dev_t, dev) __field(dev_t, dev)
__field(u64, dir) __field(u64, dir)
__string(name, dentry->d_name.name) __string(name, dentry->d_name.name)
@ -377,7 +475,7 @@ TRACE_EVENT(nfs_create_enter,
), ),
TP_printk( TP_printk(
"flags=%u (%s) name=%02x:%02x:%llu/%s", "flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
__entry->flags, __entry->flags,
show_open_flags(__entry->flags), show_open_flags(__entry->flags),
MAJOR(__entry->dev), MINOR(__entry->dev), MAJOR(__entry->dev), MINOR(__entry->dev),
@ -398,7 +496,7 @@ TRACE_EVENT(nfs_create_exit,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(unsigned long, error) __field(unsigned long, error)
__field(unsigned int, flags) __field(unsigned long, flags)
__field(dev_t, dev) __field(dev_t, dev)
__field(u64, dir) __field(u64, dir)
__string(name, dentry->d_name.name) __string(name, dentry->d_name.name)
@ -413,7 +511,7 @@ TRACE_EVENT(nfs_create_exit,
), ),
TP_printk( TP_printk(
"error=%ld (%s) flags=%u (%s) name=%02x:%02x:%llu/%s", "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
-__entry->error, nfs_show_status(__entry->error), -__entry->error, nfs_show_status(__entry->error),
__entry->flags, __entry->flags,
show_open_flags(__entry->flags), show_open_flags(__entry->flags),