Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Oracle. All Rights Reserved. |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 5 | */ |
| 6 | #undef TRACE_SYSTEM |
| 7 | #define TRACE_SYSTEM xfs_scrub |
| 8 | |
| 9 | #if !defined(_TRACE_XFS_SCRUB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 10 | #define _TRACE_XFS_SCRUB_TRACE_H |
| 11 | |
| 12 | #include <linux/tracepoint.h> |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 13 | #include "xfs_bit.h" |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 14 | |
Darrick J. Wong | a563718 | 2017-10-17 21:37:35 -0700 | [diff] [blame] | 15 | DECLARE_EVENT_CLASS(xfs_scrub_class, |
| 16 | TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, |
| 17 | int error), |
| 18 | TP_ARGS(ip, sm, error), |
| 19 | TP_STRUCT__entry( |
| 20 | __field(dev_t, dev) |
| 21 | __field(xfs_ino_t, ino) |
| 22 | __field(unsigned int, type) |
| 23 | __field(xfs_agnumber_t, agno) |
| 24 | __field(xfs_ino_t, inum) |
| 25 | __field(unsigned int, gen) |
| 26 | __field(unsigned int, flags) |
| 27 | __field(int, error) |
| 28 | ), |
| 29 | TP_fast_assign( |
| 30 | __entry->dev = ip->i_mount->m_super->s_dev; |
| 31 | __entry->ino = ip->i_ino; |
| 32 | __entry->type = sm->sm_type; |
| 33 | __entry->agno = sm->sm_agno; |
| 34 | __entry->inum = sm->sm_ino; |
| 35 | __entry->gen = sm->sm_gen; |
| 36 | __entry->flags = sm->sm_flags; |
| 37 | __entry->error = error; |
| 38 | ), |
Darrick J. Wong | 67a3f6d0 | 2018-01-22 16:46:42 -0800 | [diff] [blame] | 39 | TP_printk("dev %d:%d ino 0x%llx type %u agno %u inum %llu gen %u flags 0x%x error %d", |
Darrick J. Wong | a563718 | 2017-10-17 21:37:35 -0700 | [diff] [blame] | 40 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 41 | __entry->ino, |
| 42 | __entry->type, |
| 43 | __entry->agno, |
| 44 | __entry->inum, |
| 45 | __entry->gen, |
| 46 | __entry->flags, |
| 47 | __entry->error) |
| 48 | ) |
| 49 | #define DEFINE_SCRUB_EVENT(name) \ |
| 50 | DEFINE_EVENT(xfs_scrub_class, name, \ |
| 51 | TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, \ |
| 52 | int error), \ |
| 53 | TP_ARGS(ip, sm, error)) |
| 54 | |
| 55 | DEFINE_SCRUB_EVENT(xfs_scrub_start); |
| 56 | DEFINE_SCRUB_EVENT(xfs_scrub_done); |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 57 | DEFINE_SCRUB_EVENT(xfs_scrub_deadlock_retry); |
Darrick J. Wong | 718fa74 | 2018-05-14 06:34:35 -0700 | [diff] [blame] | 58 | DEFINE_SCRUB_EVENT(xfs_repair_attempt); |
| 59 | DEFINE_SCRUB_EVENT(xfs_repair_done); |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 60 | |
| 61 | TRACE_EVENT(xfs_scrub_op_error, |
| 62 | TP_PROTO(struct xfs_scrub_context *sc, xfs_agnumber_t agno, |
| 63 | xfs_agblock_t bno, int error, void *ret_ip), |
| 64 | TP_ARGS(sc, agno, bno, error, ret_ip), |
| 65 | TP_STRUCT__entry( |
| 66 | __field(dev_t, dev) |
| 67 | __field(unsigned int, type) |
| 68 | __field(xfs_agnumber_t, agno) |
| 69 | __field(xfs_agblock_t, bno) |
| 70 | __field(int, error) |
| 71 | __field(void *, ret_ip) |
| 72 | ), |
| 73 | TP_fast_assign( |
| 74 | __entry->dev = sc->mp->m_super->s_dev; |
| 75 | __entry->type = sc->sm->sm_type; |
| 76 | __entry->agno = agno; |
| 77 | __entry->bno = bno; |
| 78 | __entry->error = error; |
| 79 | __entry->ret_ip = ret_ip; |
| 80 | ), |
Darrick J. Wong | aff68a55 | 2018-01-09 11:46:05 -0800 | [diff] [blame] | 81 | TP_printk("dev %d:%d type %u agno %u agbno %u error %d ret_ip %pS", |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 82 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 83 | __entry->type, |
| 84 | __entry->agno, |
| 85 | __entry->bno, |
| 86 | __entry->error, |
| 87 | __entry->ret_ip) |
| 88 | ); |
| 89 | |
| 90 | TRACE_EVENT(xfs_scrub_file_op_error, |
| 91 | TP_PROTO(struct xfs_scrub_context *sc, int whichfork, |
| 92 | xfs_fileoff_t offset, int error, void *ret_ip), |
| 93 | TP_ARGS(sc, whichfork, offset, error, ret_ip), |
| 94 | TP_STRUCT__entry( |
| 95 | __field(dev_t, dev) |
| 96 | __field(xfs_ino_t, ino) |
| 97 | __field(int, whichfork) |
| 98 | __field(unsigned int, type) |
| 99 | __field(xfs_fileoff_t, offset) |
| 100 | __field(int, error) |
| 101 | __field(void *, ret_ip) |
| 102 | ), |
| 103 | TP_fast_assign( |
| 104 | __entry->dev = sc->ip->i_mount->m_super->s_dev; |
| 105 | __entry->ino = sc->ip->i_ino; |
| 106 | __entry->whichfork = whichfork; |
| 107 | __entry->type = sc->sm->sm_type; |
| 108 | __entry->offset = offset; |
| 109 | __entry->error = error; |
| 110 | __entry->ret_ip = ret_ip; |
| 111 | ), |
Darrick J. Wong | 67a3f6d0 | 2018-01-22 16:46:42 -0800 | [diff] [blame] | 112 | TP_printk("dev %d:%d ino 0x%llx fork %d type %u offset %llu error %d ret_ip %pS", |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 113 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 114 | __entry->ino, |
| 115 | __entry->whichfork, |
| 116 | __entry->type, |
| 117 | __entry->offset, |
| 118 | __entry->error, |
| 119 | __entry->ret_ip) |
| 120 | ); |
| 121 | |
| 122 | DECLARE_EVENT_CLASS(xfs_scrub_block_error_class, |
| 123 | TP_PROTO(struct xfs_scrub_context *sc, xfs_daddr_t daddr, void *ret_ip), |
| 124 | TP_ARGS(sc, daddr, ret_ip), |
| 125 | TP_STRUCT__entry( |
| 126 | __field(dev_t, dev) |
| 127 | __field(unsigned int, type) |
| 128 | __field(xfs_agnumber_t, agno) |
| 129 | __field(xfs_agblock_t, bno) |
| 130 | __field(void *, ret_ip) |
| 131 | ), |
| 132 | TP_fast_assign( |
| 133 | xfs_fsblock_t fsbno; |
| 134 | xfs_agnumber_t agno; |
| 135 | xfs_agblock_t bno; |
| 136 | |
| 137 | fsbno = XFS_DADDR_TO_FSB(sc->mp, daddr); |
| 138 | agno = XFS_FSB_TO_AGNO(sc->mp, fsbno); |
| 139 | bno = XFS_FSB_TO_AGBNO(sc->mp, fsbno); |
| 140 | |
| 141 | __entry->dev = sc->mp->m_super->s_dev; |
| 142 | __entry->type = sc->sm->sm_type; |
| 143 | __entry->agno = agno; |
| 144 | __entry->bno = bno; |
| 145 | __entry->ret_ip = ret_ip; |
| 146 | ), |
Darrick J. Wong | aff68a55 | 2018-01-09 11:46:05 -0800 | [diff] [blame] | 147 | TP_printk("dev %d:%d type %u agno %u agbno %u ret_ip %pS", |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 148 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 149 | __entry->type, |
| 150 | __entry->agno, |
| 151 | __entry->bno, |
| 152 | __entry->ret_ip) |
| 153 | ) |
| 154 | |
| 155 | #define DEFINE_SCRUB_BLOCK_ERROR_EVENT(name) \ |
| 156 | DEFINE_EVENT(xfs_scrub_block_error_class, name, \ |
| 157 | TP_PROTO(struct xfs_scrub_context *sc, xfs_daddr_t daddr, \ |
| 158 | void *ret_ip), \ |
| 159 | TP_ARGS(sc, daddr, ret_ip)) |
| 160 | |
| 161 | DEFINE_SCRUB_BLOCK_ERROR_EVENT(xfs_scrub_block_error); |
| 162 | DEFINE_SCRUB_BLOCK_ERROR_EVENT(xfs_scrub_block_preen); |
| 163 | |
| 164 | DECLARE_EVENT_CLASS(xfs_scrub_ino_error_class, |
Darrick J. Wong | 7e56d9e | 2018-03-23 10:06:54 -0700 | [diff] [blame] | 165 | TP_PROTO(struct xfs_scrub_context *sc, xfs_ino_t ino, void *ret_ip), |
| 166 | TP_ARGS(sc, ino, ret_ip), |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 167 | TP_STRUCT__entry( |
| 168 | __field(dev_t, dev) |
| 169 | __field(xfs_ino_t, ino) |
| 170 | __field(unsigned int, type) |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 171 | __field(void *, ret_ip) |
| 172 | ), |
| 173 | TP_fast_assign( |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 174 | __entry->dev = sc->mp->m_super->s_dev; |
| 175 | __entry->ino = ino; |
| 176 | __entry->type = sc->sm->sm_type; |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 177 | __entry->ret_ip = ret_ip; |
| 178 | ), |
Darrick J. Wong | 7e56d9e | 2018-03-23 10:06:54 -0700 | [diff] [blame] | 179 | TP_printk("dev %d:%d ino 0x%llx type %u ret_ip %pS", |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 180 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 181 | __entry->ino, |
| 182 | __entry->type, |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 183 | __entry->ret_ip) |
| 184 | ) |
| 185 | |
| 186 | #define DEFINE_SCRUB_INO_ERROR_EVENT(name) \ |
| 187 | DEFINE_EVENT(xfs_scrub_ino_error_class, name, \ |
| 188 | TP_PROTO(struct xfs_scrub_context *sc, xfs_ino_t ino, \ |
Darrick J. Wong | 7e56d9e | 2018-03-23 10:06:54 -0700 | [diff] [blame] | 189 | void *ret_ip), \ |
| 190 | TP_ARGS(sc, ino, ret_ip)) |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 191 | |
| 192 | DEFINE_SCRUB_INO_ERROR_EVENT(xfs_scrub_ino_error); |
| 193 | DEFINE_SCRUB_INO_ERROR_EVENT(xfs_scrub_ino_preen); |
| 194 | DEFINE_SCRUB_INO_ERROR_EVENT(xfs_scrub_ino_warning); |
| 195 | |
| 196 | DECLARE_EVENT_CLASS(xfs_scrub_fblock_error_class, |
| 197 | TP_PROTO(struct xfs_scrub_context *sc, int whichfork, |
| 198 | xfs_fileoff_t offset, void *ret_ip), |
| 199 | TP_ARGS(sc, whichfork, offset, ret_ip), |
| 200 | TP_STRUCT__entry( |
| 201 | __field(dev_t, dev) |
| 202 | __field(xfs_ino_t, ino) |
| 203 | __field(int, whichfork) |
| 204 | __field(unsigned int, type) |
| 205 | __field(xfs_fileoff_t, offset) |
| 206 | __field(void *, ret_ip) |
| 207 | ), |
| 208 | TP_fast_assign( |
| 209 | __entry->dev = sc->ip->i_mount->m_super->s_dev; |
| 210 | __entry->ino = sc->ip->i_ino; |
| 211 | __entry->whichfork = whichfork; |
| 212 | __entry->type = sc->sm->sm_type; |
| 213 | __entry->offset = offset; |
| 214 | __entry->ret_ip = ret_ip; |
| 215 | ), |
Darrick J. Wong | 67a3f6d0 | 2018-01-22 16:46:42 -0800 | [diff] [blame] | 216 | TP_printk("dev %d:%d ino 0x%llx fork %d type %u offset %llu ret_ip %pS", |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 217 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 218 | __entry->ino, |
| 219 | __entry->whichfork, |
| 220 | __entry->type, |
| 221 | __entry->offset, |
| 222 | __entry->ret_ip) |
| 223 | ); |
| 224 | |
| 225 | #define DEFINE_SCRUB_FBLOCK_ERROR_EVENT(name) \ |
| 226 | DEFINE_EVENT(xfs_scrub_fblock_error_class, name, \ |
| 227 | TP_PROTO(struct xfs_scrub_context *sc, int whichfork, \ |
| 228 | xfs_fileoff_t offset, void *ret_ip), \ |
| 229 | TP_ARGS(sc, whichfork, offset, ret_ip)) |
| 230 | |
| 231 | DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xfs_scrub_fblock_error); |
| 232 | DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xfs_scrub_fblock_warning); |
| 233 | |
| 234 | TRACE_EVENT(xfs_scrub_incomplete, |
| 235 | TP_PROTO(struct xfs_scrub_context *sc, void *ret_ip), |
| 236 | TP_ARGS(sc, ret_ip), |
| 237 | TP_STRUCT__entry( |
| 238 | __field(dev_t, dev) |
| 239 | __field(unsigned int, type) |
| 240 | __field(void *, ret_ip) |
| 241 | ), |
| 242 | TP_fast_assign( |
| 243 | __entry->dev = sc->mp->m_super->s_dev; |
| 244 | __entry->type = sc->sm->sm_type; |
| 245 | __entry->ret_ip = ret_ip; |
| 246 | ), |
Darrick J. Wong | aff68a55 | 2018-01-09 11:46:05 -0800 | [diff] [blame] | 247 | TP_printk("dev %d:%d type %u ret_ip %pS", |
Darrick J. Wong | 4700d22 | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 248 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 249 | __entry->type, |
| 250 | __entry->ret_ip) |
| 251 | ); |
Darrick J. Wong | a563718 | 2017-10-17 21:37:35 -0700 | [diff] [blame] | 252 | |
Darrick J. Wong | 537964bc | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 253 | TRACE_EVENT(xfs_scrub_btree_op_error, |
| 254 | TP_PROTO(struct xfs_scrub_context *sc, struct xfs_btree_cur *cur, |
| 255 | int level, int error, void *ret_ip), |
| 256 | TP_ARGS(sc, cur, level, error, ret_ip), |
| 257 | TP_STRUCT__entry( |
| 258 | __field(dev_t, dev) |
| 259 | __field(unsigned int, type) |
| 260 | __field(xfs_btnum_t, btnum) |
| 261 | __field(int, level) |
| 262 | __field(xfs_agnumber_t, agno) |
| 263 | __field(xfs_agblock_t, bno) |
| 264 | __field(int, ptr); |
| 265 | __field(int, error) |
| 266 | __field(void *, ret_ip) |
| 267 | ), |
| 268 | TP_fast_assign( |
| 269 | xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level); |
| 270 | |
| 271 | __entry->dev = sc->mp->m_super->s_dev; |
| 272 | __entry->type = sc->sm->sm_type; |
| 273 | __entry->btnum = cur->bc_btnum; |
| 274 | __entry->level = level; |
| 275 | __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); |
| 276 | __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); |
| 277 | __entry->ptr = cur->bc_ptrs[level]; |
| 278 | __entry->error = error; |
| 279 | __entry->ret_ip = ret_ip; |
| 280 | ), |
Darrick J. Wong | aff68a55 | 2018-01-09 11:46:05 -0800 | [diff] [blame] | 281 | TP_printk("dev %d:%d type %u btnum %d level %d ptr %d agno %u agbno %u error %d ret_ip %pS", |
Darrick J. Wong | 537964bc | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 282 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 283 | __entry->type, |
| 284 | __entry->btnum, |
| 285 | __entry->level, |
| 286 | __entry->ptr, |
| 287 | __entry->agno, |
| 288 | __entry->bno, |
| 289 | __entry->error, |
| 290 | __entry->ret_ip) |
| 291 | ); |
| 292 | |
| 293 | TRACE_EVENT(xfs_scrub_ifork_btree_op_error, |
| 294 | TP_PROTO(struct xfs_scrub_context *sc, struct xfs_btree_cur *cur, |
| 295 | int level, int error, void *ret_ip), |
| 296 | TP_ARGS(sc, cur, level, error, ret_ip), |
| 297 | TP_STRUCT__entry( |
| 298 | __field(dev_t, dev) |
| 299 | __field(xfs_ino_t, ino) |
| 300 | __field(int, whichfork) |
| 301 | __field(unsigned int, type) |
| 302 | __field(xfs_btnum_t, btnum) |
| 303 | __field(int, level) |
| 304 | __field(int, ptr) |
| 305 | __field(xfs_agnumber_t, agno) |
| 306 | __field(xfs_agblock_t, bno) |
| 307 | __field(int, error) |
| 308 | __field(void *, ret_ip) |
| 309 | ), |
| 310 | TP_fast_assign( |
| 311 | xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level); |
| 312 | __entry->dev = sc->mp->m_super->s_dev; |
| 313 | __entry->ino = sc->ip->i_ino; |
| 314 | __entry->whichfork = cur->bc_private.b.whichfork; |
| 315 | __entry->type = sc->sm->sm_type; |
| 316 | __entry->btnum = cur->bc_btnum; |
| 317 | __entry->level = level; |
| 318 | __entry->ptr = cur->bc_ptrs[level]; |
| 319 | __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); |
| 320 | __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); |
| 321 | __entry->error = error; |
| 322 | __entry->ret_ip = ret_ip; |
| 323 | ), |
Darrick J. Wong | 67a3f6d0 | 2018-01-22 16:46:42 -0800 | [diff] [blame] | 324 | TP_printk("dev %d:%d ino 0x%llx fork %d type %u btnum %d level %d ptr %d agno %u agbno %u error %d ret_ip %pS", |
Darrick J. Wong | 537964bc | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 325 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 326 | __entry->ino, |
| 327 | __entry->whichfork, |
| 328 | __entry->type, |
| 329 | __entry->btnum, |
| 330 | __entry->level, |
| 331 | __entry->ptr, |
| 332 | __entry->agno, |
| 333 | __entry->bno, |
| 334 | __entry->error, |
| 335 | __entry->ret_ip) |
| 336 | ); |
| 337 | |
| 338 | TRACE_EVENT(xfs_scrub_btree_error, |
| 339 | TP_PROTO(struct xfs_scrub_context *sc, struct xfs_btree_cur *cur, |
| 340 | int level, void *ret_ip), |
| 341 | TP_ARGS(sc, cur, level, ret_ip), |
| 342 | TP_STRUCT__entry( |
| 343 | __field(dev_t, dev) |
| 344 | __field(unsigned int, type) |
| 345 | __field(xfs_btnum_t, btnum) |
| 346 | __field(int, level) |
| 347 | __field(xfs_agnumber_t, agno) |
| 348 | __field(xfs_agblock_t, bno) |
| 349 | __field(int, ptr); |
| 350 | __field(void *, ret_ip) |
| 351 | ), |
| 352 | TP_fast_assign( |
| 353 | xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level); |
| 354 | __entry->dev = sc->mp->m_super->s_dev; |
| 355 | __entry->type = sc->sm->sm_type; |
| 356 | __entry->btnum = cur->bc_btnum; |
| 357 | __entry->level = level; |
| 358 | __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); |
| 359 | __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); |
| 360 | __entry->ptr = cur->bc_ptrs[level]; |
| 361 | __entry->ret_ip = ret_ip; |
| 362 | ), |
Darrick J. Wong | aff68a55 | 2018-01-09 11:46:05 -0800 | [diff] [blame] | 363 | TP_printk("dev %d:%d type %u btnum %d level %d ptr %d agno %u agbno %u ret_ip %pS", |
Darrick J. Wong | 537964bc | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 364 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 365 | __entry->type, |
| 366 | __entry->btnum, |
| 367 | __entry->level, |
| 368 | __entry->ptr, |
| 369 | __entry->agno, |
| 370 | __entry->bno, |
| 371 | __entry->ret_ip) |
| 372 | ); |
| 373 | |
| 374 | TRACE_EVENT(xfs_scrub_ifork_btree_error, |
| 375 | TP_PROTO(struct xfs_scrub_context *sc, struct xfs_btree_cur *cur, |
| 376 | int level, void *ret_ip), |
| 377 | TP_ARGS(sc, cur, level, ret_ip), |
| 378 | TP_STRUCT__entry( |
| 379 | __field(dev_t, dev) |
| 380 | __field(xfs_ino_t, ino) |
| 381 | __field(int, whichfork) |
| 382 | __field(unsigned int, type) |
| 383 | __field(xfs_btnum_t, btnum) |
| 384 | __field(int, level) |
| 385 | __field(xfs_agnumber_t, agno) |
| 386 | __field(xfs_agblock_t, bno) |
| 387 | __field(int, ptr); |
| 388 | __field(void *, ret_ip) |
| 389 | ), |
| 390 | TP_fast_assign( |
| 391 | xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level); |
| 392 | __entry->dev = sc->mp->m_super->s_dev; |
| 393 | __entry->ino = sc->ip->i_ino; |
| 394 | __entry->whichfork = cur->bc_private.b.whichfork; |
| 395 | __entry->type = sc->sm->sm_type; |
| 396 | __entry->btnum = cur->bc_btnum; |
| 397 | __entry->level = level; |
| 398 | __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); |
| 399 | __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); |
| 400 | __entry->ptr = cur->bc_ptrs[level]; |
| 401 | __entry->ret_ip = ret_ip; |
| 402 | ), |
Darrick J. Wong | 67a3f6d0 | 2018-01-22 16:46:42 -0800 | [diff] [blame] | 403 | TP_printk("dev %d:%d ino 0x%llx fork %d type %u btnum %d level %d ptr %d agno %u agbno %u ret_ip %pS", |
Darrick J. Wong | 537964bc | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 404 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 405 | __entry->ino, |
| 406 | __entry->whichfork, |
| 407 | __entry->type, |
| 408 | __entry->btnum, |
| 409 | __entry->level, |
| 410 | __entry->ptr, |
| 411 | __entry->agno, |
| 412 | __entry->bno, |
| 413 | __entry->ret_ip) |
| 414 | ); |
| 415 | |
Darrick J. Wong | 37f3fa7 | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 416 | DECLARE_EVENT_CLASS(xfs_scrub_sbtree_class, |
| 417 | TP_PROTO(struct xfs_scrub_context *sc, struct xfs_btree_cur *cur, |
| 418 | int level), |
| 419 | TP_ARGS(sc, cur, level), |
| 420 | TP_STRUCT__entry( |
| 421 | __field(dev_t, dev) |
| 422 | __field(int, type) |
| 423 | __field(xfs_btnum_t, btnum) |
| 424 | __field(xfs_agnumber_t, agno) |
| 425 | __field(xfs_agblock_t, bno) |
| 426 | __field(int, level) |
| 427 | __field(int, nlevels) |
| 428 | __field(int, ptr) |
| 429 | ), |
| 430 | TP_fast_assign( |
| 431 | xfs_fsblock_t fsbno = xfs_scrub_btree_cur_fsbno(cur, level); |
| 432 | |
| 433 | __entry->dev = sc->mp->m_super->s_dev; |
| 434 | __entry->type = sc->sm->sm_type; |
| 435 | __entry->btnum = cur->bc_btnum; |
| 436 | __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); |
| 437 | __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); |
| 438 | __entry->level = level; |
| 439 | __entry->nlevels = cur->bc_nlevels; |
| 440 | __entry->ptr = cur->bc_ptrs[level]; |
| 441 | ), |
| 442 | TP_printk("dev %d:%d type %u btnum %d agno %u agbno %u level %d nlevels %d ptr %d", |
| 443 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 444 | __entry->type, |
| 445 | __entry->btnum, |
| 446 | __entry->agno, |
| 447 | __entry->bno, |
| 448 | __entry->level, |
| 449 | __entry->nlevels, |
| 450 | __entry->ptr) |
| 451 | ) |
| 452 | #define DEFINE_SCRUB_SBTREE_EVENT(name) \ |
| 453 | DEFINE_EVENT(xfs_scrub_sbtree_class, name, \ |
| 454 | TP_PROTO(struct xfs_scrub_context *sc, struct xfs_btree_cur *cur, \ |
| 455 | int level), \ |
| 456 | TP_ARGS(sc, cur, level)) |
| 457 | |
| 458 | DEFINE_SCRUB_SBTREE_EVENT(xfs_scrub_btree_rec); |
| 459 | DEFINE_SCRUB_SBTREE_EVENT(xfs_scrub_btree_key); |
| 460 | |
Darrick J. Wong | 64b1256 | 2018-01-16 18:52:14 -0800 | [diff] [blame] | 461 | TRACE_EVENT(xfs_scrub_xref_error, |
| 462 | TP_PROTO(struct xfs_scrub_context *sc, int error, void *ret_ip), |
| 463 | TP_ARGS(sc, error, ret_ip), |
| 464 | TP_STRUCT__entry( |
| 465 | __field(dev_t, dev) |
| 466 | __field(int, type) |
| 467 | __field(int, error) |
| 468 | __field(void *, ret_ip) |
| 469 | ), |
| 470 | TP_fast_assign( |
| 471 | __entry->dev = sc->mp->m_super->s_dev; |
| 472 | __entry->type = sc->sm->sm_type; |
| 473 | __entry->error = error; |
| 474 | __entry->ret_ip = ret_ip; |
| 475 | ), |
| 476 | TP_printk("dev %d:%d type %u xref error %d ret_ip %pF", |
| 477 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 478 | __entry->type, |
| 479 | __entry->error, |
| 480 | __entry->ret_ip) |
| 481 | ); |
| 482 | |
Darrick J. Wong | 718fa74 | 2018-05-14 06:34:35 -0700 | [diff] [blame] | 483 | /* repair tracepoints */ |
| 484 | #if IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) |
| 485 | |
| 486 | DECLARE_EVENT_CLASS(xfs_repair_extent_class, |
| 487 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, |
| 488 | xfs_agblock_t agbno, xfs_extlen_t len), |
| 489 | TP_ARGS(mp, agno, agbno, len), |
| 490 | TP_STRUCT__entry( |
| 491 | __field(dev_t, dev) |
| 492 | __field(xfs_agnumber_t, agno) |
| 493 | __field(xfs_agblock_t, agbno) |
| 494 | __field(xfs_extlen_t, len) |
| 495 | ), |
| 496 | TP_fast_assign( |
| 497 | __entry->dev = mp->m_super->s_dev; |
| 498 | __entry->agno = agno; |
| 499 | __entry->agbno = agbno; |
| 500 | __entry->len = len; |
| 501 | ), |
| 502 | TP_printk("dev %d:%d agno %u agbno %u len %u", |
| 503 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 504 | __entry->agno, |
| 505 | __entry->agbno, |
| 506 | __entry->len) |
| 507 | ); |
| 508 | #define DEFINE_REPAIR_EXTENT_EVENT(name) \ |
| 509 | DEFINE_EVENT(xfs_repair_extent_class, name, \ |
| 510 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ |
| 511 | xfs_agblock_t agbno, xfs_extlen_t len), \ |
| 512 | TP_ARGS(mp, agno, agbno, len)) |
| 513 | DEFINE_REPAIR_EXTENT_EVENT(xfs_repair_dispose_btree_extent); |
| 514 | DEFINE_REPAIR_EXTENT_EVENT(xfs_repair_collect_btree_extent); |
| 515 | DEFINE_REPAIR_EXTENT_EVENT(xfs_repair_agfl_insert); |
| 516 | |
| 517 | DECLARE_EVENT_CLASS(xfs_repair_rmap_class, |
| 518 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, |
| 519 | xfs_agblock_t agbno, xfs_extlen_t len, |
| 520 | uint64_t owner, uint64_t offset, unsigned int flags), |
| 521 | TP_ARGS(mp, agno, agbno, len, owner, offset, flags), |
| 522 | TP_STRUCT__entry( |
| 523 | __field(dev_t, dev) |
| 524 | __field(xfs_agnumber_t, agno) |
| 525 | __field(xfs_agblock_t, agbno) |
| 526 | __field(xfs_extlen_t, len) |
| 527 | __field(uint64_t, owner) |
| 528 | __field(uint64_t, offset) |
| 529 | __field(unsigned int, flags) |
| 530 | ), |
| 531 | TP_fast_assign( |
| 532 | __entry->dev = mp->m_super->s_dev; |
| 533 | __entry->agno = agno; |
| 534 | __entry->agbno = agbno; |
| 535 | __entry->len = len; |
| 536 | __entry->owner = owner; |
| 537 | __entry->offset = offset; |
| 538 | __entry->flags = flags; |
| 539 | ), |
| 540 | TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x", |
| 541 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 542 | __entry->agno, |
| 543 | __entry->agbno, |
| 544 | __entry->len, |
| 545 | __entry->owner, |
| 546 | __entry->offset, |
| 547 | __entry->flags) |
| 548 | ); |
| 549 | #define DEFINE_REPAIR_RMAP_EVENT(name) \ |
| 550 | DEFINE_EVENT(xfs_repair_rmap_class, name, \ |
| 551 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ |
| 552 | xfs_agblock_t agbno, xfs_extlen_t len, \ |
| 553 | uint64_t owner, uint64_t offset, unsigned int flags), \ |
| 554 | TP_ARGS(mp, agno, agbno, len, owner, offset, flags)) |
| 555 | DEFINE_REPAIR_RMAP_EVENT(xfs_repair_alloc_extent_fn); |
| 556 | DEFINE_REPAIR_RMAP_EVENT(xfs_repair_ialloc_extent_fn); |
| 557 | DEFINE_REPAIR_RMAP_EVENT(xfs_repair_rmap_extent_fn); |
| 558 | DEFINE_REPAIR_RMAP_EVENT(xfs_repair_bmap_extent_fn); |
| 559 | |
| 560 | TRACE_EVENT(xfs_repair_refcount_extent_fn, |
| 561 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, |
| 562 | struct xfs_refcount_irec *irec), |
| 563 | TP_ARGS(mp, agno, irec), |
| 564 | TP_STRUCT__entry( |
| 565 | __field(dev_t, dev) |
| 566 | __field(xfs_agnumber_t, agno) |
| 567 | __field(xfs_agblock_t, startblock) |
| 568 | __field(xfs_extlen_t, blockcount) |
| 569 | __field(xfs_nlink_t, refcount) |
| 570 | ), |
| 571 | TP_fast_assign( |
| 572 | __entry->dev = mp->m_super->s_dev; |
| 573 | __entry->agno = agno; |
| 574 | __entry->startblock = irec->rc_startblock; |
| 575 | __entry->blockcount = irec->rc_blockcount; |
| 576 | __entry->refcount = irec->rc_refcount; |
| 577 | ), |
| 578 | TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u", |
| 579 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 580 | __entry->agno, |
| 581 | __entry->startblock, |
| 582 | __entry->blockcount, |
| 583 | __entry->refcount) |
| 584 | ) |
| 585 | |
| 586 | TRACE_EVENT(xfs_repair_init_btblock, |
| 587 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, |
| 588 | xfs_btnum_t btnum), |
| 589 | TP_ARGS(mp, agno, agbno, btnum), |
| 590 | TP_STRUCT__entry( |
| 591 | __field(dev_t, dev) |
| 592 | __field(xfs_agnumber_t, agno) |
| 593 | __field(xfs_agblock_t, agbno) |
| 594 | __field(uint32_t, btnum) |
| 595 | ), |
| 596 | TP_fast_assign( |
| 597 | __entry->dev = mp->m_super->s_dev; |
| 598 | __entry->agno = agno; |
| 599 | __entry->agbno = agbno; |
| 600 | __entry->btnum = btnum; |
| 601 | ), |
| 602 | TP_printk("dev %d:%d agno %u agbno %u btnum %d", |
| 603 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 604 | __entry->agno, |
| 605 | __entry->agbno, |
| 606 | __entry->btnum) |
| 607 | ) |
| 608 | TRACE_EVENT(xfs_repair_findroot_block, |
| 609 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, |
| 610 | uint32_t magic, uint16_t level), |
| 611 | TP_ARGS(mp, agno, agbno, magic, level), |
| 612 | TP_STRUCT__entry( |
| 613 | __field(dev_t, dev) |
| 614 | __field(xfs_agnumber_t, agno) |
| 615 | __field(xfs_agblock_t, agbno) |
| 616 | __field(uint32_t, magic) |
| 617 | __field(uint16_t, level) |
| 618 | ), |
| 619 | TP_fast_assign( |
| 620 | __entry->dev = mp->m_super->s_dev; |
| 621 | __entry->agno = agno; |
| 622 | __entry->agbno = agbno; |
| 623 | __entry->magic = magic; |
| 624 | __entry->level = level; |
| 625 | ), |
| 626 | TP_printk("dev %d:%d agno %u agbno %u magic 0x%x level %u", |
| 627 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 628 | __entry->agno, |
| 629 | __entry->agbno, |
| 630 | __entry->magic, |
| 631 | __entry->level) |
| 632 | ) |
| 633 | TRACE_EVENT(xfs_repair_calc_ag_resblks, |
| 634 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, |
| 635 | xfs_agino_t icount, xfs_agblock_t aglen, xfs_agblock_t freelen, |
| 636 | xfs_agblock_t usedlen), |
| 637 | TP_ARGS(mp, agno, icount, aglen, freelen, usedlen), |
| 638 | TP_STRUCT__entry( |
| 639 | __field(dev_t, dev) |
| 640 | __field(xfs_agnumber_t, agno) |
| 641 | __field(xfs_agino_t, icount) |
| 642 | __field(xfs_agblock_t, aglen) |
| 643 | __field(xfs_agblock_t, freelen) |
| 644 | __field(xfs_agblock_t, usedlen) |
| 645 | ), |
| 646 | TP_fast_assign( |
| 647 | __entry->dev = mp->m_super->s_dev; |
| 648 | __entry->agno = agno; |
| 649 | __entry->icount = icount; |
| 650 | __entry->aglen = aglen; |
| 651 | __entry->freelen = freelen; |
| 652 | __entry->usedlen = usedlen; |
| 653 | ), |
| 654 | TP_printk("dev %d:%d agno %d icount %u aglen %u freelen %u usedlen %u", |
| 655 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 656 | __entry->agno, |
| 657 | __entry->icount, |
| 658 | __entry->aglen, |
| 659 | __entry->freelen, |
| 660 | __entry->usedlen) |
| 661 | ) |
| 662 | TRACE_EVENT(xfs_repair_calc_ag_resblks_btsize, |
| 663 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, |
| 664 | xfs_agblock_t bnobt_sz, xfs_agblock_t inobt_sz, |
| 665 | xfs_agblock_t rmapbt_sz, xfs_agblock_t refcbt_sz), |
| 666 | TP_ARGS(mp, agno, bnobt_sz, inobt_sz, rmapbt_sz, refcbt_sz), |
| 667 | TP_STRUCT__entry( |
| 668 | __field(dev_t, dev) |
| 669 | __field(xfs_agnumber_t, agno) |
| 670 | __field(xfs_agblock_t, bnobt_sz) |
| 671 | __field(xfs_agblock_t, inobt_sz) |
| 672 | __field(xfs_agblock_t, rmapbt_sz) |
| 673 | __field(xfs_agblock_t, refcbt_sz) |
| 674 | ), |
| 675 | TP_fast_assign( |
| 676 | __entry->dev = mp->m_super->s_dev; |
| 677 | __entry->agno = agno; |
| 678 | __entry->bnobt_sz = bnobt_sz; |
| 679 | __entry->inobt_sz = inobt_sz; |
| 680 | __entry->rmapbt_sz = rmapbt_sz; |
| 681 | __entry->refcbt_sz = refcbt_sz; |
| 682 | ), |
| 683 | TP_printk("dev %d:%d agno %d bno %u ino %u rmap %u refcount %u", |
| 684 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 685 | __entry->agno, |
| 686 | __entry->bnobt_sz, |
| 687 | __entry->inobt_sz, |
| 688 | __entry->rmapbt_sz, |
| 689 | __entry->refcbt_sz) |
| 690 | ) |
| 691 | TRACE_EVENT(xfs_repair_reset_counters, |
| 692 | TP_PROTO(struct xfs_mount *mp), |
| 693 | TP_ARGS(mp), |
| 694 | TP_STRUCT__entry( |
| 695 | __field(dev_t, dev) |
| 696 | ), |
| 697 | TP_fast_assign( |
| 698 | __entry->dev = mp->m_super->s_dev; |
| 699 | ), |
| 700 | TP_printk("dev %d:%d", |
| 701 | MAJOR(__entry->dev), MINOR(__entry->dev)) |
| 702 | ) |
| 703 | |
| 704 | TRACE_EVENT(xfs_repair_ialloc_insert, |
| 705 | TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, |
| 706 | xfs_agino_t startino, uint16_t holemask, uint8_t count, |
| 707 | uint8_t freecount, uint64_t freemask), |
| 708 | TP_ARGS(mp, agno, startino, holemask, count, freecount, freemask), |
| 709 | TP_STRUCT__entry( |
| 710 | __field(dev_t, dev) |
| 711 | __field(xfs_agnumber_t, agno) |
| 712 | __field(xfs_agino_t, startino) |
| 713 | __field(uint16_t, holemask) |
| 714 | __field(uint8_t, count) |
| 715 | __field(uint8_t, freecount) |
| 716 | __field(uint64_t, freemask) |
| 717 | ), |
| 718 | TP_fast_assign( |
| 719 | __entry->dev = mp->m_super->s_dev; |
| 720 | __entry->agno = agno; |
| 721 | __entry->startino = startino; |
| 722 | __entry->holemask = holemask; |
| 723 | __entry->count = count; |
| 724 | __entry->freecount = freecount; |
| 725 | __entry->freemask = freemask; |
| 726 | ), |
| 727 | TP_printk("dev %d:%d agno %d startino %u holemask 0x%x count %u freecount %u freemask 0x%llx", |
| 728 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 729 | __entry->agno, |
| 730 | __entry->startino, |
| 731 | __entry->holemask, |
| 732 | __entry->count, |
| 733 | __entry->freecount, |
| 734 | __entry->freemask) |
| 735 | ) |
| 736 | |
| 737 | #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */ |
| 738 | |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 739 | #endif /* _TRACE_XFS_SCRUB_TRACE_H */ |
| 740 | |
| 741 | #undef TRACE_INCLUDE_PATH |
| 742 | #define TRACE_INCLUDE_PATH . |
| 743 | #define TRACE_INCLUDE_FILE scrub/trace |
| 744 | #include <trace/define_trace.h> |