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_RECALL_RUNNING); 588 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ); 589 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW); 590 591 #define show_nfs4_clp_state(state) \ 592 __print_flags(state, "|", \ 593 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \ 594 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \ 595 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \ 596 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \ 597 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \ 598 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \ 599 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \ 600 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \ 601 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \ 602 "SERVER_SCOPE_MISMATCH" }, \ 603 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \ 604 { NFS4CLNT_BIND_CONN_TO_SESSION, \ 605 "BIND_CONN_TO_SESSION" }, \ 606 { NFS4CLNT_MOVED, "MOVED" }, \ 607 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \ 608 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \ 609 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \ 610 { NFS4CLNT_RECALL_RUNNING, "RECALL_RUNNING" }, \ 611 { NFS4CLNT_RECALL_ANY_LAYOUT_READ, "RECALL_ANY_LAYOUT_READ" }, \ 612 { NFS4CLNT_RECALL_ANY_LAYOUT_RW, "RECALL_ANY_LAYOUT_RW" }) 613 614 TRACE_EVENT(nfs4_state_mgr, 615 TP_PROTO( 616 const struct nfs_client *clp 617 ), 618 619 TP_ARGS(clp), 620 621 TP_STRUCT__entry( 622 __field(unsigned long, state) 623 __string(hostname, clp->cl_hostname) 624 ), 625 626 TP_fast_assign( 627 __entry->state = clp->cl_state; 628 __assign_str(hostname, clp->cl_hostname); 629 ), 630 631 TP_printk( 632 "hostname=%s clp state=%s", __get_str(hostname), 633 show_nfs4_clp_state(__entry->state) 634 ) 635 ) 636 637 TRACE_EVENT(nfs4_state_mgr_failed, 638 TP_PROTO( 639 const struct nfs_client *clp, 640 const char *section, 641 int status 642 ), 643 644 TP_ARGS(clp, section, status), 645 646 TP_STRUCT__entry( 647 __field(unsigned long, error) 648 __field(unsigned long, state) 649 __string(hostname, clp->cl_hostname) 650 __string(section, section) 651 ), 652 653 TP_fast_assign( 654 __entry->error = status < 0 ? -status : 0; 655 __entry->state = clp->cl_state; 656 __assign_str(hostname, clp->cl_hostname); 657 __assign_str(section, section); 658 ), 659 660 TP_printk( 661 "hostname=%s clp state=%s error=%ld (%s) section=%s", 662 __get_str(hostname), 663 show_nfs4_clp_state(__entry->state), -__entry->error, 664 show_nfsv4_errors(__entry->error), __get_str(section) 665 666 ) 667 ) 668 669 TRACE_EVENT(nfs4_xdr_bad_operation, 670 TP_PROTO( 671 const struct xdr_stream *xdr, 672 u32 op, 673 u32 expected 674 ), 675 676 TP_ARGS(xdr, op, expected), 677 678 TP_STRUCT__entry( 679 __field(unsigned int, task_id) 680 __field(unsigned int, client_id) 681 __field(u32, xid) 682 __field(u32, op) 683 __field(u32, expected) 684 ), 685 686 TP_fast_assign( 687 const struct rpc_rqst *rqstp = xdr->rqst; 688 const struct rpc_task *task = rqstp->rq_task; 689 690 __entry->task_id = task->tk_pid; 691 __entry->client_id = task->tk_client->cl_clid; 692 __entry->xid = be32_to_cpu(rqstp->rq_xid); 693 __entry->op = op; 694 __entry->expected = expected; 695 ), 696 697 TP_printk( 698 "task:%u@%d xid=0x%08x operation=%u, expected=%u", 699 __entry->task_id, __entry->client_id, __entry->xid, 700 __entry->op, __entry->expected 701 ) 702 ); 703 704 DECLARE_EVENT_CLASS(nfs4_xdr_event, 705 TP_PROTO( 706 const struct xdr_stream *xdr, 707 u32 op, 708 u32 error 709 ), 710 711 TP_ARGS(xdr, op, error), 712 713 TP_STRUCT__entry( 714 __field(unsigned int, task_id) 715 __field(unsigned int, client_id) 716 __field(u32, xid) 717 __field(u32, op) 718 __field(unsigned long, error) 719 ), 720 721 TP_fast_assign( 722 const struct rpc_rqst *rqstp = xdr->rqst; 723 const struct rpc_task *task = rqstp->rq_task; 724 725 __entry->task_id = task->tk_pid; 726 __entry->client_id = task->tk_client->cl_clid; 727 __entry->xid = be32_to_cpu(rqstp->rq_xid); 728 __entry->op = op; 729 __entry->error = error; 730 ), 731 732 TP_printk( 733 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u", 734 __entry->task_id, __entry->client_id, __entry->xid, 735 -__entry->error, show_nfsv4_errors(__entry->error), 736 __entry->op 737 ) 738 ); 739 #define DEFINE_NFS4_XDR_EVENT(name) \ 740 DEFINE_EVENT(nfs4_xdr_event, name, \ 741 TP_PROTO( \ 742 const struct xdr_stream *xdr, \ 743 u32 op, \ 744 u32 error \ 745 ), \ 746 TP_ARGS(xdr, op, error)) 747 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status); 748 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle); 749 750 DECLARE_EVENT_CLASS(nfs4_cb_error_class, 751 TP_PROTO( 752 __be32 xid, 753 u32 cb_ident 754 ), 755 756 TP_ARGS(xid, cb_ident), 757 758 TP_STRUCT__entry( 759 __field(u32, xid) 760 __field(u32, cbident) 761 ), 762 763 TP_fast_assign( 764 __entry->xid = be32_to_cpu(xid); 765 __entry->cbident = cb_ident; 766 ), 767 768 TP_printk( 769 "xid=0x%08x cb_ident=0x%08x", 770 __entry->xid, __entry->cbident 771 ) 772 ); 773 774 #define DEFINE_CB_ERROR_EVENT(name) \ 775 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \ 776 TP_PROTO( \ 777 __be32 xid, \ 778 u32 cb_ident \ 779 ), \ 780 TP_ARGS(xid, cb_ident)) 781 782 DEFINE_CB_ERROR_EVENT(no_clp); 783 DEFINE_CB_ERROR_EVENT(badprinc); 784 785 DECLARE_EVENT_CLASS(nfs4_open_event, 786 TP_PROTO( 787 const struct nfs_open_context *ctx, 788 int flags, 789 int error 790 ), 791 792 TP_ARGS(ctx, flags, error), 793 794 TP_STRUCT__entry( 795 __field(unsigned long, error) 796 __field(unsigned int, flags) 797 __field(unsigned int, fmode) 798 __field(dev_t, dev) 799 __field(u32, fhandle) 800 __field(u64, fileid) 801 __field(u64, dir) 802 __string(name, ctx->dentry->d_name.name) 803 __field(int, stateid_seq) 804 __field(u32, stateid_hash) 805 __field(int, openstateid_seq) 806 __field(u32, openstateid_hash) 807 ), 808 809 TP_fast_assign( 810 const struct nfs4_state *state = ctx->state; 811 const struct inode *inode = NULL; 812 813 __entry->error = -error; 814 __entry->flags = flags; 815 __entry->fmode = (__force unsigned int)ctx->mode; 816 __entry->dev = ctx->dentry->d_sb->s_dev; 817 if (!IS_ERR_OR_NULL(state)) { 818 inode = state->inode; 819 __entry->stateid_seq = 820 be32_to_cpu(state->stateid.seqid); 821 __entry->stateid_hash = 822 nfs_stateid_hash(&state->stateid); 823 __entry->openstateid_seq = 824 be32_to_cpu(state->open_stateid.seqid); 825 __entry->openstateid_hash = 826 nfs_stateid_hash(&state->open_stateid); 827 } else { 828 __entry->stateid_seq = 0; 829 __entry->stateid_hash = 0; 830 __entry->openstateid_seq = 0; 831 __entry->openstateid_hash = 0; 832 } 833 if (inode != NULL) { 834 __entry->fileid = NFS_FILEID(inode); 835 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 836 } else { 837 __entry->fileid = 0; 838 __entry->fhandle = 0; 839 } 840 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent)); 841 __assign_str(name, ctx->dentry->d_name.name); 842 ), 843 844 TP_printk( 845 "error=%ld (%s) flags=%d (%s) fmode=%s " 846 "fileid=%02x:%02x:%llu fhandle=0x%08x " 847 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x " 848 "openstateid=%d:0x%08x", 849 -__entry->error, 850 show_nfsv4_errors(__entry->error), 851 __entry->flags, 852 show_open_flags(__entry->flags), 853 show_fmode_flags(__entry->fmode), 854 MAJOR(__entry->dev), MINOR(__entry->dev), 855 (unsigned long long)__entry->fileid, 856 __entry->fhandle, 857 MAJOR(__entry->dev), MINOR(__entry->dev), 858 (unsigned long long)__entry->dir, 859 __get_str(name), 860 __entry->stateid_seq, __entry->stateid_hash, 861 __entry->openstateid_seq, __entry->openstateid_hash 862 ) 863 ); 864 865 #define DEFINE_NFS4_OPEN_EVENT(name) \ 866 DEFINE_EVENT(nfs4_open_event, name, \ 867 TP_PROTO( \ 868 const struct nfs_open_context *ctx, \ 869 int flags, \ 870 int error \ 871 ), \ 872 TP_ARGS(ctx, flags, error)) 873 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim); 874 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired); 875 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file); 876 877 TRACE_EVENT(nfs4_cached_open, 878 TP_PROTO( 879 const struct nfs4_state *state 880 ), 881 TP_ARGS(state), 882 TP_STRUCT__entry( 883 __field(dev_t, dev) 884 __field(u32, fhandle) 885 __field(u64, fileid) 886 __field(unsigned int, fmode) 887 __field(int, stateid_seq) 888 __field(u32, stateid_hash) 889 ), 890 891 TP_fast_assign( 892 const struct inode *inode = state->inode; 893 894 __entry->dev = inode->i_sb->s_dev; 895 __entry->fileid = NFS_FILEID(inode); 896 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 897 __entry->fmode = (__force unsigned int)state->state; 898 __entry->stateid_seq = 899 be32_to_cpu(state->stateid.seqid); 900 __entry->stateid_hash = 901 nfs_stateid_hash(&state->stateid); 902 ), 903 904 TP_printk( 905 "fmode=%s fileid=%02x:%02x:%llu " 906 "fhandle=0x%08x stateid=%d:0x%08x", 907 __entry->fmode ? show_fmode_flags(__entry->fmode) : 908 "closed", 909 MAJOR(__entry->dev), MINOR(__entry->dev), 910 (unsigned long long)__entry->fileid, 911 __entry->fhandle, 912 __entry->stateid_seq, __entry->stateid_hash 913 ) 914 ); 915 916 TRACE_EVENT(nfs4_close, 917 TP_PROTO( 918 const struct nfs4_state *state, 919 const struct nfs_closeargs *args, 920 const struct nfs_closeres *res, 921 int error 922 ), 923 924 TP_ARGS(state, args, res, error), 925 926 TP_STRUCT__entry( 927 __field(dev_t, dev) 928 __field(u32, fhandle) 929 __field(u64, fileid) 930 __field(unsigned int, fmode) 931 __field(unsigned long, error) 932 __field(int, stateid_seq) 933 __field(u32, stateid_hash) 934 ), 935 936 TP_fast_assign( 937 const struct inode *inode = state->inode; 938 939 __entry->dev = inode->i_sb->s_dev; 940 __entry->fileid = NFS_FILEID(inode); 941 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 942 __entry->fmode = (__force unsigned int)state->state; 943 __entry->error = error < 0 ? -error : 0; 944 __entry->stateid_seq = 945 be32_to_cpu(args->stateid.seqid); 946 __entry->stateid_hash = 947 nfs_stateid_hash(&args->stateid); 948 ), 949 950 TP_printk( 951 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu " 952 "fhandle=0x%08x openstateid=%d:0x%08x", 953 -__entry->error, 954 show_nfsv4_errors(__entry->error), 955 __entry->fmode ? show_fmode_flags(__entry->fmode) : 956 "closed", 957 MAJOR(__entry->dev), MINOR(__entry->dev), 958 (unsigned long long)__entry->fileid, 959 __entry->fhandle, 960 __entry->stateid_seq, __entry->stateid_hash 961 ) 962 ); 963 964 TRACE_DEFINE_ENUM(F_GETLK); 965 TRACE_DEFINE_ENUM(F_SETLK); 966 TRACE_DEFINE_ENUM(F_SETLKW); 967 TRACE_DEFINE_ENUM(F_RDLCK); 968 TRACE_DEFINE_ENUM(F_WRLCK); 969 TRACE_DEFINE_ENUM(F_UNLCK); 970 971 #define show_lock_cmd(type) \ 972 __print_symbolic((int)type, \ 973 { F_GETLK, "GETLK" }, \ 974 { F_SETLK, "SETLK" }, \ 975 { F_SETLKW, "SETLKW" }) 976 #define show_lock_type(type) \ 977 __print_symbolic((int)type, \ 978 { F_RDLCK, "RDLCK" }, \ 979 { F_WRLCK, "WRLCK" }, \ 980 { F_UNLCK, "UNLCK" }) 981 982 DECLARE_EVENT_CLASS(nfs4_lock_event, 983 TP_PROTO( 984 const struct file_lock *request, 985 const struct nfs4_state *state, 986 int cmd, 987 int error 988 ), 989 990 TP_ARGS(request, state, cmd, error), 991 992 TP_STRUCT__entry( 993 __field(unsigned long, error) 994 __field(int, cmd) 995 __field(char, type) 996 __field(loff_t, start) 997 __field(loff_t, end) 998 __field(dev_t, dev) 999 __field(u32, fhandle) 1000 __field(u64, fileid) 1001 __field(int, stateid_seq) 1002 __field(u32, stateid_hash) 1003 ), 1004 1005 TP_fast_assign( 1006 const struct inode *inode = state->inode; 1007 1008 __entry->error = error < 0 ? -error : 0; 1009 __entry->cmd = cmd; 1010 __entry->type = request->fl_type; 1011 __entry->start = request->fl_start; 1012 __entry->end = request->fl_end; 1013 __entry->dev = inode->i_sb->s_dev; 1014 __entry->fileid = NFS_FILEID(inode); 1015 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1016 __entry->stateid_seq = 1017 be32_to_cpu(state->stateid.seqid); 1018 __entry->stateid_hash = 1019 nfs_stateid_hash(&state->stateid); 1020 ), 1021 1022 TP_printk( 1023 "error=%ld (%s) cmd=%s:%s range=%lld:%lld " 1024 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1025 "stateid=%d:0x%08x", 1026 -__entry->error, 1027 show_nfsv4_errors(__entry->error), 1028 show_lock_cmd(__entry->cmd), 1029 show_lock_type(__entry->type), 1030 (long long)__entry->start, 1031 (long long)__entry->end, 1032 MAJOR(__entry->dev), MINOR(__entry->dev), 1033 (unsigned long long)__entry->fileid, 1034 __entry->fhandle, 1035 __entry->stateid_seq, __entry->stateid_hash 1036 ) 1037 ); 1038 1039 #define DEFINE_NFS4_LOCK_EVENT(name) \ 1040 DEFINE_EVENT(nfs4_lock_event, name, \ 1041 TP_PROTO( \ 1042 const struct file_lock *request, \ 1043 const struct nfs4_state *state, \ 1044 int cmd, \ 1045 int error \ 1046 ), \ 1047 TP_ARGS(request, state, cmd, error)) 1048 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock); 1049 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock); 1050 1051 TRACE_EVENT(nfs4_set_lock, 1052 TP_PROTO( 1053 const struct file_lock *request, 1054 const struct nfs4_state *state, 1055 const nfs4_stateid *lockstateid, 1056 int cmd, 1057 int error 1058 ), 1059 1060 TP_ARGS(request, state, lockstateid, cmd, error), 1061 1062 TP_STRUCT__entry( 1063 __field(unsigned long, error) 1064 __field(int, cmd) 1065 __field(char, type) 1066 __field(loff_t, start) 1067 __field(loff_t, end) 1068 __field(dev_t, dev) 1069 __field(u32, fhandle) 1070 __field(u64, fileid) 1071 __field(int, stateid_seq) 1072 __field(u32, stateid_hash) 1073 __field(int, lockstateid_seq) 1074 __field(u32, lockstateid_hash) 1075 ), 1076 1077 TP_fast_assign( 1078 const struct inode *inode = state->inode; 1079 1080 __entry->error = error < 0 ? -error : 0; 1081 __entry->cmd = cmd; 1082 __entry->type = request->fl_type; 1083 __entry->start = request->fl_start; 1084 __entry->end = request->fl_end; 1085 __entry->dev = inode->i_sb->s_dev; 1086 __entry->fileid = NFS_FILEID(inode); 1087 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1088 __entry->stateid_seq = 1089 be32_to_cpu(state->stateid.seqid); 1090 __entry->stateid_hash = 1091 nfs_stateid_hash(&state->stateid); 1092 __entry->lockstateid_seq = 1093 be32_to_cpu(lockstateid->seqid); 1094 __entry->lockstateid_hash = 1095 nfs_stateid_hash(lockstateid); 1096 ), 1097 1098 TP_printk( 1099 "error=%ld (%s) cmd=%s:%s range=%lld:%lld " 1100 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1101 "stateid=%d:0x%08x lockstateid=%d:0x%08x", 1102 -__entry->error, 1103 show_nfsv4_errors(__entry->error), 1104 show_lock_cmd(__entry->cmd), 1105 show_lock_type(__entry->type), 1106 (long long)__entry->start, 1107 (long long)__entry->end, 1108 MAJOR(__entry->dev), MINOR(__entry->dev), 1109 (unsigned long long)__entry->fileid, 1110 __entry->fhandle, 1111 __entry->stateid_seq, __entry->stateid_hash, 1112 __entry->lockstateid_seq, __entry->lockstateid_hash 1113 ) 1114 ); 1115 1116 TRACE_DEFINE_ENUM(LK_STATE_IN_USE); 1117 TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE); 1118 TRACE_DEFINE_ENUM(NFS_OPEN_STATE); 1119 TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE); 1120 TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE); 1121 TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE); 1122 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT); 1123 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE); 1124 TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS); 1125 TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED); 1126 TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK); 1127 TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT); 1128 TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE); 1129 TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE); 1130 TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE); 1131 1132 #define show_nfs4_state_flags(flags) \ 1133 __print_flags(flags, "|", \ 1134 { LK_STATE_IN_USE, "IN_USE" }, \ 1135 { NFS_DELEGATED_STATE, "DELEGATED" }, \ 1136 { NFS_OPEN_STATE, "OPEN" }, \ 1137 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \ 1138 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \ 1139 { NFS_O_RDWR_STATE, "O_RDWR" }, \ 1140 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \ 1141 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \ 1142 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \ 1143 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \ 1144 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \ 1145 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \ 1146 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \ 1147 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \ 1148 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" }) 1149 1150 #define show_nfs4_lock_flags(flags) \ 1151 __print_flags(flags, "|", \ 1152 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \ 1153 { BIT(NFS_LOCK_LOST), "LOST" }) 1154 1155 TRACE_EVENT(nfs4_state_lock_reclaim, 1156 TP_PROTO( 1157 const struct nfs4_state *state, 1158 const struct nfs4_lock_state *lock 1159 ), 1160 1161 TP_ARGS(state, lock), 1162 1163 TP_STRUCT__entry( 1164 __field(dev_t, dev) 1165 __field(u32, fhandle) 1166 __field(u64, fileid) 1167 __field(unsigned long, state_flags) 1168 __field(unsigned long, lock_flags) 1169 __field(int, stateid_seq) 1170 __field(u32, stateid_hash) 1171 ), 1172 1173 TP_fast_assign( 1174 const struct inode *inode = state->inode; 1175 1176 __entry->dev = inode->i_sb->s_dev; 1177 __entry->fileid = NFS_FILEID(inode); 1178 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1179 __entry->state_flags = state->flags; 1180 __entry->lock_flags = lock->ls_flags; 1181 __entry->stateid_seq = 1182 be32_to_cpu(state->stateid.seqid); 1183 __entry->stateid_hash = 1184 nfs_stateid_hash(&state->stateid); 1185 ), 1186 1187 TP_printk( 1188 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1189 "stateid=%d:0x%08x state_flags=%s lock_flags=%s", 1190 MAJOR(__entry->dev), MINOR(__entry->dev), 1191 (unsigned long long)__entry->fileid, __entry->fhandle, 1192 __entry->stateid_seq, __entry->stateid_hash, 1193 show_nfs4_state_flags(__entry->state_flags), 1194 show_nfs4_lock_flags(__entry->lock_flags) 1195 ) 1196 ) 1197 1198 DECLARE_EVENT_CLASS(nfs4_set_delegation_event, 1199 TP_PROTO( 1200 const struct inode *inode, 1201 fmode_t fmode 1202 ), 1203 1204 TP_ARGS(inode, fmode), 1205 1206 TP_STRUCT__entry( 1207 __field(dev_t, dev) 1208 __field(u32, fhandle) 1209 __field(u64, fileid) 1210 __field(unsigned int, fmode) 1211 ), 1212 1213 TP_fast_assign( 1214 __entry->dev = inode->i_sb->s_dev; 1215 __entry->fileid = NFS_FILEID(inode); 1216 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1217 __entry->fmode = (__force unsigned int)fmode; 1218 ), 1219 1220 TP_printk( 1221 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x", 1222 show_fmode_flags(__entry->fmode), 1223 MAJOR(__entry->dev), MINOR(__entry->dev), 1224 (unsigned long long)__entry->fileid, 1225 __entry->fhandle 1226 ) 1227 ); 1228 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \ 1229 DEFINE_EVENT(nfs4_set_delegation_event, name, \ 1230 TP_PROTO( \ 1231 const struct inode *inode, \ 1232 fmode_t fmode \ 1233 ), \ 1234 TP_ARGS(inode, fmode)) 1235 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation); 1236 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation); 1237 1238 TRACE_EVENT(nfs4_delegreturn_exit, 1239 TP_PROTO( 1240 const struct nfs4_delegreturnargs *args, 1241 const struct nfs4_delegreturnres *res, 1242 int error 1243 ), 1244 1245 TP_ARGS(args, res, error), 1246 1247 TP_STRUCT__entry( 1248 __field(dev_t, dev) 1249 __field(u32, fhandle) 1250 __field(unsigned long, error) 1251 __field(int, stateid_seq) 1252 __field(u32, stateid_hash) 1253 ), 1254 1255 TP_fast_assign( 1256 __entry->dev = res->server->s_dev; 1257 __entry->fhandle = nfs_fhandle_hash(args->fhandle); 1258 __entry->error = error < 0 ? -error : 0; 1259 __entry->stateid_seq = 1260 be32_to_cpu(args->stateid->seqid); 1261 __entry->stateid_hash = 1262 nfs_stateid_hash(args->stateid); 1263 ), 1264 1265 TP_printk( 1266 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x " 1267 "stateid=%d:0x%08x", 1268 -__entry->error, 1269 show_nfsv4_errors(__entry->error), 1270 MAJOR(__entry->dev), MINOR(__entry->dev), 1271 __entry->fhandle, 1272 __entry->stateid_seq, __entry->stateid_hash 1273 ) 1274 ); 1275 1276 #ifdef CONFIG_NFS_V4_1 1277 DECLARE_EVENT_CLASS(nfs4_test_stateid_event, 1278 TP_PROTO( 1279 const struct nfs4_state *state, 1280 const struct nfs4_lock_state *lsp, 1281 int error 1282 ), 1283 1284 TP_ARGS(state, lsp, error), 1285 1286 TP_STRUCT__entry( 1287 __field(unsigned long, error) 1288 __field(dev_t, dev) 1289 __field(u32, fhandle) 1290 __field(u64, fileid) 1291 __field(int, stateid_seq) 1292 __field(u32, stateid_hash) 1293 ), 1294 1295 TP_fast_assign( 1296 const struct inode *inode = state->inode; 1297 1298 __entry->error = error < 0 ? -error : 0; 1299 __entry->dev = inode->i_sb->s_dev; 1300 __entry->fileid = NFS_FILEID(inode); 1301 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1302 __entry->stateid_seq = 1303 be32_to_cpu(state->stateid.seqid); 1304 __entry->stateid_hash = 1305 nfs_stateid_hash(&state->stateid); 1306 ), 1307 1308 TP_printk( 1309 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1310 "stateid=%d:0x%08x", 1311 -__entry->error, 1312 show_nfsv4_errors(__entry->error), 1313 MAJOR(__entry->dev), MINOR(__entry->dev), 1314 (unsigned long long)__entry->fileid, 1315 __entry->fhandle, 1316 __entry->stateid_seq, __entry->stateid_hash 1317 ) 1318 ); 1319 1320 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \ 1321 DEFINE_EVENT(nfs4_test_stateid_event, name, \ 1322 TP_PROTO( \ 1323 const struct nfs4_state *state, \ 1324 const struct nfs4_lock_state *lsp, \ 1325 int error \ 1326 ), \ 1327 TP_ARGS(state, lsp, error)) 1328 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid); 1329 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid); 1330 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid); 1331 #endif /* CONFIG_NFS_V4_1 */ 1332 1333 DECLARE_EVENT_CLASS(nfs4_lookup_event, 1334 TP_PROTO( 1335 const struct inode *dir, 1336 const struct qstr *name, 1337 int error 1338 ), 1339 1340 TP_ARGS(dir, name, error), 1341 1342 TP_STRUCT__entry( 1343 __field(dev_t, dev) 1344 __field(unsigned long, error) 1345 __field(u64, dir) 1346 __string(name, name->name) 1347 ), 1348 1349 TP_fast_assign( 1350 __entry->dev = dir->i_sb->s_dev; 1351 __entry->dir = NFS_FILEID(dir); 1352 __entry->error = -error; 1353 __assign_str(name, name->name); 1354 ), 1355 1356 TP_printk( 1357 "error=%ld (%s) name=%02x:%02x:%llu/%s", 1358 -__entry->error, 1359 show_nfsv4_errors(__entry->error), 1360 MAJOR(__entry->dev), MINOR(__entry->dev), 1361 (unsigned long long)__entry->dir, 1362 __get_str(name) 1363 ) 1364 ); 1365 1366 #define DEFINE_NFS4_LOOKUP_EVENT(name) \ 1367 DEFINE_EVENT(nfs4_lookup_event, name, \ 1368 TP_PROTO( \ 1369 const struct inode *dir, \ 1370 const struct qstr *name, \ 1371 int error \ 1372 ), \ 1373 TP_ARGS(dir, name, error)) 1374 1375 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup); 1376 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink); 1377 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir); 1378 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod); 1379 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove); 1380 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations); 1381 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo); 1382 1383 TRACE_EVENT(nfs4_lookupp, 1384 TP_PROTO( 1385 const struct inode *inode, 1386 int error 1387 ), 1388 1389 TP_ARGS(inode, error), 1390 1391 TP_STRUCT__entry( 1392 __field(dev_t, dev) 1393 __field(u64, ino) 1394 __field(unsigned long, error) 1395 ), 1396 1397 TP_fast_assign( 1398 __entry->dev = inode->i_sb->s_dev; 1399 __entry->ino = NFS_FILEID(inode); 1400 __entry->error = error < 0 ? -error : 0; 1401 ), 1402 1403 TP_printk( 1404 "error=%ld (%s) inode=%02x:%02x:%llu", 1405 -__entry->error, 1406 show_nfsv4_errors(__entry->error), 1407 MAJOR(__entry->dev), MINOR(__entry->dev), 1408 (unsigned long long)__entry->ino 1409 ) 1410 ); 1411 1412 TRACE_EVENT(nfs4_rename, 1413 TP_PROTO( 1414 const struct inode *olddir, 1415 const struct qstr *oldname, 1416 const struct inode *newdir, 1417 const struct qstr *newname, 1418 int error 1419 ), 1420 1421 TP_ARGS(olddir, oldname, newdir, newname, error), 1422 1423 TP_STRUCT__entry( 1424 __field(dev_t, dev) 1425 __field(unsigned long, error) 1426 __field(u64, olddir) 1427 __string(oldname, oldname->name) 1428 __field(u64, newdir) 1429 __string(newname, newname->name) 1430 ), 1431 1432 TP_fast_assign( 1433 __entry->dev = olddir->i_sb->s_dev; 1434 __entry->olddir = NFS_FILEID(olddir); 1435 __entry->newdir = NFS_FILEID(newdir); 1436 __entry->error = error < 0 ? -error : 0; 1437 __assign_str(oldname, oldname->name); 1438 __assign_str(newname, newname->name); 1439 ), 1440 1441 TP_printk( 1442 "error=%ld (%s) oldname=%02x:%02x:%llu/%s " 1443 "newname=%02x:%02x:%llu/%s", 1444 -__entry->error, 1445 show_nfsv4_errors(__entry->error), 1446 MAJOR(__entry->dev), MINOR(__entry->dev), 1447 (unsigned long long)__entry->olddir, 1448 __get_str(oldname), 1449 MAJOR(__entry->dev), MINOR(__entry->dev), 1450 (unsigned long long)__entry->newdir, 1451 __get_str(newname) 1452 ) 1453 ); 1454 1455 DECLARE_EVENT_CLASS(nfs4_inode_event, 1456 TP_PROTO( 1457 const struct inode *inode, 1458 int error 1459 ), 1460 1461 TP_ARGS(inode, error), 1462 1463 TP_STRUCT__entry( 1464 __field(dev_t, dev) 1465 __field(u32, fhandle) 1466 __field(u64, fileid) 1467 __field(unsigned long, error) 1468 ), 1469 1470 TP_fast_assign( 1471 __entry->dev = inode->i_sb->s_dev; 1472 __entry->fileid = NFS_FILEID(inode); 1473 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1474 __entry->error = error < 0 ? -error : 0; 1475 ), 1476 1477 TP_printk( 1478 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x", 1479 -__entry->error, 1480 show_nfsv4_errors(__entry->error), 1481 MAJOR(__entry->dev), MINOR(__entry->dev), 1482 (unsigned long long)__entry->fileid, 1483 __entry->fhandle 1484 ) 1485 ); 1486 1487 #define DEFINE_NFS4_INODE_EVENT(name) \ 1488 DEFINE_EVENT(nfs4_inode_event, name, \ 1489 TP_PROTO( \ 1490 const struct inode *inode, \ 1491 int error \ 1492 ), \ 1493 TP_ARGS(inode, error)) 1494 1495 DEFINE_NFS4_INODE_EVENT(nfs4_access); 1496 DEFINE_NFS4_INODE_EVENT(nfs4_readlink); 1497 DEFINE_NFS4_INODE_EVENT(nfs4_readdir); 1498 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl); 1499 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl); 1500 #ifdef CONFIG_NFS_V4_SECURITY_LABEL 1501 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label); 1502 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label); 1503 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ 1504 1505 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, 1506 TP_PROTO( 1507 const struct inode *inode, 1508 const nfs4_stateid *stateid, 1509 int error 1510 ), 1511 1512 TP_ARGS(inode, stateid, error), 1513 1514 TP_STRUCT__entry( 1515 __field(dev_t, dev) 1516 __field(u32, fhandle) 1517 __field(u64, fileid) 1518 __field(unsigned long, error) 1519 __field(int, stateid_seq) 1520 __field(u32, stateid_hash) 1521 ), 1522 1523 TP_fast_assign( 1524 __entry->dev = inode->i_sb->s_dev; 1525 __entry->fileid = NFS_FILEID(inode); 1526 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1527 __entry->error = error < 0 ? -error : 0; 1528 __entry->stateid_seq = 1529 be32_to_cpu(stateid->seqid); 1530 __entry->stateid_hash = 1531 nfs_stateid_hash(stateid); 1532 ), 1533 1534 TP_printk( 1535 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1536 "stateid=%d:0x%08x", 1537 -__entry->error, 1538 show_nfsv4_errors(__entry->error), 1539 MAJOR(__entry->dev), MINOR(__entry->dev), 1540 (unsigned long long)__entry->fileid, 1541 __entry->fhandle, 1542 __entry->stateid_seq, __entry->stateid_hash 1543 ) 1544 ); 1545 1546 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \ 1547 DEFINE_EVENT(nfs4_inode_stateid_event, name, \ 1548 TP_PROTO( \ 1549 const struct inode *inode, \ 1550 const nfs4_stateid *stateid, \ 1551 int error \ 1552 ), \ 1553 TP_ARGS(inode, stateid, error)) 1554 1555 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr); 1556 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn); 1557 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update); 1558 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait); 1559 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait); 1560 1561 DECLARE_EVENT_CLASS(nfs4_getattr_event, 1562 TP_PROTO( 1563 const struct nfs_server *server, 1564 const struct nfs_fh *fhandle, 1565 const struct nfs_fattr *fattr, 1566 int error 1567 ), 1568 1569 TP_ARGS(server, fhandle, fattr, error), 1570 1571 TP_STRUCT__entry( 1572 __field(dev_t, dev) 1573 __field(u32, fhandle) 1574 __field(u64, fileid) 1575 __field(unsigned int, valid) 1576 __field(unsigned long, error) 1577 ), 1578 1579 TP_fast_assign( 1580 __entry->dev = server->s_dev; 1581 __entry->valid = fattr->valid; 1582 __entry->fhandle = nfs_fhandle_hash(fhandle); 1583 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0; 1584 __entry->error = error < 0 ? -error : 0; 1585 ), 1586 1587 TP_printk( 1588 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1589 "valid=%s", 1590 -__entry->error, 1591 show_nfsv4_errors(__entry->error), 1592 MAJOR(__entry->dev), MINOR(__entry->dev), 1593 (unsigned long long)__entry->fileid, 1594 __entry->fhandle, 1595 show_nfs_fattr_flags(__entry->valid) 1596 ) 1597 ); 1598 1599 #define DEFINE_NFS4_GETATTR_EVENT(name) \ 1600 DEFINE_EVENT(nfs4_getattr_event, name, \ 1601 TP_PROTO( \ 1602 const struct nfs_server *server, \ 1603 const struct nfs_fh *fhandle, \ 1604 const struct nfs_fattr *fattr, \ 1605 int error \ 1606 ), \ 1607 TP_ARGS(server, fhandle, fattr, error)) 1608 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr); 1609 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root); 1610 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo); 1611 1612 DECLARE_EVENT_CLASS(nfs4_inode_callback_event, 1613 TP_PROTO( 1614 const struct nfs_client *clp, 1615 const struct nfs_fh *fhandle, 1616 const struct inode *inode, 1617 int error 1618 ), 1619 1620 TP_ARGS(clp, fhandle, inode, error), 1621 1622 TP_STRUCT__entry( 1623 __field(unsigned long, error) 1624 __field(dev_t, dev) 1625 __field(u32, fhandle) 1626 __field(u64, fileid) 1627 __string(dstaddr, clp ? clp->cl_hostname : "unknown") 1628 ), 1629 1630 TP_fast_assign( 1631 __entry->error = error < 0 ? -error : 0; 1632 __entry->fhandle = nfs_fhandle_hash(fhandle); 1633 if (!IS_ERR_OR_NULL(inode)) { 1634 __entry->fileid = NFS_FILEID(inode); 1635 __entry->dev = inode->i_sb->s_dev; 1636 } else { 1637 __entry->fileid = 0; 1638 __entry->dev = 0; 1639 } 1640 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown"); 1641 ), 1642 1643 TP_printk( 1644 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1645 "dstaddr=%s", 1646 -__entry->error, 1647 show_nfsv4_errors(__entry->error), 1648 MAJOR(__entry->dev), MINOR(__entry->dev), 1649 (unsigned long long)__entry->fileid, 1650 __entry->fhandle, 1651 __get_str(dstaddr) 1652 ) 1653 ); 1654 1655 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \ 1656 DEFINE_EVENT(nfs4_inode_callback_event, name, \ 1657 TP_PROTO( \ 1658 const struct nfs_client *clp, \ 1659 const struct nfs_fh *fhandle, \ 1660 const struct inode *inode, \ 1661 int error \ 1662 ), \ 1663 TP_ARGS(clp, fhandle, inode, error)) 1664 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr); 1665 1666 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event, 1667 TP_PROTO( 1668 const struct nfs_client *clp, 1669 const struct nfs_fh *fhandle, 1670 const struct inode *inode, 1671 const nfs4_stateid *stateid, 1672 int error 1673 ), 1674 1675 TP_ARGS(clp, fhandle, inode, stateid, error), 1676 1677 TP_STRUCT__entry( 1678 __field(unsigned long, error) 1679 __field(dev_t, dev) 1680 __field(u32, fhandle) 1681 __field(u64, fileid) 1682 __string(dstaddr, clp ? clp->cl_hostname : "unknown") 1683 __field(int, stateid_seq) 1684 __field(u32, stateid_hash) 1685 ), 1686 1687 TP_fast_assign( 1688 __entry->error = error < 0 ? -error : 0; 1689 __entry->fhandle = nfs_fhandle_hash(fhandle); 1690 if (!IS_ERR_OR_NULL(inode)) { 1691 __entry->fileid = NFS_FILEID(inode); 1692 __entry->dev = inode->i_sb->s_dev; 1693 } else { 1694 __entry->fileid = 0; 1695 __entry->dev = 0; 1696 } 1697 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown"); 1698 __entry->stateid_seq = 1699 be32_to_cpu(stateid->seqid); 1700 __entry->stateid_hash = 1701 nfs_stateid_hash(stateid); 1702 ), 1703 1704 TP_printk( 1705 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1706 "stateid=%d:0x%08x dstaddr=%s", 1707 -__entry->error, 1708 show_nfsv4_errors(__entry->error), 1709 MAJOR(__entry->dev), MINOR(__entry->dev), 1710 (unsigned long long)__entry->fileid, 1711 __entry->fhandle, 1712 __entry->stateid_seq, __entry->stateid_hash, 1713 __get_str(dstaddr) 1714 ) 1715 ); 1716 1717 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \ 1718 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \ 1719 TP_PROTO( \ 1720 const struct nfs_client *clp, \ 1721 const struct nfs_fh *fhandle, \ 1722 const struct inode *inode, \ 1723 const nfs4_stateid *stateid, \ 1724 int error \ 1725 ), \ 1726 TP_ARGS(clp, fhandle, inode, stateid, error)) 1727 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall); 1728 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file); 1729 1730 DECLARE_EVENT_CLASS(nfs4_idmap_event, 1731 TP_PROTO( 1732 const char *name, 1733 int len, 1734 u32 id, 1735 int error 1736 ), 1737 1738 TP_ARGS(name, len, id, error), 1739 1740 TP_STRUCT__entry( 1741 __field(unsigned long, error) 1742 __field(u32, id) 1743 __dynamic_array(char, name, len > 0 ? len + 1 : 1) 1744 ), 1745 1746 TP_fast_assign( 1747 if (len < 0) 1748 len = 0; 1749 __entry->error = error < 0 ? error : 0; 1750 __entry->id = id; 1751 memcpy(__get_str(name), name, len); 1752 __get_str(name)[len] = 0; 1753 ), 1754 1755 TP_printk( 1756 "error=%ld (%s) id=%u name=%s", 1757 -__entry->error, show_nfsv4_errors(__entry->error), 1758 __entry->id, 1759 __get_str(name) 1760 ) 1761 ); 1762 #define DEFINE_NFS4_IDMAP_EVENT(name) \ 1763 DEFINE_EVENT(nfs4_idmap_event, name, \ 1764 TP_PROTO( \ 1765 const char *name, \ 1766 int len, \ 1767 u32 id, \ 1768 int error \ 1769 ), \ 1770 TP_ARGS(name, len, id, error)) 1771 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid); 1772 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid); 1773 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name); 1774 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group); 1775 1776 #ifdef CONFIG_NFS_V4_1 1777 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \ 1778 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0) 1779 #else 1780 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0) 1781 #endif 1782 1783 DECLARE_EVENT_CLASS(nfs4_read_event, 1784 TP_PROTO( 1785 const struct nfs_pgio_header *hdr, 1786 int error 1787 ), 1788 1789 TP_ARGS(hdr, error), 1790 1791 TP_STRUCT__entry( 1792 __field(dev_t, dev) 1793 __field(u32, fhandle) 1794 __field(u64, fileid) 1795 __field(loff_t, offset) 1796 __field(u32, arg_count) 1797 __field(u32, res_count) 1798 __field(unsigned long, error) 1799 __field(int, stateid_seq) 1800 __field(u32, stateid_hash) 1801 __field(int, layoutstateid_seq) 1802 __field(u32, layoutstateid_hash) 1803 ), 1804 1805 TP_fast_assign( 1806 const struct inode *inode = hdr->inode; 1807 const struct nfs_inode *nfsi = NFS_I(inode); 1808 const struct nfs_fh *fh = hdr->args.fh ? 1809 hdr->args.fh : &nfsi->fh; 1810 const struct nfs4_state *state = 1811 hdr->args.context->state; 1812 const struct pnfs_layout_segment *lseg = hdr->lseg; 1813 1814 __entry->dev = inode->i_sb->s_dev; 1815 __entry->fileid = nfsi->fileid; 1816 __entry->fhandle = nfs_fhandle_hash(fh); 1817 __entry->offset = hdr->args.offset; 1818 __entry->arg_count = hdr->args.count; 1819 __entry->res_count = hdr->res.count; 1820 __entry->error = error < 0 ? -error : 0; 1821 __entry->stateid_seq = 1822 be32_to_cpu(state->stateid.seqid); 1823 __entry->stateid_hash = 1824 nfs_stateid_hash(&state->stateid); 1825 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0; 1826 __entry->layoutstateid_hash = 1827 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg); 1828 ), 1829 1830 TP_printk( 1831 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1832 "offset=%lld count=%u res=%u stateid=%d:0x%08x " 1833 "layoutstateid=%d:0x%08x", 1834 -__entry->error, 1835 show_nfsv4_errors(__entry->error), 1836 MAJOR(__entry->dev), MINOR(__entry->dev), 1837 (unsigned long long)__entry->fileid, 1838 __entry->fhandle, 1839 (long long)__entry->offset, 1840 __entry->arg_count, __entry->res_count, 1841 __entry->stateid_seq, __entry->stateid_hash, 1842 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1843 ) 1844 ); 1845 #define DEFINE_NFS4_READ_EVENT(name) \ 1846 DEFINE_EVENT(nfs4_read_event, name, \ 1847 TP_PROTO( \ 1848 const struct nfs_pgio_header *hdr, \ 1849 int error \ 1850 ), \ 1851 TP_ARGS(hdr, error)) 1852 DEFINE_NFS4_READ_EVENT(nfs4_read); 1853 #ifdef CONFIG_NFS_V4_1 1854 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read); 1855 #endif /* CONFIG_NFS_V4_1 */ 1856 1857 DECLARE_EVENT_CLASS(nfs4_write_event, 1858 TP_PROTO( 1859 const struct nfs_pgio_header *hdr, 1860 int error 1861 ), 1862 1863 TP_ARGS(hdr, error), 1864 1865 TP_STRUCT__entry( 1866 __field(dev_t, dev) 1867 __field(u32, fhandle) 1868 __field(u64, fileid) 1869 __field(loff_t, offset) 1870 __field(u32, arg_count) 1871 __field(u32, res_count) 1872 __field(unsigned long, error) 1873 __field(int, stateid_seq) 1874 __field(u32, stateid_hash) 1875 __field(int, layoutstateid_seq) 1876 __field(u32, layoutstateid_hash) 1877 ), 1878 1879 TP_fast_assign( 1880 const struct inode *inode = hdr->inode; 1881 const struct nfs_inode *nfsi = NFS_I(inode); 1882 const struct nfs_fh *fh = hdr->args.fh ? 1883 hdr->args.fh : &nfsi->fh; 1884 const struct nfs4_state *state = 1885 hdr->args.context->state; 1886 const struct pnfs_layout_segment *lseg = hdr->lseg; 1887 1888 __entry->dev = inode->i_sb->s_dev; 1889 __entry->fileid = nfsi->fileid; 1890 __entry->fhandle = nfs_fhandle_hash(fh); 1891 __entry->offset = hdr->args.offset; 1892 __entry->arg_count = hdr->args.count; 1893 __entry->res_count = hdr->res.count; 1894 __entry->error = error < 0 ? -error : 0; 1895 __entry->stateid_seq = 1896 be32_to_cpu(state->stateid.seqid); 1897 __entry->stateid_hash = 1898 nfs_stateid_hash(&state->stateid); 1899 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0; 1900 __entry->layoutstateid_hash = 1901 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg); 1902 ), 1903 1904 TP_printk( 1905 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1906 "offset=%lld count=%u res=%u stateid=%d:0x%08x " 1907 "layoutstateid=%d:0x%08x", 1908 -__entry->error, 1909 show_nfsv4_errors(__entry->error), 1910 MAJOR(__entry->dev), MINOR(__entry->dev), 1911 (unsigned long long)__entry->fileid, 1912 __entry->fhandle, 1913 (long long)__entry->offset, 1914 __entry->arg_count, __entry->res_count, 1915 __entry->stateid_seq, __entry->stateid_hash, 1916 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1917 ) 1918 ); 1919 1920 #define DEFINE_NFS4_WRITE_EVENT(name) \ 1921 DEFINE_EVENT(nfs4_write_event, name, \ 1922 TP_PROTO( \ 1923 const struct nfs_pgio_header *hdr, \ 1924 int error \ 1925 ), \ 1926 TP_ARGS(hdr, error)) 1927 DEFINE_NFS4_WRITE_EVENT(nfs4_write); 1928 #ifdef CONFIG_NFS_V4_1 1929 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write); 1930 #endif /* CONFIG_NFS_V4_1 */ 1931 1932 DECLARE_EVENT_CLASS(nfs4_commit_event, 1933 TP_PROTO( 1934 const struct nfs_commit_data *data, 1935 int error 1936 ), 1937 1938 TP_ARGS(data, error), 1939 1940 TP_STRUCT__entry( 1941 __field(dev_t, dev) 1942 __field(u32, fhandle) 1943 __field(u64, fileid) 1944 __field(unsigned long, error) 1945 __field(loff_t, offset) 1946 __field(u32, count) 1947 __field(int, layoutstateid_seq) 1948 __field(u32, layoutstateid_hash) 1949 ), 1950 1951 TP_fast_assign( 1952 const struct inode *inode = data->inode; 1953 const struct nfs_inode *nfsi = NFS_I(inode); 1954 const struct nfs_fh *fh = data->args.fh ? 1955 data->args.fh : &nfsi->fh; 1956 const struct pnfs_layout_segment *lseg = data->lseg; 1957 1958 __entry->dev = inode->i_sb->s_dev; 1959 __entry->fileid = nfsi->fileid; 1960 __entry->fhandle = nfs_fhandle_hash(fh); 1961 __entry->offset = data->args.offset; 1962 __entry->count = data->args.count; 1963 __entry->error = error < 0 ? -error : 0; 1964 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0; 1965 __entry->layoutstateid_hash = 1966 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg); 1967 ), 1968 1969 TP_printk( 1970 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1971 "offset=%lld count=%u layoutstateid=%d:0x%08x", 1972 -__entry->error, 1973 show_nfsv4_errors(__entry->error), 1974 MAJOR(__entry->dev), MINOR(__entry->dev), 1975 (unsigned long long)__entry->fileid, 1976 __entry->fhandle, 1977 (long long)__entry->offset, 1978 __entry->count, 1979 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1980 ) 1981 ); 1982 #define DEFINE_NFS4_COMMIT_EVENT(name) \ 1983 DEFINE_EVENT(nfs4_commit_event, name, \ 1984 TP_PROTO( \ 1985 const struct nfs_commit_data *data, \ 1986 int error \ 1987 ), \ 1988 TP_ARGS(data, error)) 1989 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit); 1990 #ifdef CONFIG_NFS_V4_1 1991 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds); 1992 1993 TRACE_DEFINE_ENUM(IOMODE_READ); 1994 TRACE_DEFINE_ENUM(IOMODE_RW); 1995 TRACE_DEFINE_ENUM(IOMODE_ANY); 1996 1997 #define show_pnfs_iomode(iomode) \ 1998 __print_symbolic(iomode, \ 1999 { IOMODE_READ, "READ" }, \ 2000 { IOMODE_RW, "RW" }, \ 2001 { IOMODE_ANY, "ANY" }) 2002 2003 TRACE_EVENT(nfs4_layoutget, 2004 TP_PROTO( 2005 const struct nfs_open_context *ctx, 2006 const struct pnfs_layout_range *args, 2007 const struct pnfs_layout_range *res, 2008 const nfs4_stateid *layout_stateid, 2009 int error 2010 ), 2011 2012 TP_ARGS(ctx, args, res, layout_stateid, error), 2013 2014 TP_STRUCT__entry( 2015 __field(dev_t, dev) 2016 __field(u32, fhandle) 2017 __field(u64, fileid) 2018 __field(u32, iomode) 2019 __field(u64, offset) 2020 __field(u64, count) 2021 __field(unsigned long, error) 2022 __field(int, stateid_seq) 2023 __field(u32, stateid_hash) 2024 __field(int, layoutstateid_seq) 2025 __field(u32, layoutstateid_hash) 2026 ), 2027 2028 TP_fast_assign( 2029 const struct inode *inode = d_inode(ctx->dentry); 2030 const struct nfs4_state *state = ctx->state; 2031 __entry->dev = inode->i_sb->s_dev; 2032 __entry->fileid = NFS_FILEID(inode); 2033 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2034 __entry->iomode = args->iomode; 2035 __entry->offset = args->offset; 2036 __entry->count = args->length; 2037 __entry->error = error < 0 ? -error : 0; 2038 __entry->stateid_seq = 2039 be32_to_cpu(state->stateid.seqid); 2040 __entry->stateid_hash = 2041 nfs_stateid_hash(&state->stateid); 2042 if (!error) { 2043 __entry->layoutstateid_seq = 2044 be32_to_cpu(layout_stateid->seqid); 2045 __entry->layoutstateid_hash = 2046 nfs_stateid_hash(layout_stateid); 2047 } else { 2048 __entry->layoutstateid_seq = 0; 2049 __entry->layoutstateid_hash = 0; 2050 } 2051 ), 2052 2053 TP_printk( 2054 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2055 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x " 2056 "layoutstateid=%d:0x%08x", 2057 -__entry->error, 2058 show_nfsv4_errors(__entry->error), 2059 MAJOR(__entry->dev), MINOR(__entry->dev), 2060 (unsigned long long)__entry->fileid, 2061 __entry->fhandle, 2062 show_pnfs_iomode(__entry->iomode), 2063 (unsigned long long)__entry->offset, 2064 (unsigned long long)__entry->count, 2065 __entry->stateid_seq, __entry->stateid_hash, 2066 __entry->layoutstateid_seq, __entry->layoutstateid_hash 2067 ) 2068 ); 2069 2070 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit); 2071 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn); 2072 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close); 2073 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror); 2074 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats); 2075 2076 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN); 2077 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS); 2078 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN); 2079 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH); 2080 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM); 2081 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL); 2082 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL); 2083 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED); 2084 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN); 2085 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED); 2086 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN); 2087 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY); 2088 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET); 2089 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT); 2090 2091 #define show_pnfs_update_layout_reason(reason) \ 2092 __print_symbolic(reason, \ 2093 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \ 2094 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \ 2095 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \ 2096 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \ 2097 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \ 2098 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \ 2099 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \ 2100 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \ 2101 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \ 2102 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \ 2103 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \ 2104 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \ 2105 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \ 2106 { PNFS_UPDATE_LAYOUT_EXIT, "exit" }) 2107 2108 TRACE_EVENT(pnfs_update_layout, 2109 TP_PROTO(struct inode *inode, 2110 loff_t pos, 2111 u64 count, 2112 enum pnfs_iomode iomode, 2113 struct pnfs_layout_hdr *lo, 2114 struct pnfs_layout_segment *lseg, 2115 enum pnfs_update_layout_reason reason 2116 ), 2117 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason), 2118 TP_STRUCT__entry( 2119 __field(dev_t, dev) 2120 __field(u64, fileid) 2121 __field(u32, fhandle) 2122 __field(loff_t, pos) 2123 __field(u64, count) 2124 __field(enum pnfs_iomode, iomode) 2125 __field(int, layoutstateid_seq) 2126 __field(u32, layoutstateid_hash) 2127 __field(long, lseg) 2128 __field(enum pnfs_update_layout_reason, reason) 2129 ), 2130 TP_fast_assign( 2131 __entry->dev = inode->i_sb->s_dev; 2132 __entry->fileid = NFS_FILEID(inode); 2133 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2134 __entry->pos = pos; 2135 __entry->count = count; 2136 __entry->iomode = iomode; 2137 __entry->reason = reason; 2138 if (lo != NULL) { 2139 __entry->layoutstateid_seq = 2140 be32_to_cpu(lo->plh_stateid.seqid); 2141 __entry->layoutstateid_hash = 2142 nfs_stateid_hash(&lo->plh_stateid); 2143 } else { 2144 __entry->layoutstateid_seq = 0; 2145 __entry->layoutstateid_hash = 0; 2146 } 2147 __entry->lseg = (long)lseg; 2148 ), 2149 TP_printk( 2150 "fileid=%02x:%02x:%llu fhandle=0x%08x " 2151 "iomode=%s pos=%llu count=%llu " 2152 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)", 2153 MAJOR(__entry->dev), MINOR(__entry->dev), 2154 (unsigned long long)__entry->fileid, 2155 __entry->fhandle, 2156 show_pnfs_iomode(__entry->iomode), 2157 (unsigned long long)__entry->pos, 2158 (unsigned long long)__entry->count, 2159 __entry->layoutstateid_seq, __entry->layoutstateid_hash, 2160 __entry->lseg, 2161 show_pnfs_update_layout_reason(__entry->reason) 2162 ) 2163 ); 2164 2165 DECLARE_EVENT_CLASS(pnfs_layout_event, 2166 TP_PROTO(struct inode *inode, 2167 loff_t pos, 2168 u64 count, 2169 enum pnfs_iomode iomode, 2170 struct pnfs_layout_hdr *lo, 2171 struct pnfs_layout_segment *lseg 2172 ), 2173 TP_ARGS(inode, pos, count, iomode, lo, lseg), 2174 TP_STRUCT__entry( 2175 __field(dev_t, dev) 2176 __field(u64, fileid) 2177 __field(u32, fhandle) 2178 __field(loff_t, pos) 2179 __field(u64, count) 2180 __field(enum pnfs_iomode, iomode) 2181 __field(int, layoutstateid_seq) 2182 __field(u32, layoutstateid_hash) 2183 __field(long, lseg) 2184 ), 2185 TP_fast_assign( 2186 __entry->dev = inode->i_sb->s_dev; 2187 __entry->fileid = NFS_FILEID(inode); 2188 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2189 __entry->pos = pos; 2190 __entry->count = count; 2191 __entry->iomode = iomode; 2192 if (lo != NULL) { 2193 __entry->layoutstateid_seq = 2194 be32_to_cpu(lo->plh_stateid.seqid); 2195 __entry->layoutstateid_hash = 2196 nfs_stateid_hash(&lo->plh_stateid); 2197 } else { 2198 __entry->layoutstateid_seq = 0; 2199 __entry->layoutstateid_hash = 0; 2200 } 2201 __entry->lseg = (long)lseg; 2202 ), 2203 TP_printk( 2204 "fileid=%02x:%02x:%llu fhandle=0x%08x " 2205 "iomode=%s pos=%llu count=%llu " 2206 "layoutstateid=%d:0x%08x lseg=0x%lx", 2207 MAJOR(__entry->dev), MINOR(__entry->dev), 2208 (unsigned long long)__entry->fileid, 2209 __entry->fhandle, 2210 show_pnfs_iomode(__entry->iomode), 2211 (unsigned long long)__entry->pos, 2212 (unsigned long long)__entry->count, 2213 __entry->layoutstateid_seq, __entry->layoutstateid_hash, 2214 __entry->lseg 2215 ) 2216 ); 2217 2218 #define DEFINE_PNFS_LAYOUT_EVENT(name) \ 2219 DEFINE_EVENT(pnfs_layout_event, name, \ 2220 TP_PROTO(struct inode *inode, \ 2221 loff_t pos, \ 2222 u64 count, \ 2223 enum pnfs_iomode iomode, \ 2224 struct pnfs_layout_hdr *lo, \ 2225 struct pnfs_layout_segment *lseg \ 2226 ), \ 2227 TP_ARGS(inode, pos, count, iomode, lo, lseg)) 2228 2229 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read); 2230 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write); 2231 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count); 2232 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done); 2233 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done); 2234 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist); 2235 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist); 2236 2237 DECLARE_EVENT_CLASS(nfs4_deviceid_event, 2238 TP_PROTO( 2239 const struct nfs_client *clp, 2240 const struct nfs4_deviceid *deviceid 2241 ), 2242 2243 TP_ARGS(clp, deviceid), 2244 2245 TP_STRUCT__entry( 2246 __string(dstaddr, clp->cl_hostname) 2247 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE) 2248 ), 2249 2250 TP_fast_assign( 2251 __assign_str(dstaddr, clp->cl_hostname); 2252 memcpy(__entry->deviceid, deviceid->data, 2253 NFS4_DEVICEID4_SIZE); 2254 ), 2255 2256 TP_printk( 2257 "deviceid=%s, dstaddr=%s", 2258 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE), 2259 __get_str(dstaddr) 2260 ) 2261 ); 2262 #define DEFINE_PNFS_DEVICEID_EVENT(name) \ 2263 DEFINE_EVENT(nfs4_deviceid_event, name, \ 2264 TP_PROTO(const struct nfs_client *clp, \ 2265 const struct nfs4_deviceid *deviceid \ 2266 ), \ 2267 TP_ARGS(clp, deviceid)) 2268 DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free); 2269 2270 DECLARE_EVENT_CLASS(nfs4_deviceid_status, 2271 TP_PROTO( 2272 const struct nfs_server *server, 2273 const struct nfs4_deviceid *deviceid, 2274 int status 2275 ), 2276 2277 TP_ARGS(server, deviceid, status), 2278 2279 TP_STRUCT__entry( 2280 __field(dev_t, dev) 2281 __field(int, status) 2282 __string(dstaddr, server->nfs_client->cl_hostname) 2283 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE) 2284 ), 2285 2286 TP_fast_assign( 2287 __entry->dev = server->s_dev; 2288 __entry->status = status; 2289 __assign_str(dstaddr, server->nfs_client->cl_hostname); 2290 memcpy(__entry->deviceid, deviceid->data, 2291 NFS4_DEVICEID4_SIZE); 2292 ), 2293 2294 TP_printk( 2295 "dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d", 2296 MAJOR(__entry->dev), MINOR(__entry->dev), 2297 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE), 2298 __get_str(dstaddr), 2299 __entry->status 2300 ) 2301 ); 2302 #define DEFINE_PNFS_DEVICEID_STATUS(name) \ 2303 DEFINE_EVENT(nfs4_deviceid_status, name, \ 2304 TP_PROTO(const struct nfs_server *server, \ 2305 const struct nfs4_deviceid *deviceid, \ 2306 int status \ 2307 ), \ 2308 TP_ARGS(server, deviceid, status)) 2309 DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo); 2310 DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid); 2311 2312 DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event, 2313 TP_PROTO( 2314 const struct nfs_pgio_header *hdr 2315 ), 2316 2317 TP_ARGS(hdr), 2318 2319 TP_STRUCT__entry( 2320 __field(unsigned long, error) 2321 __field(dev_t, dev) 2322 __field(u32, fhandle) 2323 __field(u64, fileid) 2324 __field(loff_t, offset) 2325 __field(u32, count) 2326 __field(int, stateid_seq) 2327 __field(u32, stateid_hash) 2328 __string(dstaddr, hdr->ds_clp ? 2329 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient, 2330 RPC_DISPLAY_ADDR) : "unknown") 2331 ), 2332 2333 TP_fast_assign( 2334 const struct inode *inode = hdr->inode; 2335 2336 __entry->error = hdr->res.op_status; 2337 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh); 2338 __entry->fileid = NFS_FILEID(inode); 2339 __entry->dev = inode->i_sb->s_dev; 2340 __entry->offset = hdr->args.offset; 2341 __entry->count = hdr->args.count; 2342 __entry->stateid_seq = 2343 be32_to_cpu(hdr->args.stateid.seqid); 2344 __entry->stateid_hash = 2345 nfs_stateid_hash(&hdr->args.stateid); 2346 __assign_str(dstaddr, hdr->ds_clp ? 2347 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient, 2348 RPC_DISPLAY_ADDR) : "unknown"); 2349 ), 2350 2351 TP_printk( 2352 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2353 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s", 2354 -__entry->error, 2355 show_nfsv4_errors(__entry->error), 2356 MAJOR(__entry->dev), MINOR(__entry->dev), 2357 (unsigned long long)__entry->fileid, 2358 __entry->fhandle, 2359 __entry->offset, __entry->count, 2360 __entry->stateid_seq, __entry->stateid_hash, 2361 __get_str(dstaddr) 2362 ) 2363 ); 2364 2365 #define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \ 2366 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \ 2367 TP_PROTO( \ 2368 const struct nfs_pgio_header *hdr \ 2369 ), \ 2370 TP_ARGS(hdr)) 2371 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error); 2372 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error); 2373 2374 TRACE_EVENT(ff_layout_commit_error, 2375 TP_PROTO( 2376 const struct nfs_commit_data *data 2377 ), 2378 2379 TP_ARGS(data), 2380 2381 TP_STRUCT__entry( 2382 __field(unsigned long, error) 2383 __field(dev_t, dev) 2384 __field(u32, fhandle) 2385 __field(u64, fileid) 2386 __field(loff_t, offset) 2387 __field(u32, count) 2388 __string(dstaddr, data->ds_clp ? 2389 rpc_peeraddr2str(data->ds_clp->cl_rpcclient, 2390 RPC_DISPLAY_ADDR) : "unknown") 2391 ), 2392 2393 TP_fast_assign( 2394 const struct inode *inode = data->inode; 2395 2396 __entry->error = data->res.op_status; 2397 __entry->fhandle = nfs_fhandle_hash(data->args.fh); 2398 __entry->fileid = NFS_FILEID(inode); 2399 __entry->dev = inode->i_sb->s_dev; 2400 __entry->offset = data->args.offset; 2401 __entry->count = data->args.count; 2402 __assign_str(dstaddr, data->ds_clp ? 2403 rpc_peeraddr2str(data->ds_clp->cl_rpcclient, 2404 RPC_DISPLAY_ADDR) : "unknown"); 2405 ), 2406 2407 TP_printk( 2408 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2409 "offset=%llu count=%u dstaddr=%s", 2410 -__entry->error, 2411 show_nfsv4_errors(__entry->error), 2412 MAJOR(__entry->dev), MINOR(__entry->dev), 2413 (unsigned long long)__entry->fileid, 2414 __entry->fhandle, 2415 __entry->offset, __entry->count, 2416 __get_str(dstaddr) 2417 ) 2418 ); 2419 2420 2421 #endif /* CONFIG_NFS_V4_1 */ 2422 2423 #endif /* _TRACE_NFS4_H */ 2424 2425 #undef TRACE_INCLUDE_PATH 2426 #define TRACE_INCLUDE_PATH . 2427 #define TRACE_INCLUDE_FILE nfs4trace 2428 /* This part must be outside protection */ 2429 #include <trace/define_trace.h> 2430