Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFSD: Trace filecache opens

Instrument calls to nfsd_open_verified() to get a sense of the
filecache hit rate.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+31 -2
+3 -2
fs/nfsd/filecache.c
··· 995 995 996 996 nf->nf_mark = nfsd_file_mark_find_or_create(nf); 997 997 if (nf->nf_mark) { 998 - if (open) 998 + if (open) { 999 999 status = nfsd_open_verified(rqstp, fhp, may_flags, 1000 1000 &nf->nf_file); 1001 - else 1001 + trace_nfsd_file_open(nf, status); 1002 + } else 1002 1003 status = nfs_ok; 1003 1004 } else 1004 1005 status = nfserr_jukebox;
+28
fs/nfsd/trace.h
··· 784 784 __entry->nf_file, __entry->status) 785 785 ); 786 786 787 + TRACE_EVENT(nfsd_file_open, 788 + TP_PROTO(struct nfsd_file *nf, __be32 status), 789 + TP_ARGS(nf, status), 790 + TP_STRUCT__entry( 791 + __field(unsigned int, nf_hashval) 792 + __field(void *, nf_inode) /* cannot be dereferenced */ 793 + __field(int, nf_ref) 794 + __field(unsigned long, nf_flags) 795 + __field(unsigned long, nf_may) 796 + __field(void *, nf_file) /* cannot be dereferenced */ 797 + ), 798 + TP_fast_assign( 799 + __entry->nf_hashval = nf->nf_hashval; 800 + __entry->nf_inode = nf->nf_inode; 801 + __entry->nf_ref = refcount_read(&nf->nf_ref); 802 + __entry->nf_flags = nf->nf_flags; 803 + __entry->nf_may = nf->nf_may; 804 + __entry->nf_file = nf->nf_file; 805 + ), 806 + TP_printk("hash=0x%x inode=%p ref=%d flags=%s may=%s file=%p", 807 + __entry->nf_hashval, 808 + __entry->nf_inode, 809 + __entry->nf_ref, 810 + show_nf_flags(__entry->nf_flags), 811 + show_nfsd_may_flags(__entry->nf_may), 812 + __entry->nf_file) 813 + ) 814 + 787 815 DECLARE_EVENT_CLASS(nfsd_file_search_class, 788 816 TP_PROTO(struct inode *inode, unsigned int hash, int found), 789 817 TP_ARGS(inode, hash, found),