1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com> 4 */ 5 #undef TRACE_SYSTEM 6 #define TRACE_SYSTEM nfs4 7 8 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ) 9 #define _TRACE_NFS4_H 10 11 #include <linux/tracepoint.h> 12 13 TRACE_DEFINE_ENUM(EPERM); 14 TRACE_DEFINE_ENUM(ENOENT); 15 TRACE_DEFINE_ENUM(EIO); 16 TRACE_DEFINE_ENUM(ENXIO); 17 TRACE_DEFINE_ENUM(EACCES); 18 TRACE_DEFINE_ENUM(EEXIST); 19 TRACE_DEFINE_ENUM(EXDEV); 20 TRACE_DEFINE_ENUM(ENOTDIR); 21 TRACE_DEFINE_ENUM(EISDIR); 22 TRACE_DEFINE_ENUM(EFBIG); 23 TRACE_DEFINE_ENUM(ENOSPC); 24 TRACE_DEFINE_ENUM(EROFS); 25 TRACE_DEFINE_ENUM(EMLINK); 26 TRACE_DEFINE_ENUM(ENAMETOOLONG); 27 TRACE_DEFINE_ENUM(ENOTEMPTY); 28 TRACE_DEFINE_ENUM(EDQUOT); 29 TRACE_DEFINE_ENUM(ESTALE); 30 TRACE_DEFINE_ENUM(EBADHANDLE); 31 TRACE_DEFINE_ENUM(EBADCOOKIE); 32 TRACE_DEFINE_ENUM(ENOTSUPP); 33 TRACE_DEFINE_ENUM(ETOOSMALL); 34 TRACE_DEFINE_ENUM(EREMOTEIO); 35 TRACE_DEFINE_ENUM(EBADTYPE); 36 TRACE_DEFINE_ENUM(EAGAIN); 37 TRACE_DEFINE_ENUM(ELOOP); 38 TRACE_DEFINE_ENUM(EOPNOTSUPP); 39 TRACE_DEFINE_ENUM(EDEADLK); 40 TRACE_DEFINE_ENUM(ENOMEM); 41 TRACE_DEFINE_ENUM(EKEYEXPIRED); 42 TRACE_DEFINE_ENUM(ETIMEDOUT); 43 TRACE_DEFINE_ENUM(ERESTARTSYS); 44 TRACE_DEFINE_ENUM(ECONNREFUSED); 45 TRACE_DEFINE_ENUM(ECONNRESET); 46 TRACE_DEFINE_ENUM(ENETUNREACH); 47 TRACE_DEFINE_ENUM(EHOSTUNREACH); 48 TRACE_DEFINE_ENUM(EHOSTDOWN); 49 TRACE_DEFINE_ENUM(EPIPE); 50 TRACE_DEFINE_ENUM(EPFNOSUPPORT); 51 TRACE_DEFINE_ENUM(EPROTONOSUPPORT); 52 53 TRACE_DEFINE_ENUM(NFS4_OK); 54 TRACE_DEFINE_ENUM(NFS4ERR_ACCESS); 55 TRACE_DEFINE_ENUM(NFS4ERR_ATTRNOTSUPP); 56 TRACE_DEFINE_ENUM(NFS4ERR_ADMIN_REVOKED); 57 TRACE_DEFINE_ENUM(NFS4ERR_BACK_CHAN_BUSY); 58 TRACE_DEFINE_ENUM(NFS4ERR_BADCHAR); 59 TRACE_DEFINE_ENUM(NFS4ERR_BADHANDLE); 60 TRACE_DEFINE_ENUM(NFS4ERR_BADIOMODE); 61 TRACE_DEFINE_ENUM(NFS4ERR_BADLAYOUT); 62 TRACE_DEFINE_ENUM(NFS4ERR_BADLABEL); 63 TRACE_DEFINE_ENUM(NFS4ERR_BADNAME); 64 TRACE_DEFINE_ENUM(NFS4ERR_BADOWNER); 65 TRACE_DEFINE_ENUM(NFS4ERR_BADSESSION); 66 TRACE_DEFINE_ENUM(NFS4ERR_BADSLOT); 67 TRACE_DEFINE_ENUM(NFS4ERR_BADTYPE); 68 TRACE_DEFINE_ENUM(NFS4ERR_BADXDR); 69 TRACE_DEFINE_ENUM(NFS4ERR_BAD_COOKIE); 70 TRACE_DEFINE_ENUM(NFS4ERR_BAD_HIGH_SLOT); 71 TRACE_DEFINE_ENUM(NFS4ERR_BAD_RANGE); 72 TRACE_DEFINE_ENUM(NFS4ERR_BAD_SEQID); 73 TRACE_DEFINE_ENUM(NFS4ERR_BAD_SESSION_DIGEST); 74 TRACE_DEFINE_ENUM(NFS4ERR_BAD_STATEID); 75 TRACE_DEFINE_ENUM(NFS4ERR_CB_PATH_DOWN); 76 TRACE_DEFINE_ENUM(NFS4ERR_CLID_INUSE); 77 TRACE_DEFINE_ENUM(NFS4ERR_CLIENTID_BUSY); 78 TRACE_DEFINE_ENUM(NFS4ERR_COMPLETE_ALREADY); 79 TRACE_DEFINE_ENUM(NFS4ERR_CONN_NOT_BOUND_TO_SESSION); 80 TRACE_DEFINE_ENUM(NFS4ERR_DEADLOCK); 81 TRACE_DEFINE_ENUM(NFS4ERR_DEADSESSION); 82 TRACE_DEFINE_ENUM(NFS4ERR_DELAY); 83 TRACE_DEFINE_ENUM(NFS4ERR_DELEG_ALREADY_WANTED); 84 TRACE_DEFINE_ENUM(NFS4ERR_DELEG_REVOKED); 85 TRACE_DEFINE_ENUM(NFS4ERR_DENIED); 86 TRACE_DEFINE_ENUM(NFS4ERR_DIRDELEG_UNAVAIL); 87 TRACE_DEFINE_ENUM(NFS4ERR_DQUOT); 88 TRACE_DEFINE_ENUM(NFS4ERR_ENCR_ALG_UNSUPP); 89 TRACE_DEFINE_ENUM(NFS4ERR_EXIST); 90 TRACE_DEFINE_ENUM(NFS4ERR_EXPIRED); 91 TRACE_DEFINE_ENUM(NFS4ERR_FBIG); 92 TRACE_DEFINE_ENUM(NFS4ERR_FHEXPIRED); 93 TRACE_DEFINE_ENUM(NFS4ERR_FILE_OPEN); 94 TRACE_DEFINE_ENUM(NFS4ERR_GRACE); 95 TRACE_DEFINE_ENUM(NFS4ERR_HASH_ALG_UNSUPP); 96 TRACE_DEFINE_ENUM(NFS4ERR_INVAL); 97 TRACE_DEFINE_ENUM(NFS4ERR_IO); 98 TRACE_DEFINE_ENUM(NFS4ERR_ISDIR); 99 TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTTRYLATER); 100 TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTUNAVAILABLE); 101 TRACE_DEFINE_ENUM(NFS4ERR_LEASE_MOVED); 102 TRACE_DEFINE_ENUM(NFS4ERR_LOCKED); 103 TRACE_DEFINE_ENUM(NFS4ERR_LOCKS_HELD); 104 TRACE_DEFINE_ENUM(NFS4ERR_LOCK_RANGE); 105 TRACE_DEFINE_ENUM(NFS4ERR_MINOR_VERS_MISMATCH); 106 TRACE_DEFINE_ENUM(NFS4ERR_MLINK); 107 TRACE_DEFINE_ENUM(NFS4ERR_MOVED); 108 TRACE_DEFINE_ENUM(NFS4ERR_NAMETOOLONG); 109 TRACE_DEFINE_ENUM(NFS4ERR_NOENT); 110 TRACE_DEFINE_ENUM(NFS4ERR_NOFILEHANDLE); 111 TRACE_DEFINE_ENUM(NFS4ERR_NOMATCHING_LAYOUT); 112 TRACE_DEFINE_ENUM(NFS4ERR_NOSPC); 113 TRACE_DEFINE_ENUM(NFS4ERR_NOTDIR); 114 TRACE_DEFINE_ENUM(NFS4ERR_NOTEMPTY); 115 TRACE_DEFINE_ENUM(NFS4ERR_NOTSUPP); 116 TRACE_DEFINE_ENUM(NFS4ERR_NOT_ONLY_OP); 117 TRACE_DEFINE_ENUM(NFS4ERR_NOT_SAME); 118 TRACE_DEFINE_ENUM(NFS4ERR_NO_GRACE); 119 TRACE_DEFINE_ENUM(NFS4ERR_NXIO); 120 TRACE_DEFINE_ENUM(NFS4ERR_OLD_STATEID); 121 TRACE_DEFINE_ENUM(NFS4ERR_OPENMODE); 122 TRACE_DEFINE_ENUM(NFS4ERR_OP_ILLEGAL); 123 TRACE_DEFINE_ENUM(NFS4ERR_OP_NOT_IN_SESSION); 124 TRACE_DEFINE_ENUM(NFS4ERR_PERM); 125 TRACE_DEFINE_ENUM(NFS4ERR_PNFS_IO_HOLE); 126 TRACE_DEFINE_ENUM(NFS4ERR_PNFS_NO_LAYOUT); 127 TRACE_DEFINE_ENUM(NFS4ERR_RECALLCONFLICT); 128 TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_BAD); 129 TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_CONFLICT); 130 TRACE_DEFINE_ENUM(NFS4ERR_REJECT_DELEG); 131 TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG); 132 TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG_TO_CACHE); 133 TRACE_DEFINE_ENUM(NFS4ERR_REQ_TOO_BIG); 134 TRACE_DEFINE_ENUM(NFS4ERR_RESOURCE); 135 TRACE_DEFINE_ENUM(NFS4ERR_RESTOREFH); 136 TRACE_DEFINE_ENUM(NFS4ERR_RETRY_UNCACHED_REP); 137 TRACE_DEFINE_ENUM(NFS4ERR_RETURNCONFLICT); 138 TRACE_DEFINE_ENUM(NFS4ERR_ROFS); 139 TRACE_DEFINE_ENUM(NFS4ERR_SAME); 140 TRACE_DEFINE_ENUM(NFS4ERR_SHARE_DENIED); 141 TRACE_DEFINE_ENUM(NFS4ERR_SEQUENCE_POS); 142 TRACE_DEFINE_ENUM(NFS4ERR_SEQ_FALSE_RETRY); 143 TRACE_DEFINE_ENUM(NFS4ERR_SEQ_MISORDERED); 144 TRACE_DEFINE_ENUM(NFS4ERR_SERVERFAULT); 145 TRACE_DEFINE_ENUM(NFS4ERR_STALE); 146 TRACE_DEFINE_ENUM(NFS4ERR_STALE_CLIENTID); 147 TRACE_DEFINE_ENUM(NFS4ERR_STALE_STATEID); 148 TRACE_DEFINE_ENUM(NFS4ERR_SYMLINK); 149 TRACE_DEFINE_ENUM(NFS4ERR_TOOSMALL); 150 TRACE_DEFINE_ENUM(NFS4ERR_TOO_MANY_OPS); 151 TRACE_DEFINE_ENUM(NFS4ERR_UNKNOWN_LAYOUTTYPE); 152 TRACE_DEFINE_ENUM(NFS4ERR_UNSAFE_COMPOUND); 153 TRACE_DEFINE_ENUM(NFS4ERR_WRONGSEC); 154 TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED); 155 TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE); 156 TRACE_DEFINE_ENUM(NFS4ERR_XDEV); 157 158 TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS); 159 TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS); 160 161 #define show_nfsv4_errors(error) \ 162 __print_symbolic(error, \ 163 { NFS4_OK, "OK" }, \ 164 /* Mapped by nfs4_stat_to_errno() */ \ 165 { EPERM, "EPERM" }, \ 166 { ENOENT, "ENOENT" }, \ 167 { EIO, "EIO" }, \ 168 { ENXIO, "ENXIO" }, \ 169 { EACCES, "EACCES" }, \ 170 { EEXIST, "EEXIST" }, \ 171 { EXDEV, "EXDEV" }, \ 172 { ENOTDIR, "ENOTDIR" }, \ 173 { EISDIR, "EISDIR" }, \ 174 { EFBIG, "EFBIG" }, \ 175 { ENOSPC, "ENOSPC" }, \ 176 { EROFS, "EROFS" }, \ 177 { EMLINK, "EMLINK" }, \ 178 { ENAMETOOLONG, "ENAMETOOLONG" }, \ 179 { ENOTEMPTY, "ENOTEMPTY" }, \ 180 { EDQUOT, "EDQUOT" }, \ 181 { ESTALE, "ESTALE" }, \ 182 { EBADHANDLE, "EBADHANDLE" }, \ 183 { EBADCOOKIE, "EBADCOOKIE" }, \ 184 { ENOTSUPP, "ENOTSUPP" }, \ 185 { ETOOSMALL, "ETOOSMALL" }, \ 186 { EREMOTEIO, "EREMOTEIO" }, \ 187 { EBADTYPE, "EBADTYPE" }, \ 188 { EAGAIN, "EAGAIN" }, \ 189 { ELOOP, "ELOOP" }, \ 190 { EOPNOTSUPP, "EOPNOTSUPP" }, \ 191 { EDEADLK, "EDEADLK" }, \ 192 /* RPC errors */ \ 193 { ENOMEM, "ENOMEM" }, \ 194 { EKEYEXPIRED, "EKEYEXPIRED" }, \ 195 { ETIMEDOUT, "ETIMEDOUT" }, \ 196 { ERESTARTSYS, "ERESTARTSYS" }, \ 197 { ECONNREFUSED, "ECONNREFUSED" }, \ 198 { ECONNRESET, "ECONNRESET" }, \ 199 { ENETUNREACH, "ENETUNREACH" }, \ 200 { EHOSTUNREACH, "EHOSTUNREACH" }, \ 201 { EHOSTDOWN, "EHOSTDOWN" }, \ 202 { EPIPE, "EPIPE" }, \ 203 { EPFNOSUPPORT, "EPFNOSUPPORT" }, \ 204 { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \ 205 /* NFSv4 native errors */ \ 206 { NFS4ERR_ACCESS, "ACCESS" }, \ 207 { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \ 208 { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \ 209 { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \ 210 { NFS4ERR_BADCHAR, "BADCHAR" }, \ 211 { NFS4ERR_BADHANDLE, "BADHANDLE" }, \ 212 { NFS4ERR_BADIOMODE, "BADIOMODE" }, \ 213 { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \ 214 { NFS4ERR_BADLABEL, "BADLABEL" }, \ 215 { NFS4ERR_BADNAME, "BADNAME" }, \ 216 { NFS4ERR_BADOWNER, "BADOWNER" }, \ 217 { NFS4ERR_BADSESSION, "BADSESSION" }, \ 218 { NFS4ERR_BADSLOT, "BADSLOT" }, \ 219 { NFS4ERR_BADTYPE, "BADTYPE" }, \ 220 { NFS4ERR_BADXDR, "BADXDR" }, \ 221 { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \ 222 { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \ 223 { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \ 224 { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \ 225 { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \ 226 { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \ 227 { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 228 { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \ 229 { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \ 230 { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \ 231 { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \ 232 "CONN_NOT_BOUND_TO_SESSION" }, \ 233 { NFS4ERR_DEADLOCK, "DEADLOCK" }, \ 234 { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \ 235 { NFS4ERR_DELAY, "DELAY" }, \ 236 { NFS4ERR_DELEG_ALREADY_WANTED, \ 237 "DELEG_ALREADY_WANTED" }, \ 238 { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \ 239 { NFS4ERR_DENIED, "DENIED" }, \ 240 { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \ 241 { NFS4ERR_DQUOT, "DQUOT" }, \ 242 { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \ 243 { NFS4ERR_EXIST, "EXIST" }, \ 244 { NFS4ERR_EXPIRED, "EXPIRED" }, \ 245 { NFS4ERR_FBIG, "FBIG" }, \ 246 { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \ 247 { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \ 248 { NFS4ERR_GRACE, "GRACE" }, \ 249 { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \ 250 { NFS4ERR_INVAL, "INVAL" }, \ 251 { NFS4ERR_IO, "IO" }, \ 252 { NFS4ERR_ISDIR, "ISDIR" }, \ 253 { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \ 254 { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \ 255 { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \ 256 { NFS4ERR_LOCKED, "LOCKED" }, \ 257 { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \ 258 { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \ 259 { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \ 260 { NFS4ERR_MLINK, "MLINK" }, \ 261 { NFS4ERR_MOVED, "MOVED" }, \ 262 { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \ 263 { NFS4ERR_NOENT, "NOENT" }, \ 264 { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \ 265 { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \ 266 { NFS4ERR_NOSPC, "NOSPC" }, \ 267 { NFS4ERR_NOTDIR, "NOTDIR" }, \ 268 { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \ 269 { NFS4ERR_NOTSUPP, "NOTSUPP" }, \ 270 { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \ 271 { NFS4ERR_NOT_SAME, "NOT_SAME" }, \ 272 { NFS4ERR_NO_GRACE, "NO_GRACE" }, \ 273 { NFS4ERR_NXIO, "NXIO" }, \ 274 { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \ 275 { NFS4ERR_OPENMODE, "OPENMODE" }, \ 276 { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \ 277 { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \ 278 { NFS4ERR_PERM, "PERM" }, \ 279 { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \ 280 { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \ 281 { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \ 282 { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \ 283 { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \ 284 { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \ 285 { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \ 286 { NFS4ERR_REP_TOO_BIG_TO_CACHE, \ 287 "REP_TOO_BIG_TO_CACHE" }, \ 288 { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \ 289 { NFS4ERR_RESOURCE, "RESOURCE" }, \ 290 { NFS4ERR_RESTOREFH, "RESTOREFH" }, \ 291 { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \ 292 { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \ 293 { NFS4ERR_ROFS, "ROFS" }, \ 294 { NFS4ERR_SAME, "SAME" }, \ 295 { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \ 296 { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \ 297 { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \ 298 { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \ 299 { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \ 300 { NFS4ERR_STALE, "STALE" }, \ 301 { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \ 302 { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \ 303 { NFS4ERR_SYMLINK, "SYMLINK" }, \ 304 { NFS4ERR_TOOSMALL, "TOOSMALL" }, \ 305 { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \ 306 { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \ 307 { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \ 308 { NFS4ERR_WRONGSEC, "WRONGSEC" }, \ 309 { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \ 310 { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \ 311 { NFS4ERR_XDEV, "XDEV" }, \ 312 /* ***** Internal to Linux NFS client ***** */ \ 313 { NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \ 314 { NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" }) 315 316 #define show_open_flags(flags) \ 317 __print_flags(flags, "|", \ 318 { O_CREAT, "O_CREAT" }, \ 319 { O_EXCL, "O_EXCL" }, \ 320 { O_TRUNC, "O_TRUNC" }, \ 321 { O_DIRECT, "O_DIRECT" }) 322 323 #define show_fmode_flags(mode) \ 324 __print_flags(mode, "|", \ 325 { ((__force unsigned long)FMODE_READ), "READ" }, \ 326 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \ 327 { ((__force unsigned long)FMODE_EXEC), "EXEC" }) 328 329 #define show_nfs_fattr_flags(valid) \ 330 __print_flags((unsigned long)valid, "|", \ 331 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \ 332 { NFS_ATTR_FATTR_MODE, "MODE" }, \ 333 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \ 334 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \ 335 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \ 336 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \ 337 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \ 338 { NFS_ATTR_FATTR_FSID, "FSID" }, \ 339 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \ 340 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \ 341 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \ 342 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \ 343 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \ 344 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \ 345 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" }) 346 347 DECLARE_EVENT_CLASS(nfs4_clientid_event, 348 TP_PROTO( 349 const struct nfs_client *clp, 350 int error 351 ), 352 353 TP_ARGS(clp, error), 354 355 TP_STRUCT__entry( 356 __string(dstaddr, clp->cl_hostname) 357 __field(unsigned long, error) 358 ), 359 360 TP_fast_assign( 361 __entry->error = error < 0 ? -error : 0; 362 __assign_str(dstaddr, clp->cl_hostname); 363 ), 364 365 TP_printk( 366 "error=%ld (%s) dstaddr=%s", 367 -__entry->error, 368 show_nfsv4_errors(__entry->error), 369 __get_str(dstaddr) 370 ) 371 ); 372 #define DEFINE_NFS4_CLIENTID_EVENT(name) \ 373 DEFINE_EVENT(nfs4_clientid_event, name, \ 374 TP_PROTO( \ 375 const struct nfs_client *clp, \ 376 int error \ 377 ), \ 378 TP_ARGS(clp, error)) 379 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid); 380 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm); 381 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew); 382 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async); 383 #ifdef CONFIG_NFS_V4_1 384 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id); 385 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session); 386 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session); 387 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid); 388 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session); 389 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence); 390 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete); 391 392 #define show_nfs4_sequence_status_flags(status) \ 393 __print_flags((unsigned long)status, "|", \ 394 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 395 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \ 396 "CB_GSS_CONTEXTS_EXPIRING" }, \ 397 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \ 398 "CB_GSS_CONTEXTS_EXPIRED" }, \ 399 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \ 400 "EXPIRED_ALL_STATE_REVOKED" }, \ 401 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \ 402 "EXPIRED_SOME_STATE_REVOKED" }, \ 403 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \ 404 "ADMIN_STATE_REVOKED" }, \ 405 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \ 406 "RECALLABLE_STATE_REVOKED" }, \ 407 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \ 408 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \ 409 "RESTART_RECLAIM_NEEDED" }, \ 410 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \ 411 "CB_PATH_DOWN_SESSION" }, \ 412 { SEQ4_STATUS_BACKCHANNEL_FAULT, \ 413 "BACKCHANNEL_FAULT" }) 414 415 TRACE_EVENT(nfs4_sequence_done, 416 TP_PROTO( 417 const struct nfs4_session *session, 418 const struct nfs4_sequence_res *res 419 ), 420 TP_ARGS(session, res), 421 422 TP_STRUCT__entry( 423 __field(unsigned int, session) 424 __field(unsigned int, slot_nr) 425 __field(unsigned int, seq_nr) 426 __field(unsigned int, highest_slotid) 427 __field(unsigned int, target_highest_slotid) 428 __field(unsigned int, status_flags) 429 __field(unsigned long, error) 430 ), 431 432 TP_fast_assign( 433 const struct nfs4_slot *sr_slot = res->sr_slot; 434 __entry->session = nfs_session_id_hash(&session->sess_id); 435 __entry->slot_nr = sr_slot->slot_nr; 436 __entry->seq_nr = sr_slot->seq_nr; 437 __entry->highest_slotid = res->sr_highest_slotid; 438 __entry->target_highest_slotid = 439 res->sr_target_highest_slotid; 440 __entry->status_flags = res->sr_status_flags; 441 __entry->error = res->sr_status < 0 ? 442 -res->sr_status : 0; 443 ), 444 TP_printk( 445 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 446 "highest_slotid=%u target_highest_slotid=%u " 447 "status_flags=%u (%s)", 448 -__entry->error, 449 show_nfsv4_errors(__entry->error), 450 __entry->session, 451 __entry->slot_nr, 452 __entry->seq_nr, 453 __entry->highest_slotid, 454 __entry->target_highest_slotid, 455 __entry->status_flags, 456 show_nfs4_sequence_status_flags(__entry->status_flags) 457 ) 458 ); 459 460 struct cb_sequenceargs; 461 struct cb_sequenceres; 462 463 TRACE_EVENT(nfs4_cb_sequence, 464 TP_PROTO( 465 const struct cb_sequenceargs *args, 466 const struct cb_sequenceres *res, 467 __be32 status 468 ), 469 TP_ARGS(args, res, status), 470 471 TP_STRUCT__entry( 472 __field(unsigned int, session) 473 __field(unsigned int, slot_nr) 474 __field(unsigned int, seq_nr) 475 __field(unsigned int, highest_slotid) 476 __field(unsigned int, cachethis) 477 __field(unsigned long, error) 478 ), 479 480 TP_fast_assign( 481 __entry->session = nfs_session_id_hash(&args->csa_sessionid); 482 __entry->slot_nr = args->csa_slotid; 483 __entry->seq_nr = args->csa_sequenceid; 484 __entry->highest_slotid = args->csa_highestslotid; 485 __entry->cachethis = args->csa_cachethis; 486 __entry->error = be32_to_cpu(status); 487 ), 488 489 TP_printk( 490 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 491 "highest_slotid=%u", 492 -__entry->error, 493 show_nfsv4_errors(__entry->error), 494 __entry->session, 495 __entry->slot_nr, 496 __entry->seq_nr, 497 __entry->highest_slotid 498 ) 499 ); 500 501 TRACE_EVENT(nfs4_cb_seqid_err, 502 TP_PROTO( 503 const struct cb_sequenceargs *args, 504 __be32 status 505 ), 506 TP_ARGS(args, status), 507 508 TP_STRUCT__entry( 509 __field(unsigned int, session) 510 __field(unsigned int, slot_nr) 511 __field(unsigned int, seq_nr) 512 __field(unsigned int, highest_slotid) 513 __field(unsigned int, cachethis) 514 __field(unsigned long, error) 515 ), 516 517 TP_fast_assign( 518 __entry->session = nfs_session_id_hash(&args->csa_sessionid); 519 __entry->slot_nr = args->csa_slotid; 520 __entry->seq_nr = args->csa_sequenceid; 521 __entry->highest_slotid = args->csa_highestslotid; 522 __entry->cachethis = args->csa_cachethis; 523 __entry->error = be32_to_cpu(status); 524 ), 525 526 TP_printk( 527 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 528 "highest_slotid=%u", 529 -__entry->error, 530 show_nfsv4_errors(__entry->error), 531 __entry->session, 532 __entry->slot_nr, 533 __entry->seq_nr, 534 __entry->highest_slotid 535 ) 536 ); 537 538 #endif /* CONFIG_NFS_V4_1 */ 539 540 TRACE_EVENT(nfs4_setup_sequence, 541 TP_PROTO( 542 const struct nfs4_session *session, 543 const struct nfs4_sequence_args *args 544 ), 545 TP_ARGS(session, args), 546 547 TP_STRUCT__entry( 548 __field(unsigned int, session) 549 __field(unsigned int, slot_nr) 550 __field(unsigned int, seq_nr) 551 __field(unsigned int, highest_used_slotid) 552 ), 553 554 TP_fast_assign( 555 const struct nfs4_slot *sa_slot = args->sa_slot; 556 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0; 557 __entry->slot_nr = sa_slot->slot_nr; 558 __entry->seq_nr = sa_slot->seq_nr; 559 __entry->highest_used_slotid = 560 sa_slot->table->highest_used_slotid; 561 ), 562 TP_printk( 563 "session=0x%08x slot_nr=%u seq_nr=%u " 564 "highest_used_slotid=%u", 565 __entry->session, 566 __entry->slot_nr, 567 __entry->seq_nr, 568 __entry->highest_used_slotid 569 ) 570 ); 571 572 TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING); 573 TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE); 574 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED); 575 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT); 576 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE); 577 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN); 578 TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET); 579 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM); 580 TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH); 581 TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE); 582 TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION); 583 TRACE_DEFINE_ENUM(NFS4CLNT_MOVED); 584 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED); 585 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED); 586 TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER); 587 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN_RUNNING); 588 589 #define show_nfs4_clp_state(state) \ 590 __print_flags(state, "|", \ 591 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \ 592 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \ 593 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \ 594 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \ 595 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \ 596 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \ 597 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \ 598 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \ 599 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \ 600 "SERVER_SCOPE_MISMATCH" }, \ 601 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \ 602 { NFS4CLNT_BIND_CONN_TO_SESSION, \ 603 "BIND_CONN_TO_SESSION" }, \ 604 { NFS4CLNT_MOVED, "MOVED" }, \ 605 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \ 606 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \ 607 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \ 608 { NFS4CLNT_DELEGRETURN_RUNNING, "DELEGRETURN_RUNNING" }) 609 610 TRACE_EVENT(nfs4_state_mgr, 611 TP_PROTO( 612 const struct nfs_client *clp 613 ), 614 615 TP_ARGS(clp), 616 617 TP_STRUCT__entry( 618 __field(unsigned long, state) 619 __string(hostname, clp->cl_hostname) 620 ), 621 622 TP_fast_assign( 623 __entry->state = clp->cl_state; 624 __assign_str(hostname, clp->cl_hostname) 625 ), 626 627 TP_printk( 628 "hostname=%s clp state=%s", __get_str(hostname), 629 show_nfs4_clp_state(__entry->state) 630 ) 631 ) 632 633 TRACE_EVENT(nfs4_state_mgr_failed, 634 TP_PROTO( 635 const struct nfs_client *clp, 636 const char *section, 637 int status 638 ), 639 640 TP_ARGS(clp, section, status), 641 642 TP_STRUCT__entry( 643 __field(unsigned long, error) 644 __field(unsigned long, state) 645 __string(hostname, clp->cl_hostname) 646 __string(section, section) 647 ), 648 649 TP_fast_assign( 650 __entry->error = status < 0 ? -status : 0; 651 __entry->state = clp->cl_state; 652 __assign_str(hostname, clp->cl_hostname); 653 __assign_str(section, section); 654 ), 655 656 TP_printk( 657 "hostname=%s clp state=%s error=%ld (%s) section=%s", 658 __get_str(hostname), 659 show_nfs4_clp_state(__entry->state), -__entry->error, 660 show_nfsv4_errors(__entry->error), __get_str(section) 661 662 ) 663 ) 664 665 TRACE_EVENT(nfs4_xdr_status, 666 TP_PROTO( 667 const struct xdr_stream *xdr, 668 u32 op, 669 u32 error 670 ), 671 672 TP_ARGS(xdr, op, error), 673 674 TP_STRUCT__entry( 675 __field(unsigned int, task_id) 676 __field(unsigned int, client_id) 677 __field(u32, xid) 678 __field(u32, op) 679 __field(unsigned long, error) 680 ), 681 682 TP_fast_assign( 683 const struct rpc_rqst *rqstp = xdr->rqst; 684 const struct rpc_task *task = rqstp->rq_task; 685 686 __entry->task_id = task->tk_pid; 687 __entry->client_id = task->tk_client->cl_clid; 688 __entry->xid = be32_to_cpu(rqstp->rq_xid); 689 __entry->op = op; 690 __entry->error = error; 691 ), 692 693 TP_printk( 694 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u", 695 __entry->task_id, __entry->client_id, __entry->xid, 696 -__entry->error, show_nfsv4_errors(__entry->error), 697 __entry->op 698 ) 699 ); 700 701 DECLARE_EVENT_CLASS(nfs4_cb_error_class, 702 TP_PROTO( 703 __be32 xid, 704 u32 cb_ident 705 ), 706 707 TP_ARGS(xid, cb_ident), 708 709 TP_STRUCT__entry( 710 __field(u32, xid) 711 __field(u32, cbident) 712 ), 713 714 TP_fast_assign( 715 __entry->xid = be32_to_cpu(xid); 716 __entry->cbident = cb_ident; 717 ), 718 719 TP_printk( 720 "xid=0x%08x cb_ident=0x%08x", 721 __entry->xid, __entry->cbident 722 ) 723 ); 724 725 #define DEFINE_CB_ERROR_EVENT(name) \ 726 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \ 727 TP_PROTO( \ 728 __be32 xid, \ 729 u32 cb_ident \ 730 ), \ 731 TP_ARGS(xid, cb_ident)) 732 733 DEFINE_CB_ERROR_EVENT(no_clp); 734 DEFINE_CB_ERROR_EVENT(badprinc); 735 736 DECLARE_EVENT_CLASS(nfs4_open_event, 737 TP_PROTO( 738 const struct nfs_open_context *ctx, 739 int flags, 740 int error 741 ), 742 743 TP_ARGS(ctx, flags, error), 744 745 TP_STRUCT__entry( 746 __field(unsigned long, error) 747 __field(unsigned int, flags) 748 __field(unsigned int, fmode) 749 __field(dev_t, dev) 750 __field(u32, fhandle) 751 __field(u64, fileid) 752 __field(u64, dir) 753 __string(name, ctx->dentry->d_name.name) 754 __field(int, stateid_seq) 755 __field(u32, stateid_hash) 756 __field(int, openstateid_seq) 757 __field(u32, openstateid_hash) 758 ), 759 760 TP_fast_assign( 761 const struct nfs4_state *state = ctx->state; 762 const struct inode *inode = NULL; 763 764 __entry->error = -error; 765 __entry->flags = flags; 766 __entry->fmode = (__force unsigned int)ctx->mode; 767 __entry->dev = ctx->dentry->d_sb->s_dev; 768 if (!IS_ERR_OR_NULL(state)) { 769 inode = state->inode; 770 __entry->stateid_seq = 771 be32_to_cpu(state->stateid.seqid); 772 __entry->stateid_hash = 773 nfs_stateid_hash(&state->stateid); 774 __entry->openstateid_seq = 775 be32_to_cpu(state->open_stateid.seqid); 776 __entry->openstateid_hash = 777 nfs_stateid_hash(&state->open_stateid); 778 } else { 779 __entry->stateid_seq = 0; 780 __entry->stateid_hash = 0; 781 __entry->openstateid_seq = 0; 782 __entry->openstateid_hash = 0; 783 } 784 if (inode != NULL) { 785 __entry->fileid = NFS_FILEID(inode); 786 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 787 } else { 788 __entry->fileid = 0; 789 __entry->fhandle = 0; 790 } 791 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent)); 792 __assign_str(name, ctx->dentry->d_name.name); 793 ), 794 795 TP_printk( 796 "error=%ld (%s) flags=%d (%s) fmode=%s " 797 "fileid=%02x:%02x:%llu fhandle=0x%08x " 798 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x " 799 "openstateid=%d:0x%08x", 800 -__entry->error, 801 show_nfsv4_errors(__entry->error), 802 __entry->flags, 803 show_open_flags(__entry->flags), 804 show_fmode_flags(__entry->fmode), 805 MAJOR(__entry->dev), MINOR(__entry->dev), 806 (unsigned long long)__entry->fileid, 807 __entry->fhandle, 808 MAJOR(__entry->dev), MINOR(__entry->dev), 809 (unsigned long long)__entry->dir, 810 __get_str(name), 811 __entry->stateid_seq, __entry->stateid_hash, 812 __entry->openstateid_seq, __entry->openstateid_hash 813 ) 814 ); 815 816 #define DEFINE_NFS4_OPEN_EVENT(name) \ 817 DEFINE_EVENT(nfs4_open_event, name, \ 818 TP_PROTO( \ 819 const struct nfs_open_context *ctx, \ 820 int flags, \ 821 int error \ 822 ), \ 823 TP_ARGS(ctx, flags, error)) 824 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim); 825 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired); 826 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file); 827 828 TRACE_EVENT(nfs4_cached_open, 829 TP_PROTO( 830 const struct nfs4_state *state 831 ), 832 TP_ARGS(state), 833 TP_STRUCT__entry( 834 __field(dev_t, dev) 835 __field(u32, fhandle) 836 __field(u64, fileid) 837 __field(unsigned int, fmode) 838 __field(int, stateid_seq) 839 __field(u32, stateid_hash) 840 ), 841 842 TP_fast_assign( 843 const struct inode *inode = state->inode; 844 845 __entry->dev = inode->i_sb->s_dev; 846 __entry->fileid = NFS_FILEID(inode); 847 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 848 __entry->fmode = (__force unsigned int)state->state; 849 __entry->stateid_seq = 850 be32_to_cpu(state->stateid.seqid); 851 __entry->stateid_hash = 852 nfs_stateid_hash(&state->stateid); 853 ), 854 855 TP_printk( 856 "fmode=%s fileid=%02x:%02x:%llu " 857 "fhandle=0x%08x stateid=%d:0x%08x", 858 __entry->fmode ? show_fmode_flags(__entry->fmode) : 859 "closed", 860 MAJOR(__entry->dev), MINOR(__entry->dev), 861 (unsigned long long)__entry->fileid, 862 __entry->fhandle, 863 __entry->stateid_seq, __entry->stateid_hash 864 ) 865 ); 866 867 TRACE_EVENT(nfs4_close, 868 TP_PROTO( 869 const struct nfs4_state *state, 870 const struct nfs_closeargs *args, 871 const struct nfs_closeres *res, 872 int error 873 ), 874 875 TP_ARGS(state, args, res, error), 876 877 TP_STRUCT__entry( 878 __field(dev_t, dev) 879 __field(u32, fhandle) 880 __field(u64, fileid) 881 __field(unsigned int, fmode) 882 __field(unsigned long, error) 883 __field(int, stateid_seq) 884 __field(u32, stateid_hash) 885 ), 886 887 TP_fast_assign( 888 const struct inode *inode = state->inode; 889 890 __entry->dev = inode->i_sb->s_dev; 891 __entry->fileid = NFS_FILEID(inode); 892 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 893 __entry->fmode = (__force unsigned int)state->state; 894 __entry->error = error < 0 ? -error : 0; 895 __entry->stateid_seq = 896 be32_to_cpu(args->stateid.seqid); 897 __entry->stateid_hash = 898 nfs_stateid_hash(&args->stateid); 899 ), 900 901 TP_printk( 902 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu " 903 "fhandle=0x%08x openstateid=%d:0x%08x", 904 -__entry->error, 905 show_nfsv4_errors(__entry->error), 906 __entry->fmode ? show_fmode_flags(__entry->fmode) : 907 "closed", 908 MAJOR(__entry->dev), MINOR(__entry->dev), 909 (unsigned long long)__entry->fileid, 910 __entry->fhandle, 911 __entry->stateid_seq, __entry->stateid_hash 912 ) 913 ); 914 915 TRACE_DEFINE_ENUM(F_GETLK); 916 TRACE_DEFINE_ENUM(F_SETLK); 917 TRACE_DEFINE_ENUM(F_SETLKW); 918 TRACE_DEFINE_ENUM(F_RDLCK); 919 TRACE_DEFINE_ENUM(F_WRLCK); 920 TRACE_DEFINE_ENUM(F_UNLCK); 921 922 #define show_lock_cmd(type) \ 923 __print_symbolic((int)type, \ 924 { F_GETLK, "GETLK" }, \ 925 { F_SETLK, "SETLK" }, \ 926 { F_SETLKW, "SETLKW" }) 927 #define show_lock_type(type) \ 928 __print_symbolic((int)type, \ 929 { F_RDLCK, "RDLCK" }, \ 930 { F_WRLCK, "WRLCK" }, \ 931 { F_UNLCK, "UNLCK" }) 932 933 DECLARE_EVENT_CLASS(nfs4_lock_event, 934 TP_PROTO( 935 const struct file_lock *request, 936 const struct nfs4_state *state, 937 int cmd, 938 int error 939 ), 940 941 TP_ARGS(request, state, cmd, error), 942 943 TP_STRUCT__entry( 944 __field(unsigned long, error) 945 __field(int, cmd) 946 __field(char, type) 947 __field(loff_t, start) 948 __field(loff_t, end) 949 __field(dev_t, dev) 950 __field(u32, fhandle) 951 __field(u64, fileid) 952 __field(int, stateid_seq) 953 __field(u32, stateid_hash) 954 ), 955 956 TP_fast_assign( 957 const struct inode *inode = state->inode; 958 959 __entry->error = error < 0 ? -error : 0; 960 __entry->cmd = cmd; 961 __entry->type = request->fl_type; 962 __entry->start = request->fl_start; 963 __entry->end = request->fl_end; 964 __entry->dev = inode->i_sb->s_dev; 965 __entry->fileid = NFS_FILEID(inode); 966 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 967 __entry->stateid_seq = 968 be32_to_cpu(state->stateid.seqid); 969 __entry->stateid_hash = 970 nfs_stateid_hash(&state->stateid); 971 ), 972 973 TP_printk( 974 "error=%ld (%s) cmd=%s:%s range=%lld:%lld " 975 "fileid=%02x:%02x:%llu fhandle=0x%08x " 976 "stateid=%d:0x%08x", 977 -__entry->error, 978 show_nfsv4_errors(__entry->error), 979 show_lock_cmd(__entry->cmd), 980 show_lock_type(__entry->type), 981 (long long)__entry->start, 982 (long long)__entry->end, 983 MAJOR(__entry->dev), MINOR(__entry->dev), 984 (unsigned long long)__entry->fileid, 985 __entry->fhandle, 986 __entry->stateid_seq, __entry->stateid_hash 987 ) 988 ); 989 990 #define DEFINE_NFS4_LOCK_EVENT(name) \ 991 DEFINE_EVENT(nfs4_lock_event, name, \ 992 TP_PROTO( \ 993 const struct file_lock *request, \ 994 const struct nfs4_state *state, \ 995 int cmd, \ 996 int error \ 997 ), \ 998 TP_ARGS(request, state, cmd, error)) 999 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock); 1000 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock); 1001 1002 TRACE_EVENT(nfs4_set_lock, 1003 TP_PROTO( 1004 const struct file_lock *request, 1005 const struct nfs4_state *state, 1006 const nfs4_stateid *lockstateid, 1007 int cmd, 1008 int error 1009 ), 1010 1011 TP_ARGS(request, state, lockstateid, cmd, error), 1012 1013 TP_STRUCT__entry( 1014 __field(unsigned long, error) 1015 __field(int, cmd) 1016 __field(char, type) 1017 __field(loff_t, start) 1018 __field(loff_t, end) 1019 __field(dev_t, dev) 1020 __field(u32, fhandle) 1021 __field(u64, fileid) 1022 __field(int, stateid_seq) 1023 __field(u32, stateid_hash) 1024 __field(int, lockstateid_seq) 1025 __field(u32, lockstateid_hash) 1026 ), 1027 1028 TP_fast_assign( 1029 const struct inode *inode = state->inode; 1030 1031 __entry->error = error < 0 ? -error : 0; 1032 __entry->cmd = cmd; 1033 __entry->type = request->fl_type; 1034 __entry->start = request->fl_start; 1035 __entry->end = request->fl_end; 1036 __entry->dev = inode->i_sb->s_dev; 1037 __entry->fileid = NFS_FILEID(inode); 1038 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1039 __entry->stateid_seq = 1040 be32_to_cpu(state->stateid.seqid); 1041 __entry->stateid_hash = 1042 nfs_stateid_hash(&state->stateid); 1043 __entry->lockstateid_seq = 1044 be32_to_cpu(lockstateid->seqid); 1045 __entry->lockstateid_hash = 1046 nfs_stateid_hash(lockstateid); 1047 ), 1048 1049 TP_printk( 1050 "error=%ld (%s) cmd=%s:%s range=%lld:%lld " 1051 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1052 "stateid=%d:0x%08x lockstateid=%d:0x%08x", 1053 -__entry->error, 1054 show_nfsv4_errors(__entry->error), 1055 show_lock_cmd(__entry->cmd), 1056 show_lock_type(__entry->type), 1057 (long long)__entry->start, 1058 (long long)__entry->end, 1059 MAJOR(__entry->dev), MINOR(__entry->dev), 1060 (unsigned long long)__entry->fileid, 1061 __entry->fhandle, 1062 __entry->stateid_seq, __entry->stateid_hash, 1063 __entry->lockstateid_seq, __entry->lockstateid_hash 1064 ) 1065 ); 1066 1067 TRACE_DEFINE_ENUM(LK_STATE_IN_USE); 1068 TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE); 1069 TRACE_DEFINE_ENUM(NFS_OPEN_STATE); 1070 TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE); 1071 TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE); 1072 TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE); 1073 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT); 1074 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE); 1075 TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS); 1076 TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED); 1077 TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK); 1078 TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT); 1079 TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE); 1080 TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE); 1081 TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE); 1082 1083 #define show_nfs4_state_flags(flags) \ 1084 __print_flags(flags, "|", \ 1085 { LK_STATE_IN_USE, "IN_USE" }, \ 1086 { NFS_DELEGATED_STATE, "DELEGATED" }, \ 1087 { NFS_OPEN_STATE, "OPEN" }, \ 1088 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \ 1089 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \ 1090 { NFS_O_RDWR_STATE, "O_RDWR" }, \ 1091 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \ 1092 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \ 1093 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \ 1094 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \ 1095 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \ 1096 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \ 1097 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \ 1098 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \ 1099 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" }) 1100 1101 #define show_nfs4_lock_flags(flags) \ 1102 __print_flags(flags, "|", \ 1103 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \ 1104 { BIT(NFS_LOCK_LOST), "LOST" }) 1105 1106 TRACE_EVENT(nfs4_state_lock_reclaim, 1107 TP_PROTO( 1108 const struct nfs4_state *state, 1109 const struct nfs4_lock_state *lock 1110 ), 1111 1112 TP_ARGS(state, lock), 1113 1114 TP_STRUCT__entry( 1115 __field(dev_t, dev) 1116 __field(u32, fhandle) 1117 __field(u64, fileid) 1118 __field(unsigned long, state_flags) 1119 __field(unsigned long, lock_flags) 1120 __field(int, stateid_seq) 1121 __field(u32, stateid_hash) 1122 ), 1123 1124 TP_fast_assign( 1125 const struct inode *inode = state->inode; 1126 1127 __entry->dev = inode->i_sb->s_dev; 1128 __entry->fileid = NFS_FILEID(inode); 1129 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1130 __entry->state_flags = state->flags; 1131 __entry->lock_flags = lock->ls_flags; 1132 __entry->stateid_seq = 1133 be32_to_cpu(state->stateid.seqid); 1134 __entry->stateid_hash = 1135 nfs_stateid_hash(&state->stateid); 1136 ), 1137 1138 TP_printk( 1139 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1140 "stateid=%d:0x%08x state_flags=%s lock_flags=%s", 1141 MAJOR(__entry->dev), MINOR(__entry->dev), 1142 (unsigned long long)__entry->fileid, __entry->fhandle, 1143 __entry->stateid_seq, __entry->stateid_hash, 1144 show_nfs4_state_flags(__entry->state_flags), 1145 show_nfs4_lock_flags(__entry->lock_flags) 1146 ) 1147 ) 1148 1149 DECLARE_EVENT_CLASS(nfs4_set_delegation_event, 1150 TP_PROTO( 1151 const struct inode *inode, 1152 fmode_t fmode 1153 ), 1154 1155 TP_ARGS(inode, fmode), 1156 1157 TP_STRUCT__entry( 1158 __field(dev_t, dev) 1159 __field(u32, fhandle) 1160 __field(u64, fileid) 1161 __field(unsigned int, fmode) 1162 ), 1163 1164 TP_fast_assign( 1165 __entry->dev = inode->i_sb->s_dev; 1166 __entry->fileid = NFS_FILEID(inode); 1167 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1168 __entry->fmode = (__force unsigned int)fmode; 1169 ), 1170 1171 TP_printk( 1172 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x", 1173 show_fmode_flags(__entry->fmode), 1174 MAJOR(__entry->dev), MINOR(__entry->dev), 1175 (unsigned long long)__entry->fileid, 1176 __entry->fhandle 1177 ) 1178 ); 1179 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \ 1180 DEFINE_EVENT(nfs4_set_delegation_event, name, \ 1181 TP_PROTO( \ 1182 const struct inode *inode, \ 1183 fmode_t fmode \ 1184 ), \ 1185 TP_ARGS(inode, fmode)) 1186 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation); 1187 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation); 1188 1189 TRACE_EVENT(nfs4_delegreturn_exit, 1190 TP_PROTO( 1191 const struct nfs4_delegreturnargs *args, 1192 const struct nfs4_delegreturnres *res, 1193 int error 1194 ), 1195 1196 TP_ARGS(args, res, error), 1197 1198 TP_STRUCT__entry( 1199 __field(dev_t, dev) 1200 __field(u32, fhandle) 1201 __field(unsigned long, error) 1202 __field(int, stateid_seq) 1203 __field(u32, stateid_hash) 1204 ), 1205 1206 TP_fast_assign( 1207 __entry->dev = res->server->s_dev; 1208 __entry->fhandle = nfs_fhandle_hash(args->fhandle); 1209 __entry->error = error < 0 ? -error : 0; 1210 __entry->stateid_seq = 1211 be32_to_cpu(args->stateid->seqid); 1212 __entry->stateid_hash = 1213 nfs_stateid_hash(args->stateid); 1214 ), 1215 1216 TP_printk( 1217 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x " 1218 "stateid=%d:0x%08x", 1219 -__entry->error, 1220 show_nfsv4_errors(__entry->error), 1221 MAJOR(__entry->dev), MINOR(__entry->dev), 1222 __entry->fhandle, 1223 __entry->stateid_seq, __entry->stateid_hash 1224 ) 1225 ); 1226 1227 #ifdef CONFIG_NFS_V4_1 1228 DECLARE_EVENT_CLASS(nfs4_test_stateid_event, 1229 TP_PROTO( 1230 const struct nfs4_state *state, 1231 const struct nfs4_lock_state *lsp, 1232 int error 1233 ), 1234 1235 TP_ARGS(state, lsp, error), 1236 1237 TP_STRUCT__entry( 1238 __field(unsigned long, error) 1239 __field(dev_t, dev) 1240 __field(u32, fhandle) 1241 __field(u64, fileid) 1242 __field(int, stateid_seq) 1243 __field(u32, stateid_hash) 1244 ), 1245 1246 TP_fast_assign( 1247 const struct inode *inode = state->inode; 1248 1249 __entry->error = error < 0 ? -error : 0; 1250 __entry->dev = inode->i_sb->s_dev; 1251 __entry->fileid = NFS_FILEID(inode); 1252 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1253 __entry->stateid_seq = 1254 be32_to_cpu(state->stateid.seqid); 1255 __entry->stateid_hash = 1256 nfs_stateid_hash(&state->stateid); 1257 ), 1258 1259 TP_printk( 1260 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1261 "stateid=%d:0x%08x", 1262 -__entry->error, 1263 show_nfsv4_errors(__entry->error), 1264 MAJOR(__entry->dev), MINOR(__entry->dev), 1265 (unsigned long long)__entry->fileid, 1266 __entry->fhandle, 1267 __entry->stateid_seq, __entry->stateid_hash 1268 ) 1269 ); 1270 1271 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \ 1272 DEFINE_EVENT(nfs4_test_stateid_event, name, \ 1273 TP_PROTO( \ 1274 const struct nfs4_state *state, \ 1275 const struct nfs4_lock_state *lsp, \ 1276 int error \ 1277 ), \ 1278 TP_ARGS(state, lsp, error)) 1279 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid); 1280 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid); 1281 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid); 1282 #endif /* CONFIG_NFS_V4_1 */ 1283 1284 DECLARE_EVENT_CLASS(nfs4_lookup_event, 1285 TP_PROTO( 1286 const struct inode *dir, 1287 const struct qstr *name, 1288 int error 1289 ), 1290 1291 TP_ARGS(dir, name, error), 1292 1293 TP_STRUCT__entry( 1294 __field(dev_t, dev) 1295 __field(unsigned long, error) 1296 __field(u64, dir) 1297 __string(name, name->name) 1298 ), 1299 1300 TP_fast_assign( 1301 __entry->dev = dir->i_sb->s_dev; 1302 __entry->dir = NFS_FILEID(dir); 1303 __entry->error = -error; 1304 __assign_str(name, name->name); 1305 ), 1306 1307 TP_printk( 1308 "error=%ld (%s) name=%02x:%02x:%llu/%s", 1309 -__entry->error, 1310 show_nfsv4_errors(__entry->error), 1311 MAJOR(__entry->dev), MINOR(__entry->dev), 1312 (unsigned long long)__entry->dir, 1313 __get_str(name) 1314 ) 1315 ); 1316 1317 #define DEFINE_NFS4_LOOKUP_EVENT(name) \ 1318 DEFINE_EVENT(nfs4_lookup_event, name, \ 1319 TP_PROTO( \ 1320 const struct inode *dir, \ 1321 const struct qstr *name, \ 1322 int error \ 1323 ), \ 1324 TP_ARGS(dir, name, error)) 1325 1326 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup); 1327 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink); 1328 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir); 1329 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod); 1330 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove); 1331 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations); 1332 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo); 1333 1334 TRACE_EVENT(nfs4_lookupp, 1335 TP_PROTO( 1336 const struct inode *inode, 1337 int error 1338 ), 1339 1340 TP_ARGS(inode, error), 1341 1342 TP_STRUCT__entry( 1343 __field(dev_t, dev) 1344 __field(u64, ino) 1345 __field(unsigned long, error) 1346 ), 1347 1348 TP_fast_assign( 1349 __entry->dev = inode->i_sb->s_dev; 1350 __entry->ino = NFS_FILEID(inode); 1351 __entry->error = error < 0 ? -error : 0; 1352 ), 1353 1354 TP_printk( 1355 "error=%ld (%s) inode=%02x:%02x:%llu", 1356 -__entry->error, 1357 show_nfsv4_errors(__entry->error), 1358 MAJOR(__entry->dev), MINOR(__entry->dev), 1359 (unsigned long long)__entry->ino 1360 ) 1361 ); 1362 1363 TRACE_EVENT(nfs4_rename, 1364 TP_PROTO( 1365 const struct inode *olddir, 1366 const struct qstr *oldname, 1367 const struct inode *newdir, 1368 const struct qstr *newname, 1369 int error 1370 ), 1371 1372 TP_ARGS(olddir, oldname, newdir, newname, error), 1373 1374 TP_STRUCT__entry( 1375 __field(dev_t, dev) 1376 __field(unsigned long, error) 1377 __field(u64, olddir) 1378 __string(oldname, oldname->name) 1379 __field(u64, newdir) 1380 __string(newname, newname->name) 1381 ), 1382 1383 TP_fast_assign( 1384 __entry->dev = olddir->i_sb->s_dev; 1385 __entry->olddir = NFS_FILEID(olddir); 1386 __entry->newdir = NFS_FILEID(newdir); 1387 __entry->error = error < 0 ? -error : 0; 1388 __assign_str(oldname, oldname->name); 1389 __assign_str(newname, newname->name); 1390 ), 1391 1392 TP_printk( 1393 "error=%ld (%s) oldname=%02x:%02x:%llu/%s " 1394 "newname=%02x:%02x:%llu/%s", 1395 -__entry->error, 1396 show_nfsv4_errors(__entry->error), 1397 MAJOR(__entry->dev), MINOR(__entry->dev), 1398 (unsigned long long)__entry->olddir, 1399 __get_str(oldname), 1400 MAJOR(__entry->dev), MINOR(__entry->dev), 1401 (unsigned long long)__entry->newdir, 1402 __get_str(newname) 1403 ) 1404 ); 1405 1406 DECLARE_EVENT_CLASS(nfs4_inode_event, 1407 TP_PROTO( 1408 const struct inode *inode, 1409 int error 1410 ), 1411 1412 TP_ARGS(inode, error), 1413 1414 TP_STRUCT__entry( 1415 __field(dev_t, dev) 1416 __field(u32, fhandle) 1417 __field(u64, fileid) 1418 __field(unsigned long, error) 1419 ), 1420 1421 TP_fast_assign( 1422 __entry->dev = inode->i_sb->s_dev; 1423 __entry->fileid = NFS_FILEID(inode); 1424 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1425 __entry->error = error < 0 ? -error : 0; 1426 ), 1427 1428 TP_printk( 1429 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x", 1430 -__entry->error, 1431 show_nfsv4_errors(__entry->error), 1432 MAJOR(__entry->dev), MINOR(__entry->dev), 1433 (unsigned long long)__entry->fileid, 1434 __entry->fhandle 1435 ) 1436 ); 1437 1438 #define DEFINE_NFS4_INODE_EVENT(name) \ 1439 DEFINE_EVENT(nfs4_inode_event, name, \ 1440 TP_PROTO( \ 1441 const struct inode *inode, \ 1442 int error \ 1443 ), \ 1444 TP_ARGS(inode, error)) 1445 1446 DEFINE_NFS4_INODE_EVENT(nfs4_access); 1447 DEFINE_NFS4_INODE_EVENT(nfs4_readlink); 1448 DEFINE_NFS4_INODE_EVENT(nfs4_readdir); 1449 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl); 1450 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl); 1451 #ifdef CONFIG_NFS_V4_SECURITY_LABEL 1452 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label); 1453 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label); 1454 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ 1455 1456 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, 1457 TP_PROTO( 1458 const struct inode *inode, 1459 const nfs4_stateid *stateid, 1460 int error 1461 ), 1462 1463 TP_ARGS(inode, stateid, error), 1464 1465 TP_STRUCT__entry( 1466 __field(dev_t, dev) 1467 __field(u32, fhandle) 1468 __field(u64, fileid) 1469 __field(unsigned long, error) 1470 __field(int, stateid_seq) 1471 __field(u32, stateid_hash) 1472 ), 1473 1474 TP_fast_assign( 1475 __entry->dev = inode->i_sb->s_dev; 1476 __entry->fileid = NFS_FILEID(inode); 1477 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1478 __entry->error = error < 0 ? -error : 0; 1479 __entry->stateid_seq = 1480 be32_to_cpu(stateid->seqid); 1481 __entry->stateid_hash = 1482 nfs_stateid_hash(stateid); 1483 ), 1484 1485 TP_printk( 1486 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1487 "stateid=%d:0x%08x", 1488 -__entry->error, 1489 show_nfsv4_errors(__entry->error), 1490 MAJOR(__entry->dev), MINOR(__entry->dev), 1491 (unsigned long long)__entry->fileid, 1492 __entry->fhandle, 1493 __entry->stateid_seq, __entry->stateid_hash 1494 ) 1495 ); 1496 1497 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \ 1498 DEFINE_EVENT(nfs4_inode_stateid_event, name, \ 1499 TP_PROTO( \ 1500 const struct inode *inode, \ 1501 const nfs4_stateid *stateid, \ 1502 int error \ 1503 ), \ 1504 TP_ARGS(inode, stateid, error)) 1505 1506 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr); 1507 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn); 1508 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update); 1509 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait); 1510 1511 DECLARE_EVENT_CLASS(nfs4_getattr_event, 1512 TP_PROTO( 1513 const struct nfs_server *server, 1514 const struct nfs_fh *fhandle, 1515 const struct nfs_fattr *fattr, 1516 int error 1517 ), 1518 1519 TP_ARGS(server, fhandle, fattr, error), 1520 1521 TP_STRUCT__entry( 1522 __field(dev_t, dev) 1523 __field(u32, fhandle) 1524 __field(u64, fileid) 1525 __field(unsigned int, valid) 1526 __field(unsigned long, error) 1527 ), 1528 1529 TP_fast_assign( 1530 __entry->dev = server->s_dev; 1531 __entry->valid = fattr->valid; 1532 __entry->fhandle = nfs_fhandle_hash(fhandle); 1533 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0; 1534 __entry->error = error < 0 ? -error : 0; 1535 ), 1536 1537 TP_printk( 1538 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1539 "valid=%s", 1540 -__entry->error, 1541 show_nfsv4_errors(__entry->error), 1542 MAJOR(__entry->dev), MINOR(__entry->dev), 1543 (unsigned long long)__entry->fileid, 1544 __entry->fhandle, 1545 show_nfs_fattr_flags(__entry->valid) 1546 ) 1547 ); 1548 1549 #define DEFINE_NFS4_GETATTR_EVENT(name) \ 1550 DEFINE_EVENT(nfs4_getattr_event, name, \ 1551 TP_PROTO( \ 1552 const struct nfs_server *server, \ 1553 const struct nfs_fh *fhandle, \ 1554 const struct nfs_fattr *fattr, \ 1555 int error \ 1556 ), \ 1557 TP_ARGS(server, fhandle, fattr, error)) 1558 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr); 1559 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root); 1560 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo); 1561 1562 DECLARE_EVENT_CLASS(nfs4_inode_callback_event, 1563 TP_PROTO( 1564 const struct nfs_client *clp, 1565 const struct nfs_fh *fhandle, 1566 const struct inode *inode, 1567 int error 1568 ), 1569 1570 TP_ARGS(clp, fhandle, inode, error), 1571 1572 TP_STRUCT__entry( 1573 __field(unsigned long, error) 1574 __field(dev_t, dev) 1575 __field(u32, fhandle) 1576 __field(u64, fileid) 1577 __string(dstaddr, clp ? clp->cl_hostname : "unknown") 1578 ), 1579 1580 TP_fast_assign( 1581 __entry->error = error < 0 ? -error : 0; 1582 __entry->fhandle = nfs_fhandle_hash(fhandle); 1583 if (!IS_ERR_OR_NULL(inode)) { 1584 __entry->fileid = NFS_FILEID(inode); 1585 __entry->dev = inode->i_sb->s_dev; 1586 } else { 1587 __entry->fileid = 0; 1588 __entry->dev = 0; 1589 } 1590 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown") 1591 ), 1592 1593 TP_printk( 1594 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1595 "dstaddr=%s", 1596 -__entry->error, 1597 show_nfsv4_errors(__entry->error), 1598 MAJOR(__entry->dev), MINOR(__entry->dev), 1599 (unsigned long long)__entry->fileid, 1600 __entry->fhandle, 1601 __get_str(dstaddr) 1602 ) 1603 ); 1604 1605 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \ 1606 DEFINE_EVENT(nfs4_inode_callback_event, name, \ 1607 TP_PROTO( \ 1608 const struct nfs_client *clp, \ 1609 const struct nfs_fh *fhandle, \ 1610 const struct inode *inode, \ 1611 int error \ 1612 ), \ 1613 TP_ARGS(clp, fhandle, inode, error)) 1614 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr); 1615 1616 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event, 1617 TP_PROTO( 1618 const struct nfs_client *clp, 1619 const struct nfs_fh *fhandle, 1620 const struct inode *inode, 1621 const nfs4_stateid *stateid, 1622 int error 1623 ), 1624 1625 TP_ARGS(clp, fhandle, inode, stateid, error), 1626 1627 TP_STRUCT__entry( 1628 __field(unsigned long, error) 1629 __field(dev_t, dev) 1630 __field(u32, fhandle) 1631 __field(u64, fileid) 1632 __string(dstaddr, clp ? clp->cl_hostname : "unknown") 1633 __field(int, stateid_seq) 1634 __field(u32, stateid_hash) 1635 ), 1636 1637 TP_fast_assign( 1638 __entry->error = error < 0 ? -error : 0; 1639 __entry->fhandle = nfs_fhandle_hash(fhandle); 1640 if (!IS_ERR_OR_NULL(inode)) { 1641 __entry->fileid = NFS_FILEID(inode); 1642 __entry->dev = inode->i_sb->s_dev; 1643 } else { 1644 __entry->fileid = 0; 1645 __entry->dev = 0; 1646 } 1647 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown") 1648 __entry->stateid_seq = 1649 be32_to_cpu(stateid->seqid); 1650 __entry->stateid_hash = 1651 nfs_stateid_hash(stateid); 1652 ), 1653 1654 TP_printk( 1655 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1656 "stateid=%d:0x%08x dstaddr=%s", 1657 -__entry->error, 1658 show_nfsv4_errors(__entry->error), 1659 MAJOR(__entry->dev), MINOR(__entry->dev), 1660 (unsigned long long)__entry->fileid, 1661 __entry->fhandle, 1662 __entry->stateid_seq, __entry->stateid_hash, 1663 __get_str(dstaddr) 1664 ) 1665 ); 1666 1667 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \ 1668 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \ 1669 TP_PROTO( \ 1670 const struct nfs_client *clp, \ 1671 const struct nfs_fh *fhandle, \ 1672 const struct inode *inode, \ 1673 const nfs4_stateid *stateid, \ 1674 int error \ 1675 ), \ 1676 TP_ARGS(clp, fhandle, inode, stateid, error)) 1677 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall); 1678 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file); 1679 1680 DECLARE_EVENT_CLASS(nfs4_idmap_event, 1681 TP_PROTO( 1682 const char *name, 1683 int len, 1684 u32 id, 1685 int error 1686 ), 1687 1688 TP_ARGS(name, len, id, error), 1689 1690 TP_STRUCT__entry( 1691 __field(unsigned long, error) 1692 __field(u32, id) 1693 __dynamic_array(char, name, len > 0 ? len + 1 : 1) 1694 ), 1695 1696 TP_fast_assign( 1697 if (len < 0) 1698 len = 0; 1699 __entry->error = error < 0 ? error : 0; 1700 __entry->id = id; 1701 memcpy(__get_str(name), name, len); 1702 __get_str(name)[len] = 0; 1703 ), 1704 1705 TP_printk( 1706 "error=%ld (%s) id=%u name=%s", 1707 -__entry->error, show_nfsv4_errors(__entry->error), 1708 __entry->id, 1709 __get_str(name) 1710 ) 1711 ); 1712 #define DEFINE_NFS4_IDMAP_EVENT(name) \ 1713 DEFINE_EVENT(nfs4_idmap_event, name, \ 1714 TP_PROTO( \ 1715 const char *name, \ 1716 int len, \ 1717 u32 id, \ 1718 int error \ 1719 ), \ 1720 TP_ARGS(name, len, id, error)) 1721 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid); 1722 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid); 1723 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name); 1724 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group); 1725 1726 DECLARE_EVENT_CLASS(nfs4_read_event, 1727 TP_PROTO( 1728 const struct nfs_pgio_header *hdr, 1729 int error 1730 ), 1731 1732 TP_ARGS(hdr, error), 1733 1734 TP_STRUCT__entry( 1735 __field(dev_t, dev) 1736 __field(u32, fhandle) 1737 __field(u64, fileid) 1738 __field(loff_t, offset) 1739 __field(u32, arg_count) 1740 __field(u32, res_count) 1741 __field(unsigned long, error) 1742 __field(int, stateid_seq) 1743 __field(u32, stateid_hash) 1744 ), 1745 1746 TP_fast_assign( 1747 const struct inode *inode = hdr->inode; 1748 const struct nfs_inode *nfsi = NFS_I(inode); 1749 const struct nfs_fh *fh = hdr->args.fh ? 1750 hdr->args.fh : &nfsi->fh; 1751 const struct nfs4_state *state = 1752 hdr->args.context->state; 1753 1754 __entry->dev = inode->i_sb->s_dev; 1755 __entry->fileid = nfsi->fileid; 1756 __entry->fhandle = nfs_fhandle_hash(fh); 1757 __entry->offset = hdr->args.offset; 1758 __entry->arg_count = hdr->args.count; 1759 __entry->res_count = hdr->res.count; 1760 __entry->error = error < 0 ? -error : 0; 1761 __entry->stateid_seq = 1762 be32_to_cpu(state->stateid.seqid); 1763 __entry->stateid_hash = 1764 nfs_stateid_hash(&state->stateid); 1765 ), 1766 1767 TP_printk( 1768 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1769 "offset=%lld count=%u res=%u stateid=%d:0x%08x", 1770 -__entry->error, 1771 show_nfsv4_errors(__entry->error), 1772 MAJOR(__entry->dev), MINOR(__entry->dev), 1773 (unsigned long long)__entry->fileid, 1774 __entry->fhandle, 1775 (long long)__entry->offset, 1776 __entry->arg_count, __entry->res_count, 1777 __entry->stateid_seq, __entry->stateid_hash 1778 ) 1779 ); 1780 #define DEFINE_NFS4_READ_EVENT(name) \ 1781 DEFINE_EVENT(nfs4_read_event, name, \ 1782 TP_PROTO( \ 1783 const struct nfs_pgio_header *hdr, \ 1784 int error \ 1785 ), \ 1786 TP_ARGS(hdr, error)) 1787 DEFINE_NFS4_READ_EVENT(nfs4_read); 1788 #ifdef CONFIG_NFS_V4_1 1789 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read); 1790 #endif /* CONFIG_NFS_V4_1 */ 1791 1792 DECLARE_EVENT_CLASS(nfs4_write_event, 1793 TP_PROTO( 1794 const struct nfs_pgio_header *hdr, 1795 int error 1796 ), 1797 1798 TP_ARGS(hdr, error), 1799 1800 TP_STRUCT__entry( 1801 __field(dev_t, dev) 1802 __field(u32, fhandle) 1803 __field(u64, fileid) 1804 __field(loff_t, offset) 1805 __field(u32, arg_count) 1806 __field(u32, res_count) 1807 __field(unsigned long, error) 1808 __field(int, stateid_seq) 1809 __field(u32, stateid_hash) 1810 ), 1811 1812 TP_fast_assign( 1813 const struct inode *inode = hdr->inode; 1814 const struct nfs_inode *nfsi = NFS_I(inode); 1815 const struct nfs_fh *fh = hdr->args.fh ? 1816 hdr->args.fh : &nfsi->fh; 1817 const struct nfs4_state *state = 1818 hdr->args.context->state; 1819 1820 __entry->dev = inode->i_sb->s_dev; 1821 __entry->fileid = nfsi->fileid; 1822 __entry->fhandle = nfs_fhandle_hash(fh); 1823 __entry->offset = hdr->args.offset; 1824 __entry->arg_count = hdr->args.count; 1825 __entry->res_count = hdr->res.count; 1826 __entry->error = error < 0 ? -error : 0; 1827 __entry->stateid_seq = 1828 be32_to_cpu(state->stateid.seqid); 1829 __entry->stateid_hash = 1830 nfs_stateid_hash(&state->stateid); 1831 ), 1832 1833 TP_printk( 1834 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1835 "offset=%lld count=%u res=%u stateid=%d:0x%08x", 1836 -__entry->error, 1837 show_nfsv4_errors(__entry->error), 1838 MAJOR(__entry->dev), MINOR(__entry->dev), 1839 (unsigned long long)__entry->fileid, 1840 __entry->fhandle, 1841 (long long)__entry->offset, 1842 __entry->arg_count, __entry->res_count, 1843 __entry->stateid_seq, __entry->stateid_hash 1844 ) 1845 ); 1846 1847 #define DEFINE_NFS4_WRITE_EVENT(name) \ 1848 DEFINE_EVENT(nfs4_write_event, name, \ 1849 TP_PROTO( \ 1850 const struct nfs_pgio_header *hdr, \ 1851 int error \ 1852 ), \ 1853 TP_ARGS(hdr, error)) 1854 DEFINE_NFS4_WRITE_EVENT(nfs4_write); 1855 #ifdef CONFIG_NFS_V4_1 1856 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write); 1857 #endif /* CONFIG_NFS_V4_1 */ 1858 1859 DECLARE_EVENT_CLASS(nfs4_commit_event, 1860 TP_PROTO( 1861 const struct nfs_commit_data *data, 1862 int error 1863 ), 1864 1865 TP_ARGS(data, error), 1866 1867 TP_STRUCT__entry( 1868 __field(dev_t, dev) 1869 __field(u32, fhandle) 1870 __field(u64, fileid) 1871 __field(unsigned long, error) 1872 __field(loff_t, offset) 1873 __field(u32, count) 1874 ), 1875 1876 TP_fast_assign( 1877 const struct inode *inode = data->inode; 1878 const struct nfs_inode *nfsi = NFS_I(inode); 1879 const struct nfs_fh *fh = data->args.fh ? 1880 data->args.fh : &nfsi->fh; 1881 1882 __entry->dev = inode->i_sb->s_dev; 1883 __entry->fileid = nfsi->fileid; 1884 __entry->fhandle = nfs_fhandle_hash(fh); 1885 __entry->offset = data->args.offset; 1886 __entry->count = data->args.count; 1887 __entry->error = error < 0 ? -error : 0; 1888 ), 1889 1890 TP_printk( 1891 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1892 "offset=%lld count=%u", 1893 -__entry->error, 1894 show_nfsv4_errors(__entry->error), 1895 MAJOR(__entry->dev), MINOR(__entry->dev), 1896 (unsigned long long)__entry->fileid, 1897 __entry->fhandle, 1898 (long long)__entry->offset, 1899 __entry->count 1900 ) 1901 ); 1902 #define DEFINE_NFS4_COMMIT_EVENT(name) \ 1903 DEFINE_EVENT(nfs4_commit_event, name, \ 1904 TP_PROTO( \ 1905 const struct nfs_commit_data *data, \ 1906 int error \ 1907 ), \ 1908 TP_ARGS(data, error)) 1909 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit); 1910 #ifdef CONFIG_NFS_V4_1 1911 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds); 1912 1913 TRACE_DEFINE_ENUM(IOMODE_READ); 1914 TRACE_DEFINE_ENUM(IOMODE_RW); 1915 TRACE_DEFINE_ENUM(IOMODE_ANY); 1916 1917 #define show_pnfs_iomode(iomode) \ 1918 __print_symbolic(iomode, \ 1919 { IOMODE_READ, "READ" }, \ 1920 { IOMODE_RW, "RW" }, \ 1921 { IOMODE_ANY, "ANY" }) 1922 1923 TRACE_EVENT(nfs4_layoutget, 1924 TP_PROTO( 1925 const struct nfs_open_context *ctx, 1926 const struct pnfs_layout_range *args, 1927 const struct pnfs_layout_range *res, 1928 const nfs4_stateid *layout_stateid, 1929 int error 1930 ), 1931 1932 TP_ARGS(ctx, args, res, layout_stateid, error), 1933 1934 TP_STRUCT__entry( 1935 __field(dev_t, dev) 1936 __field(u32, fhandle) 1937 __field(u64, fileid) 1938 __field(u32, iomode) 1939 __field(u64, offset) 1940 __field(u64, count) 1941 __field(unsigned long, error) 1942 __field(int, stateid_seq) 1943 __field(u32, stateid_hash) 1944 __field(int, layoutstateid_seq) 1945 __field(u32, layoutstateid_hash) 1946 ), 1947 1948 TP_fast_assign( 1949 const struct inode *inode = d_inode(ctx->dentry); 1950 const struct nfs4_state *state = ctx->state; 1951 __entry->dev = inode->i_sb->s_dev; 1952 __entry->fileid = NFS_FILEID(inode); 1953 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1954 __entry->iomode = args->iomode; 1955 __entry->offset = args->offset; 1956 __entry->count = args->length; 1957 __entry->error = error < 0 ? -error : 0; 1958 __entry->stateid_seq = 1959 be32_to_cpu(state->stateid.seqid); 1960 __entry->stateid_hash = 1961 nfs_stateid_hash(&state->stateid); 1962 if (!error) { 1963 __entry->layoutstateid_seq = 1964 be32_to_cpu(layout_stateid->seqid); 1965 __entry->layoutstateid_hash = 1966 nfs_stateid_hash(layout_stateid); 1967 } else { 1968 __entry->layoutstateid_seq = 0; 1969 __entry->layoutstateid_hash = 0; 1970 } 1971 ), 1972 1973 TP_printk( 1974 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1975 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x " 1976 "layoutstateid=%d:0x%08x", 1977 -__entry->error, 1978 show_nfsv4_errors(__entry->error), 1979 MAJOR(__entry->dev), MINOR(__entry->dev), 1980 (unsigned long long)__entry->fileid, 1981 __entry->fhandle, 1982 show_pnfs_iomode(__entry->iomode), 1983 (unsigned long long)__entry->offset, 1984 (unsigned long long)__entry->count, 1985 __entry->stateid_seq, __entry->stateid_hash, 1986 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1987 ) 1988 ); 1989 1990 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit); 1991 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn); 1992 DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close); 1993 1994 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN); 1995 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS); 1996 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN); 1997 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH); 1998 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM); 1999 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL); 2000 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL); 2001 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED); 2002 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN); 2003 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED); 2004 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN); 2005 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY); 2006 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET); 2007 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT); 2008 2009 #define show_pnfs_update_layout_reason(reason) \ 2010 __print_symbolic(reason, \ 2011 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \ 2012 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \ 2013 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \ 2014 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \ 2015 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \ 2016 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \ 2017 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \ 2018 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \ 2019 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \ 2020 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \ 2021 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \ 2022 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \ 2023 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \ 2024 { PNFS_UPDATE_LAYOUT_EXIT, "exit" }) 2025 2026 TRACE_EVENT(pnfs_update_layout, 2027 TP_PROTO(struct inode *inode, 2028 loff_t pos, 2029 u64 count, 2030 enum pnfs_iomode iomode, 2031 struct pnfs_layout_hdr *lo, 2032 struct pnfs_layout_segment *lseg, 2033 enum pnfs_update_layout_reason reason 2034 ), 2035 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason), 2036 TP_STRUCT__entry( 2037 __field(dev_t, dev) 2038 __field(u64, fileid) 2039 __field(u32, fhandle) 2040 __field(loff_t, pos) 2041 __field(u64, count) 2042 __field(enum pnfs_iomode, iomode) 2043 __field(int, layoutstateid_seq) 2044 __field(u32, layoutstateid_hash) 2045 __field(long, lseg) 2046 __field(enum pnfs_update_layout_reason, reason) 2047 ), 2048 TP_fast_assign( 2049 __entry->dev = inode->i_sb->s_dev; 2050 __entry->fileid = NFS_FILEID(inode); 2051 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2052 __entry->pos = pos; 2053 __entry->count = count; 2054 __entry->iomode = iomode; 2055 __entry->reason = reason; 2056 if (lo != NULL) { 2057 __entry->layoutstateid_seq = 2058 be32_to_cpu(lo->plh_stateid.seqid); 2059 __entry->layoutstateid_hash = 2060 nfs_stateid_hash(&lo->plh_stateid); 2061 } else { 2062 __entry->layoutstateid_seq = 0; 2063 __entry->layoutstateid_hash = 0; 2064 } 2065 __entry->lseg = (long)lseg; 2066 ), 2067 TP_printk( 2068 "fileid=%02x:%02x:%llu fhandle=0x%08x " 2069 "iomode=%s pos=%llu count=%llu " 2070 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)", 2071 MAJOR(__entry->dev), MINOR(__entry->dev), 2072 (unsigned long long)__entry->fileid, 2073 __entry->fhandle, 2074 show_pnfs_iomode(__entry->iomode), 2075 (unsigned long long)__entry->pos, 2076 (unsigned long long)__entry->count, 2077 __entry->layoutstateid_seq, __entry->layoutstateid_hash, 2078 __entry->lseg, 2079 show_pnfs_update_layout_reason(__entry->reason) 2080 ) 2081 ); 2082 2083 DECLARE_EVENT_CLASS(pnfs_layout_event, 2084 TP_PROTO(struct inode *inode, 2085 loff_t pos, 2086 u64 count, 2087 enum pnfs_iomode iomode, 2088 struct pnfs_layout_hdr *lo, 2089 struct pnfs_layout_segment *lseg 2090 ), 2091 TP_ARGS(inode, pos, count, iomode, lo, lseg), 2092 TP_STRUCT__entry( 2093 __field(dev_t, dev) 2094 __field(u64, fileid) 2095 __field(u32, fhandle) 2096 __field(loff_t, pos) 2097 __field(u64, count) 2098 __field(enum pnfs_iomode, iomode) 2099 __field(int, layoutstateid_seq) 2100 __field(u32, layoutstateid_hash) 2101 __field(long, lseg) 2102 ), 2103 TP_fast_assign( 2104 __entry->dev = inode->i_sb->s_dev; 2105 __entry->fileid = NFS_FILEID(inode); 2106 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2107 __entry->pos = pos; 2108 __entry->count = count; 2109 __entry->iomode = iomode; 2110 if (lo != NULL) { 2111 __entry->layoutstateid_seq = 2112 be32_to_cpu(lo->plh_stateid.seqid); 2113 __entry->layoutstateid_hash = 2114 nfs_stateid_hash(&lo->plh_stateid); 2115 } else { 2116 __entry->layoutstateid_seq = 0; 2117 __entry->layoutstateid_hash = 0; 2118 } 2119 __entry->lseg = (long)lseg; 2120 ), 2121 TP_printk( 2122 "fileid=%02x:%02x:%llu fhandle=0x%08x " 2123 "iomode=%s pos=%llu count=%llu " 2124 "layoutstateid=%d:0x%08x lseg=0x%lx", 2125 MAJOR(__entry->dev), MINOR(__entry->dev), 2126 (unsigned long long)__entry->fileid, 2127 __entry->fhandle, 2128 show_pnfs_iomode(__entry->iomode), 2129 (unsigned long long)__entry->pos, 2130 (unsigned long long)__entry->count, 2131 __entry->layoutstateid_seq, __entry->layoutstateid_hash, 2132 __entry->lseg 2133 ) 2134 ); 2135 2136 #define DEFINE_PNFS_LAYOUT_EVENT(name) \ 2137 DEFINE_EVENT(pnfs_layout_event, name, \ 2138 TP_PROTO(struct inode *inode, \ 2139 loff_t pos, \ 2140 u64 count, \ 2141 enum pnfs_iomode iomode, \ 2142 struct pnfs_layout_hdr *lo, \ 2143 struct pnfs_layout_segment *lseg \ 2144 ), \ 2145 TP_ARGS(inode, pos, count, iomode, lo, lseg)) 2146 2147 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read); 2148 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write); 2149 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count); 2150 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done); 2151 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done); 2152 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist); 2153 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist); 2154 2155 DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event, 2156 TP_PROTO( 2157 const struct nfs_pgio_header *hdr 2158 ), 2159 2160 TP_ARGS(hdr), 2161 2162 TP_STRUCT__entry( 2163 __field(unsigned long, error) 2164 __field(dev_t, dev) 2165 __field(u32, fhandle) 2166 __field(u64, fileid) 2167 __field(loff_t, offset) 2168 __field(u32, count) 2169 __field(int, stateid_seq) 2170 __field(u32, stateid_hash) 2171 __string(dstaddr, hdr->ds_clp ? 2172 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient, 2173 RPC_DISPLAY_ADDR) : "unknown") 2174 ), 2175 2176 TP_fast_assign( 2177 const struct inode *inode = hdr->inode; 2178 2179 __entry->error = hdr->res.op_status; 2180 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh); 2181 __entry->fileid = NFS_FILEID(inode); 2182 __entry->dev = inode->i_sb->s_dev; 2183 __entry->offset = hdr->args.offset; 2184 __entry->count = hdr->args.count; 2185 __entry->stateid_seq = 2186 be32_to_cpu(hdr->args.stateid.seqid); 2187 __entry->stateid_hash = 2188 nfs_stateid_hash(&hdr->args.stateid); 2189 __assign_str(dstaddr, hdr->ds_clp ? 2190 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient, 2191 RPC_DISPLAY_ADDR) : "unknown"); 2192 ), 2193 2194 TP_printk( 2195 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2196 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s", 2197 -__entry->error, 2198 show_nfsv4_errors(__entry->error), 2199 MAJOR(__entry->dev), MINOR(__entry->dev), 2200 (unsigned long long)__entry->fileid, 2201 __entry->fhandle, 2202 __entry->offset, __entry->count, 2203 __entry->stateid_seq, __entry->stateid_hash, 2204 __get_str(dstaddr) 2205 ) 2206 ); 2207 2208 #define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \ 2209 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \ 2210 TP_PROTO( \ 2211 const struct nfs_pgio_header *hdr \ 2212 ), \ 2213 TP_ARGS(hdr)) 2214 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error); 2215 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error); 2216 2217 TRACE_EVENT(ff_layout_commit_error, 2218 TP_PROTO( 2219 const struct nfs_commit_data *data 2220 ), 2221 2222 TP_ARGS(data), 2223 2224 TP_STRUCT__entry( 2225 __field(unsigned long, error) 2226 __field(dev_t, dev) 2227 __field(u32, fhandle) 2228 __field(u64, fileid) 2229 __field(loff_t, offset) 2230 __field(u32, count) 2231 __string(dstaddr, data->ds_clp ? 2232 rpc_peeraddr2str(data->ds_clp->cl_rpcclient, 2233 RPC_DISPLAY_ADDR) : "unknown") 2234 ), 2235 2236 TP_fast_assign( 2237 const struct inode *inode = data->inode; 2238 2239 __entry->error = data->res.op_status; 2240 __entry->fhandle = nfs_fhandle_hash(data->args.fh); 2241 __entry->fileid = NFS_FILEID(inode); 2242 __entry->dev = inode->i_sb->s_dev; 2243 __entry->offset = data->args.offset; 2244 __entry->count = data->args.count; 2245 __assign_str(dstaddr, data->ds_clp ? 2246 rpc_peeraddr2str(data->ds_clp->cl_rpcclient, 2247 RPC_DISPLAY_ADDR) : "unknown"); 2248 ), 2249 2250 TP_printk( 2251 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2252 "offset=%llu count=%u dstaddr=%s", 2253 -__entry->error, 2254 show_nfsv4_errors(__entry->error), 2255 MAJOR(__entry->dev), MINOR(__entry->dev), 2256 (unsigned long long)__entry->fileid, 2257 __entry->fhandle, 2258 __entry->offset, __entry->count, 2259 __get_str(dstaddr) 2260 ) 2261 ); 2262 2263 2264 #endif /* CONFIG_NFS_V4_1 */ 2265 2266 #endif /* _TRACE_NFS4_H */ 2267 2268 #undef TRACE_INCLUDE_PATH 2269 #define TRACE_INCLUDE_PATH . 2270 #define TRACE_INCLUDE_FILE nfs4trace 2271 /* This part must be outside protection */ 2272 #include <trace/define_trace.h> 2273