Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2014 Christoph Hellwig. |
| 4 | */ |
| 5 | #undef TRACE_SYSTEM |
| 6 | #define TRACE_SYSTEM nfsd |
| 7 | |
| 8 | #if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 9 | #define _NFSD_TRACE_H |
| 10 | |
| 11 | #include <linux/tracepoint.h> |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 12 | #include "nfsfh.h" |
| 13 | |
Chuck Lever | fff4080 | 2018-03-27 10:53:54 -0400 | [diff] [blame] | 14 | TRACE_EVENT(nfsd_compound, |
| 15 | TP_PROTO(const struct svc_rqst *rqst, |
| 16 | u32 args_opcnt), |
| 17 | TP_ARGS(rqst, args_opcnt), |
| 18 | TP_STRUCT__entry( |
| 19 | __field(u32, xid) |
| 20 | __field(u32, args_opcnt) |
| 21 | ), |
| 22 | TP_fast_assign( |
| 23 | __entry->xid = be32_to_cpu(rqst->rq_xid); |
| 24 | __entry->args_opcnt = args_opcnt; |
| 25 | ), |
| 26 | TP_printk("xid=0x%08x opcnt=%u", |
| 27 | __entry->xid, __entry->args_opcnt) |
| 28 | ) |
| 29 | |
| 30 | TRACE_EVENT(nfsd_compound_status, |
| 31 | TP_PROTO(u32 args_opcnt, |
| 32 | u32 resp_opcnt, |
| 33 | __be32 status, |
| 34 | const char *name), |
| 35 | TP_ARGS(args_opcnt, resp_opcnt, status, name), |
| 36 | TP_STRUCT__entry( |
| 37 | __field(u32, args_opcnt) |
| 38 | __field(u32, resp_opcnt) |
| 39 | __field(int, status) |
| 40 | __string(name, name) |
| 41 | ), |
| 42 | TP_fast_assign( |
| 43 | __entry->args_opcnt = args_opcnt; |
| 44 | __entry->resp_opcnt = resp_opcnt; |
| 45 | __entry->status = be32_to_cpu(status); |
| 46 | __assign_str(name, name); |
| 47 | ), |
| 48 | TP_printk("op=%u/%u %s status=%d", |
| 49 | __entry->resp_opcnt, __entry->args_opcnt, |
| 50 | __get_str(name), __entry->status) |
| 51 | ) |
| 52 | |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 53 | DECLARE_EVENT_CLASS(nfsd_io_class, |
| 54 | TP_PROTO(struct svc_rqst *rqstp, |
| 55 | struct svc_fh *fhp, |
| 56 | loff_t offset, |
Chuck Lever | 79e0b4e | 2018-03-27 10:52:57 -0400 | [diff] [blame] | 57 | unsigned long len), |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 58 | TP_ARGS(rqstp, fhp, offset, len), |
| 59 | TP_STRUCT__entry( |
Chuck Lever | afa720a | 2018-03-27 10:52:43 -0400 | [diff] [blame] | 60 | __field(u32, xid) |
| 61 | __field(u32, fh_hash) |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 62 | __field(loff_t, offset) |
Chuck Lever | 79e0b4e | 2018-03-27 10:52:57 -0400 | [diff] [blame] | 63 | __field(unsigned long, len) |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 64 | ), |
| 65 | TP_fast_assign( |
Chuck Lever | afa720a | 2018-03-27 10:52:43 -0400 | [diff] [blame] | 66 | __entry->xid = be32_to_cpu(rqstp->rq_xid); |
Chuck Lever | 79e0b4e | 2018-03-27 10:52:57 -0400 | [diff] [blame] | 67 | __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 68 | __entry->offset = offset; |
| 69 | __entry->len = len; |
| 70 | ), |
Chuck Lever | 79e0b4e | 2018-03-27 10:52:57 -0400 | [diff] [blame] | 71 | TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld len=%lu", |
Chuck Lever | afa720a | 2018-03-27 10:52:43 -0400 | [diff] [blame] | 72 | __entry->xid, __entry->fh_hash, |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 73 | __entry->offset, __entry->len) |
| 74 | ) |
| 75 | |
| 76 | #define DEFINE_NFSD_IO_EVENT(name) \ |
Chuck Lever | f394b62 | 2018-03-27 10:53:11 -0400 | [diff] [blame] | 77 | DEFINE_EVENT(nfsd_io_class, nfsd_##name, \ |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 78 | TP_PROTO(struct svc_rqst *rqstp, \ |
| 79 | struct svc_fh *fhp, \ |
| 80 | loff_t offset, \ |
Chuck Lever | 79e0b4e | 2018-03-27 10:52:57 -0400 | [diff] [blame] | 81 | unsigned long len), \ |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 82 | TP_ARGS(rqstp, fhp, offset, len)) |
| 83 | |
| 84 | DEFINE_NFSD_IO_EVENT(read_start); |
Chuck Lever | 87c5942 | 2018-03-28 13:29:11 -0400 | [diff] [blame] | 85 | DEFINE_NFSD_IO_EVENT(read_splice); |
| 86 | DEFINE_NFSD_IO_EVENT(read_vector); |
Jeff Layton | 6e8b50d | 2015-11-17 06:52:23 -0500 | [diff] [blame] | 87 | DEFINE_NFSD_IO_EVENT(read_io_done); |
| 88 | DEFINE_NFSD_IO_EVENT(read_done); |
| 89 | DEFINE_NFSD_IO_EVENT(write_start); |
| 90 | DEFINE_NFSD_IO_EVENT(write_opened); |
| 91 | DEFINE_NFSD_IO_EVENT(write_io_done); |
| 92 | DEFINE_NFSD_IO_EVENT(write_done); |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 93 | |
Chuck Lever | d890be1 | 2018-03-27 10:53:27 -0400 | [diff] [blame] | 94 | DECLARE_EVENT_CLASS(nfsd_err_class, |
| 95 | TP_PROTO(struct svc_rqst *rqstp, |
| 96 | struct svc_fh *fhp, |
| 97 | loff_t offset, |
| 98 | int status), |
| 99 | TP_ARGS(rqstp, fhp, offset, status), |
| 100 | TP_STRUCT__entry( |
| 101 | __field(u32, xid) |
| 102 | __field(u32, fh_hash) |
| 103 | __field(loff_t, offset) |
| 104 | __field(int, status) |
| 105 | ), |
| 106 | TP_fast_assign( |
| 107 | __entry->xid = be32_to_cpu(rqstp->rq_xid); |
| 108 | __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle); |
| 109 | __entry->offset = offset; |
| 110 | __entry->status = status; |
| 111 | ), |
| 112 | TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d", |
| 113 | __entry->xid, __entry->fh_hash, |
| 114 | __entry->offset, __entry->status) |
| 115 | ) |
| 116 | |
| 117 | #define DEFINE_NFSD_ERR_EVENT(name) \ |
| 118 | DEFINE_EVENT(nfsd_err_class, nfsd_##name, \ |
| 119 | TP_PROTO(struct svc_rqst *rqstp, \ |
| 120 | struct svc_fh *fhp, \ |
| 121 | loff_t offset, \ |
| 122 | int len), \ |
| 123 | TP_ARGS(rqstp, fhp, offset, len)) |
| 124 | |
Chuck Lever | 87c5942 | 2018-03-28 13:29:11 -0400 | [diff] [blame] | 125 | DEFINE_NFSD_ERR_EVENT(read_err); |
Chuck Lever | d890be1 | 2018-03-27 10:53:27 -0400 | [diff] [blame] | 126 | DEFINE_NFSD_ERR_EVENT(write_err); |
| 127 | |
Jeff Layton | 825213e | 2015-10-03 08:19:57 -0400 | [diff] [blame] | 128 | #include "state.h" |
| 129 | |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 130 | DECLARE_EVENT_CLASS(nfsd_stateid_class, |
| 131 | TP_PROTO(stateid_t *stp), |
| 132 | TP_ARGS(stp), |
| 133 | TP_STRUCT__entry( |
| 134 | __field(u32, cl_boot) |
| 135 | __field(u32, cl_id) |
| 136 | __field(u32, si_id) |
| 137 | __field(u32, si_generation) |
| 138 | ), |
| 139 | TP_fast_assign( |
| 140 | __entry->cl_boot = stp->si_opaque.so_clid.cl_boot; |
| 141 | __entry->cl_id = stp->si_opaque.so_clid.cl_id; |
| 142 | __entry->si_id = stp->si_opaque.so_id; |
| 143 | __entry->si_generation = stp->si_generation; |
| 144 | ), |
| 145 | TP_printk("client %08x:%08x stateid %08x:%08x", |
| 146 | __entry->cl_boot, |
| 147 | __entry->cl_id, |
| 148 | __entry->si_id, |
| 149 | __entry->si_generation) |
| 150 | ) |
| 151 | |
| 152 | #define DEFINE_STATEID_EVENT(name) \ |
Chuck Lever | f394b62 | 2018-03-27 10:53:11 -0400 | [diff] [blame] | 153 | DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \ |
Christoph Hellwig | 31ef83d | 2014-08-16 19:02:22 -0500 | [diff] [blame] | 154 | TP_PROTO(stateid_t *stp), \ |
| 155 | TP_ARGS(stp)) |
| 156 | DEFINE_STATEID_EVENT(layoutstate_alloc); |
| 157 | DEFINE_STATEID_EVENT(layoutstate_unhash); |
| 158 | DEFINE_STATEID_EVENT(layoutstate_free); |
| 159 | DEFINE_STATEID_EVENT(layout_get_lookup_fail); |
| 160 | DEFINE_STATEID_EVENT(layout_commit_lookup_fail); |
| 161 | DEFINE_STATEID_EVENT(layout_return_lookup_fail); |
| 162 | DEFINE_STATEID_EVENT(layout_recall); |
| 163 | DEFINE_STATEID_EVENT(layout_recall_done); |
| 164 | DEFINE_STATEID_EVENT(layout_recall_fail); |
| 165 | DEFINE_STATEID_EVENT(layout_recall_release); |
| 166 | |
| 167 | #endif /* _NFSD_TRACE_H */ |
| 168 | |
| 169 | #undef TRACE_INCLUDE_PATH |
| 170 | #define TRACE_INCLUDE_PATH . |
| 171 | #define TRACE_INCLUDE_FILE trace |
| 172 | #include <trace/define_trace.h> |