1*f4ce1299STrond Myklebust /* 2*f4ce1299STrond Myklebust * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com> 3*f4ce1299STrond Myklebust */ 4*f4ce1299STrond Myklebust #undef TRACE_SYSTEM 5*f4ce1299STrond Myklebust #define TRACE_SYSTEM nfs 6*f4ce1299STrond Myklebust 7*f4ce1299STrond Myklebust #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ) 8*f4ce1299STrond Myklebust #define _TRACE_NFS_H 9*f4ce1299STrond Myklebust 10*f4ce1299STrond Myklebust #include <linux/tracepoint.h> 11*f4ce1299STrond Myklebust 12*f4ce1299STrond Myklebust #define nfs_show_file_type(ftype) \ 13*f4ce1299STrond Myklebust __print_symbolic(ftype, \ 14*f4ce1299STrond Myklebust { DT_UNKNOWN, "UNKNOWN" }, \ 15*f4ce1299STrond Myklebust { DT_FIFO, "FIFO" }, \ 16*f4ce1299STrond Myklebust { DT_CHR, "CHR" }, \ 17*f4ce1299STrond Myklebust { DT_DIR, "DIR" }, \ 18*f4ce1299STrond Myklebust { DT_BLK, "BLK" }, \ 19*f4ce1299STrond Myklebust { DT_REG, "REG" }, \ 20*f4ce1299STrond Myklebust { DT_LNK, "LNK" }, \ 21*f4ce1299STrond Myklebust { DT_SOCK, "SOCK" }, \ 22*f4ce1299STrond Myklebust { DT_WHT, "WHT" }) 23*f4ce1299STrond Myklebust 24*f4ce1299STrond Myklebust #define nfs_show_cache_validity(v) \ 25*f4ce1299STrond Myklebust __print_flags(v, "|", \ 26*f4ce1299STrond Myklebust { NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \ 27*f4ce1299STrond Myklebust { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \ 28*f4ce1299STrond Myklebust { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \ 29*f4ce1299STrond Myklebust { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \ 30*f4ce1299STrond Myklebust { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \ 31*f4ce1299STrond Myklebust { NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \ 32*f4ce1299STrond Myklebust { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \ 33*f4ce1299STrond Myklebust { NFS_INO_INVALID_LABEL, "INVALID_LABEL" }) 34*f4ce1299STrond Myklebust 35*f4ce1299STrond Myklebust #define nfs_show_nfsi_flags(v) \ 36*f4ce1299STrond Myklebust __print_flags(v, "|", \ 37*f4ce1299STrond Myklebust { 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \ 38*f4ce1299STrond Myklebust { 1 << NFS_INO_STALE, "STALE" }, \ 39*f4ce1299STrond Myklebust { 1 << NFS_INO_FLUSHING, "FLUSHING" }, \ 40*f4ce1299STrond Myklebust { 1 << NFS_INO_FSCACHE, "FSCACHE" }, \ 41*f4ce1299STrond Myklebust { 1 << NFS_INO_COMMIT, "COMMIT" }, \ 42*f4ce1299STrond Myklebust { 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \ 43*f4ce1299STrond Myklebust { 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" }) 44*f4ce1299STrond Myklebust 45*f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event, 46*f4ce1299STrond Myklebust TP_PROTO( 47*f4ce1299STrond Myklebust const struct inode *inode 48*f4ce1299STrond Myklebust ), 49*f4ce1299STrond Myklebust 50*f4ce1299STrond Myklebust TP_ARGS(inode), 51*f4ce1299STrond Myklebust 52*f4ce1299STrond Myklebust TP_STRUCT__entry( 53*f4ce1299STrond Myklebust __field(dev_t, dev) 54*f4ce1299STrond Myklebust __field(u32, fhandle) 55*f4ce1299STrond Myklebust __field(u64, fileid) 56*f4ce1299STrond Myklebust __field(u64, version) 57*f4ce1299STrond Myklebust ), 58*f4ce1299STrond Myklebust 59*f4ce1299STrond Myklebust TP_fast_assign( 60*f4ce1299STrond Myklebust const struct nfs_inode *nfsi = NFS_I(inode); 61*f4ce1299STrond Myklebust __entry->dev = inode->i_sb->s_dev; 62*f4ce1299STrond Myklebust __entry->fileid = nfsi->fileid; 63*f4ce1299STrond Myklebust __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 64*f4ce1299STrond Myklebust __entry->version = inode->i_version; 65*f4ce1299STrond Myklebust ), 66*f4ce1299STrond Myklebust 67*f4ce1299STrond Myklebust TP_printk( 68*f4ce1299STrond Myklebust "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ", 69*f4ce1299STrond Myklebust MAJOR(__entry->dev), MINOR(__entry->dev), 70*f4ce1299STrond Myklebust (unsigned long long)__entry->fileid, 71*f4ce1299STrond Myklebust __entry->fhandle, 72*f4ce1299STrond Myklebust (unsigned long long)__entry->version 73*f4ce1299STrond Myklebust ) 74*f4ce1299STrond Myklebust ); 75*f4ce1299STrond Myklebust 76*f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event_done, 77*f4ce1299STrond Myklebust TP_PROTO( 78*f4ce1299STrond Myklebust const struct inode *inode, 79*f4ce1299STrond Myklebust int error 80*f4ce1299STrond Myklebust ), 81*f4ce1299STrond Myklebust 82*f4ce1299STrond Myklebust TP_ARGS(inode, error), 83*f4ce1299STrond Myklebust 84*f4ce1299STrond Myklebust TP_STRUCT__entry( 85*f4ce1299STrond Myklebust __field(int, error) 86*f4ce1299STrond Myklebust __field(dev_t, dev) 87*f4ce1299STrond Myklebust __field(u32, fhandle) 88*f4ce1299STrond Myklebust __field(unsigned char, type) 89*f4ce1299STrond Myklebust __field(u64, fileid) 90*f4ce1299STrond Myklebust __field(u64, version) 91*f4ce1299STrond Myklebust __field(loff_t, size) 92*f4ce1299STrond Myklebust __field(unsigned long, nfsi_flags) 93*f4ce1299STrond Myklebust __field(unsigned long, cache_validity) 94*f4ce1299STrond Myklebust ), 95*f4ce1299STrond Myklebust 96*f4ce1299STrond Myklebust TP_fast_assign( 97*f4ce1299STrond Myklebust const struct nfs_inode *nfsi = NFS_I(inode); 98*f4ce1299STrond Myklebust __entry->error = error; 99*f4ce1299STrond Myklebust __entry->dev = inode->i_sb->s_dev; 100*f4ce1299STrond Myklebust __entry->fileid = nfsi->fileid; 101*f4ce1299STrond Myklebust __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 102*f4ce1299STrond Myklebust __entry->type = nfs_umode_to_dtype(inode->i_mode); 103*f4ce1299STrond Myklebust __entry->version = inode->i_version; 104*f4ce1299STrond Myklebust __entry->size = i_size_read(inode); 105*f4ce1299STrond Myklebust __entry->nfsi_flags = nfsi->flags; 106*f4ce1299STrond Myklebust __entry->cache_validity = nfsi->cache_validity; 107*f4ce1299STrond Myklebust ), 108*f4ce1299STrond Myklebust 109*f4ce1299STrond Myklebust TP_printk( 110*f4ce1299STrond Myklebust "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " 111*f4ce1299STrond Myklebust "type=%u (%s) version=%llu size=%lld " 112*f4ce1299STrond Myklebust "cache_validity=%lu (%s) nfs_flags=%ld (%s)", 113*f4ce1299STrond Myklebust __entry->error, 114*f4ce1299STrond Myklebust MAJOR(__entry->dev), MINOR(__entry->dev), 115*f4ce1299STrond Myklebust (unsigned long long)__entry->fileid, 116*f4ce1299STrond Myklebust __entry->fhandle, 117*f4ce1299STrond Myklebust __entry->type, 118*f4ce1299STrond Myklebust nfs_show_file_type(__entry->type), 119*f4ce1299STrond Myklebust (unsigned long long)__entry->version, 120*f4ce1299STrond Myklebust (long long)__entry->size, 121*f4ce1299STrond Myklebust __entry->cache_validity, 122*f4ce1299STrond Myklebust nfs_show_cache_validity(__entry->cache_validity), 123*f4ce1299STrond Myklebust __entry->nfsi_flags, 124*f4ce1299STrond Myklebust nfs_show_nfsi_flags(__entry->nfsi_flags) 125*f4ce1299STrond Myklebust ) 126*f4ce1299STrond Myklebust ); 127*f4ce1299STrond Myklebust 128*f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT(name) \ 129*f4ce1299STrond Myklebust DEFINE_EVENT(nfs_inode_event, name, \ 130*f4ce1299STrond Myklebust TP_PROTO( \ 131*f4ce1299STrond Myklebust const struct inode *inode \ 132*f4ce1299STrond Myklebust ), \ 133*f4ce1299STrond Myklebust TP_ARGS(inode)) 134*f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT_DONE(name) \ 135*f4ce1299STrond Myklebust DEFINE_EVENT(nfs_inode_event_done, name, \ 136*f4ce1299STrond Myklebust TP_PROTO( \ 137*f4ce1299STrond Myklebust const struct inode *inode, \ 138*f4ce1299STrond Myklebust int error \ 139*f4ce1299STrond Myklebust ), \ 140*f4ce1299STrond Myklebust TP_ARGS(inode, error)) 141*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter); 142*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit); 143*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter); 144*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit); 145*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter); 146*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit); 147*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_getattr_enter); 148*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit); 149*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_setattr_enter); 150*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit); 151*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter); 152*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit); 153*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter); 154*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit); 155*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_fsync_enter); 156*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit); 157*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_access_enter); 158*f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit); 159*f4ce1299STrond Myklebust 160*f4ce1299STrond Myklebust #endif /* _TRACE_NFS_H */ 161*f4ce1299STrond Myklebust 162*f4ce1299STrond Myklebust #undef TRACE_INCLUDE_PATH 163*f4ce1299STrond Myklebust #define TRACE_INCLUDE_PATH . 164*f4ce1299STrond Myklebust #define TRACE_INCLUDE_FILE nfstrace 165*f4ce1299STrond Myklebust /* This part must be outside protection */ 166*f4ce1299STrond Myklebust #include <trace/define_trace.h> 167