Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM f2fs |
| 3 | |
| 4 | #if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_F2FS_H |
| 6 | |
| 7 | #include <linux/tracepoint.h> |
| 8 | |
| 9 | #define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev) |
| 10 | #define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 11 | |
| 12 | #define show_block_type(type) \ |
| 13 | __print_symbolic(type, \ |
| 14 | { NODE, "NODE" }, \ |
| 15 | { DATA, "DATA" }, \ |
| 16 | { META, "META" }, \ |
| 17 | { META_FLUSH, "META_FLUSH" }) |
| 18 | |
Jaegeuk Kim | a709f4a | 2013-11-24 14:42:23 +0900 | [diff] [blame] | 19 | #define F2FS_BIO_MASK(t) (t & (READA | WRITE_FLUSH_FUA)) |
| 20 | #define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO)) |
| 21 | |
| 22 | #define show_bio_type(type) show_bio_base(type), show_bio_extra(type) |
| 23 | |
| 24 | #define show_bio_base(type) \ |
| 25 | __print_symbolic(F2FS_BIO_MASK(type), \ |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 26 | { READ, "READ" }, \ |
| 27 | { READA, "READAHEAD" }, \ |
| 28 | { READ_SYNC, "READ_SYNC" }, \ |
| 29 | { WRITE, "WRITE" }, \ |
| 30 | { WRITE_SYNC, "WRITE_SYNC" }, \ |
| 31 | { WRITE_FLUSH, "WRITE_FLUSH" }, \ |
| 32 | { WRITE_FUA, "WRITE_FUA" }, \ |
| 33 | { WRITE_FLUSH_FUA, "WRITE_FLUSH_FUA" }) |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 34 | |
Jaegeuk Kim | a709f4a | 2013-11-24 14:42:23 +0900 | [diff] [blame] | 35 | #define show_bio_extra(type) \ |
| 36 | __print_symbolic(F2FS_BIO_EXTRA_MASK(type), \ |
| 37 | { REQ_META, "(M)" }, \ |
| 38 | { REQ_PRIO, "(P)" }, \ |
| 39 | { REQ_META | REQ_PRIO, "(MP)" }, \ |
| 40 | { 0, " \b" }) |
| 41 | |
Namjae Jeon | 8e46b3e | 2013-04-23 16:42:53 +0900 | [diff] [blame] | 42 | #define show_data_type(type) \ |
| 43 | __print_symbolic(type, \ |
| 44 | { CURSEG_HOT_DATA, "Hot DATA" }, \ |
| 45 | { CURSEG_WARM_DATA, "Warm DATA" }, \ |
| 46 | { CURSEG_COLD_DATA, "Cold DATA" }, \ |
| 47 | { CURSEG_HOT_NODE, "Hot NODE" }, \ |
| 48 | { CURSEG_WARM_NODE, "Warm NODE" }, \ |
| 49 | { CURSEG_COLD_NODE, "Cold NODE" }, \ |
| 50 | { NO_CHECK_TYPE, "No TYPE" }) |
| 51 | |
Jaegeuk Kim | 26c6b88 | 2013-10-24 17:53:29 +0900 | [diff] [blame] | 52 | #define show_file_type(type) \ |
| 53 | __print_symbolic(type, \ |
| 54 | { 0, "FILE" }, \ |
| 55 | { 1, "DIR" }) |
| 56 | |
Namjae Jeon | 8e46b3e | 2013-04-23 16:42:53 +0900 | [diff] [blame] | 57 | #define show_gc_type(type) \ |
| 58 | __print_symbolic(type, \ |
| 59 | { FG_GC, "Foreground GC" }, \ |
| 60 | { BG_GC, "Background GC" }) |
| 61 | |
| 62 | #define show_alloc_mode(type) \ |
| 63 | __print_symbolic(type, \ |
| 64 | { LFS, "LFS-mode" }, \ |
| 65 | { SSR, "SSR-mode" }) |
| 66 | |
| 67 | #define show_victim_policy(type) \ |
| 68 | __print_symbolic(type, \ |
| 69 | { GC_GREEDY, "Greedy" }, \ |
| 70 | { GC_CB, "Cost-Benefit" }) |
| 71 | |
| 72 | struct victim_sel_policy; |
| 73 | |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 74 | DECLARE_EVENT_CLASS(f2fs__inode, |
| 75 | |
| 76 | TP_PROTO(struct inode *inode), |
| 77 | |
| 78 | TP_ARGS(inode), |
| 79 | |
| 80 | TP_STRUCT__entry( |
| 81 | __field(dev_t, dev) |
| 82 | __field(ino_t, ino) |
| 83 | __field(ino_t, pino) |
| 84 | __field(umode_t, mode) |
| 85 | __field(loff_t, size) |
| 86 | __field(unsigned int, nlink) |
| 87 | __field(blkcnt_t, blocks) |
| 88 | __field(__u8, advise) |
| 89 | ), |
| 90 | |
| 91 | TP_fast_assign( |
| 92 | __entry->dev = inode->i_sb->s_dev; |
| 93 | __entry->ino = inode->i_ino; |
| 94 | __entry->pino = F2FS_I(inode)->i_pino; |
| 95 | __entry->mode = inode->i_mode; |
| 96 | __entry->nlink = inode->i_nlink; |
| 97 | __entry->size = inode->i_size; |
| 98 | __entry->blocks = inode->i_blocks; |
| 99 | __entry->advise = F2FS_I(inode)->i_advise; |
| 100 | ), |
| 101 | |
| 102 | TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, " |
| 103 | "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x", |
| 104 | show_dev_ino(__entry), |
| 105 | (unsigned long)__entry->pino, |
| 106 | __entry->mode, |
| 107 | __entry->size, |
| 108 | (unsigned int)__entry->nlink, |
| 109 | (unsigned long long)__entry->blocks, |
| 110 | (unsigned char)__entry->advise) |
| 111 | ); |
| 112 | |
| 113 | DECLARE_EVENT_CLASS(f2fs__inode_exit, |
| 114 | |
| 115 | TP_PROTO(struct inode *inode, int ret), |
| 116 | |
| 117 | TP_ARGS(inode, ret), |
| 118 | |
| 119 | TP_STRUCT__entry( |
| 120 | __field(dev_t, dev) |
| 121 | __field(ino_t, ino) |
| 122 | __field(int, ret) |
| 123 | ), |
| 124 | |
| 125 | TP_fast_assign( |
| 126 | __entry->dev = inode->i_sb->s_dev; |
| 127 | __entry->ino = inode->i_ino; |
| 128 | __entry->ret = ret; |
| 129 | ), |
| 130 | |
| 131 | TP_printk("dev = (%d,%d), ino = %lu, ret = %d", |
| 132 | show_dev_ino(__entry), |
| 133 | __entry->ret) |
| 134 | ); |
| 135 | |
| 136 | DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter, |
| 137 | |
| 138 | TP_PROTO(struct inode *inode), |
| 139 | |
| 140 | TP_ARGS(inode) |
| 141 | ); |
| 142 | |
| 143 | TRACE_EVENT(f2fs_sync_file_exit, |
| 144 | |
| 145 | TP_PROTO(struct inode *inode, bool need_cp, int datasync, int ret), |
| 146 | |
| 147 | TP_ARGS(inode, need_cp, datasync, ret), |
| 148 | |
| 149 | TP_STRUCT__entry( |
| 150 | __field(dev_t, dev) |
| 151 | __field(ino_t, ino) |
| 152 | __field(bool, need_cp) |
| 153 | __field(int, datasync) |
| 154 | __field(int, ret) |
| 155 | ), |
| 156 | |
| 157 | TP_fast_assign( |
| 158 | __entry->dev = inode->i_sb->s_dev; |
| 159 | __entry->ino = inode->i_ino; |
| 160 | __entry->need_cp = need_cp; |
| 161 | __entry->datasync = datasync; |
| 162 | __entry->ret = ret; |
| 163 | ), |
| 164 | |
| 165 | TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, " |
| 166 | "datasync = %d, ret = %d", |
| 167 | show_dev_ino(__entry), |
| 168 | __entry->need_cp ? "needed" : "not needed", |
| 169 | __entry->datasync, |
| 170 | __entry->ret) |
| 171 | ); |
| 172 | |
| 173 | TRACE_EVENT(f2fs_sync_fs, |
| 174 | |
| 175 | TP_PROTO(struct super_block *sb, int wait), |
| 176 | |
| 177 | TP_ARGS(sb, wait), |
| 178 | |
| 179 | TP_STRUCT__entry( |
| 180 | __field(dev_t, dev) |
| 181 | __field(int, dirty) |
| 182 | __field(int, wait) |
| 183 | ), |
| 184 | |
| 185 | TP_fast_assign( |
| 186 | __entry->dev = sb->s_dev; |
| 187 | __entry->dirty = F2FS_SB(sb)->s_dirty; |
| 188 | __entry->wait = wait; |
| 189 | ), |
| 190 | |
| 191 | TP_printk("dev = (%d,%d), superblock is %s, wait = %d", |
| 192 | show_dev(__entry), |
| 193 | __entry->dirty ? "dirty" : "not dirty", |
| 194 | __entry->wait) |
| 195 | ); |
| 196 | |
| 197 | DEFINE_EVENT(f2fs__inode, f2fs_iget, |
| 198 | |
| 199 | TP_PROTO(struct inode *inode), |
| 200 | |
| 201 | TP_ARGS(inode) |
| 202 | ); |
| 203 | |
| 204 | DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit, |
| 205 | |
| 206 | TP_PROTO(struct inode *inode, int ret), |
| 207 | |
| 208 | TP_ARGS(inode, ret) |
| 209 | ); |
| 210 | |
| 211 | DEFINE_EVENT(f2fs__inode, f2fs_evict_inode, |
| 212 | |
| 213 | TP_PROTO(struct inode *inode), |
| 214 | |
| 215 | TP_ARGS(inode) |
| 216 | ); |
| 217 | |
Jaegeuk Kim | d70b4f5 | 2013-04-25 13:24:33 +0900 | [diff] [blame] | 218 | DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode, |
| 219 | |
| 220 | TP_PROTO(struct inode *inode, int ret), |
| 221 | |
| 222 | TP_ARGS(inode, ret) |
| 223 | ); |
| 224 | |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 225 | TRACE_EVENT(f2fs_unlink_enter, |
| 226 | |
| 227 | TP_PROTO(struct inode *dir, struct dentry *dentry), |
| 228 | |
| 229 | TP_ARGS(dir, dentry), |
| 230 | |
| 231 | TP_STRUCT__entry( |
| 232 | __field(dev_t, dev) |
| 233 | __field(ino_t, ino) |
| 234 | __field(loff_t, size) |
| 235 | __field(blkcnt_t, blocks) |
| 236 | __field(const char *, name) |
| 237 | ), |
| 238 | |
| 239 | TP_fast_assign( |
| 240 | __entry->dev = dir->i_sb->s_dev; |
| 241 | __entry->ino = dir->i_ino; |
| 242 | __entry->size = dir->i_size; |
| 243 | __entry->blocks = dir->i_blocks; |
| 244 | __entry->name = dentry->d_name.name; |
| 245 | ), |
| 246 | |
| 247 | TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, " |
| 248 | "i_blocks = %llu, name = %s", |
| 249 | show_dev_ino(__entry), |
| 250 | __entry->size, |
| 251 | (unsigned long long)__entry->blocks, |
| 252 | __entry->name) |
| 253 | ); |
| 254 | |
| 255 | DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit, |
| 256 | |
| 257 | TP_PROTO(struct inode *inode, int ret), |
| 258 | |
| 259 | TP_ARGS(inode, ret) |
| 260 | ); |
Namjae Jeon | 51dd624 | 2013-04-20 01:28:52 +0900 | [diff] [blame] | 261 | |
| 262 | DEFINE_EVENT(f2fs__inode, f2fs_truncate, |
| 263 | |
| 264 | TP_PROTO(struct inode *inode), |
| 265 | |
| 266 | TP_ARGS(inode) |
| 267 | ); |
| 268 | |
| 269 | TRACE_EVENT(f2fs_truncate_data_blocks_range, |
| 270 | |
| 271 | TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free), |
| 272 | |
| 273 | TP_ARGS(inode, nid, ofs, free), |
| 274 | |
| 275 | TP_STRUCT__entry( |
| 276 | __field(dev_t, dev) |
| 277 | __field(ino_t, ino) |
| 278 | __field(nid_t, nid) |
| 279 | __field(unsigned int, ofs) |
| 280 | __field(int, free) |
| 281 | ), |
| 282 | |
| 283 | TP_fast_assign( |
| 284 | __entry->dev = inode->i_sb->s_dev; |
| 285 | __entry->ino = inode->i_ino; |
| 286 | __entry->nid = nid; |
| 287 | __entry->ofs = ofs; |
| 288 | __entry->free = free; |
| 289 | ), |
| 290 | |
| 291 | TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d", |
| 292 | show_dev_ino(__entry), |
| 293 | (unsigned int)__entry->nid, |
| 294 | __entry->ofs, |
| 295 | __entry->free) |
| 296 | ); |
| 297 | |
| 298 | DECLARE_EVENT_CLASS(f2fs__truncate_op, |
| 299 | |
| 300 | TP_PROTO(struct inode *inode, u64 from), |
| 301 | |
| 302 | TP_ARGS(inode, from), |
| 303 | |
| 304 | TP_STRUCT__entry( |
| 305 | __field(dev_t, dev) |
| 306 | __field(ino_t, ino) |
| 307 | __field(loff_t, size) |
| 308 | __field(blkcnt_t, blocks) |
| 309 | __field(u64, from) |
| 310 | ), |
| 311 | |
| 312 | TP_fast_assign( |
| 313 | __entry->dev = inode->i_sb->s_dev; |
| 314 | __entry->ino = inode->i_ino; |
| 315 | __entry->size = inode->i_size; |
| 316 | __entry->blocks = inode->i_blocks; |
| 317 | __entry->from = from; |
| 318 | ), |
| 319 | |
| 320 | TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, " |
| 321 | "start file offset = %llu", |
| 322 | show_dev_ino(__entry), |
| 323 | __entry->size, |
| 324 | (unsigned long long)__entry->blocks, |
| 325 | (unsigned long long)__entry->from) |
| 326 | ); |
| 327 | |
| 328 | DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter, |
| 329 | |
| 330 | TP_PROTO(struct inode *inode, u64 from), |
| 331 | |
| 332 | TP_ARGS(inode, from) |
| 333 | ); |
| 334 | |
| 335 | DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit, |
| 336 | |
| 337 | TP_PROTO(struct inode *inode, int ret), |
| 338 | |
| 339 | TP_ARGS(inode, ret) |
| 340 | ); |
| 341 | |
| 342 | DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter, |
| 343 | |
| 344 | TP_PROTO(struct inode *inode, u64 from), |
| 345 | |
| 346 | TP_ARGS(inode, from) |
| 347 | ); |
| 348 | |
| 349 | DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit, |
| 350 | |
| 351 | TP_PROTO(struct inode *inode, int ret), |
| 352 | |
| 353 | TP_ARGS(inode, ret) |
| 354 | ); |
| 355 | |
| 356 | DECLARE_EVENT_CLASS(f2fs__truncate_node, |
| 357 | |
| 358 | TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), |
| 359 | |
| 360 | TP_ARGS(inode, nid, blk_addr), |
| 361 | |
| 362 | TP_STRUCT__entry( |
| 363 | __field(dev_t, dev) |
| 364 | __field(ino_t, ino) |
| 365 | __field(nid_t, nid) |
| 366 | __field(block_t, blk_addr) |
| 367 | ), |
| 368 | |
| 369 | TP_fast_assign( |
| 370 | __entry->dev = inode->i_sb->s_dev; |
| 371 | __entry->ino = inode->i_ino; |
| 372 | __entry->nid = nid; |
| 373 | __entry->blk_addr = blk_addr; |
| 374 | ), |
| 375 | |
| 376 | TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx", |
| 377 | show_dev_ino(__entry), |
| 378 | (unsigned int)__entry->nid, |
| 379 | (unsigned long long)__entry->blk_addr) |
| 380 | ); |
| 381 | |
| 382 | DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter, |
| 383 | |
| 384 | TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), |
| 385 | |
| 386 | TP_ARGS(inode, nid, blk_addr) |
| 387 | ); |
| 388 | |
| 389 | DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit, |
| 390 | |
| 391 | TP_PROTO(struct inode *inode, int ret), |
| 392 | |
| 393 | TP_ARGS(inode, ret) |
| 394 | ); |
| 395 | |
| 396 | DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node, |
| 397 | |
| 398 | TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), |
| 399 | |
| 400 | TP_ARGS(inode, nid, blk_addr) |
| 401 | ); |
| 402 | |
| 403 | TRACE_EVENT(f2fs_truncate_partial_nodes, |
| 404 | |
| 405 | TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err), |
| 406 | |
| 407 | TP_ARGS(inode, nid, depth, err), |
| 408 | |
| 409 | TP_STRUCT__entry( |
| 410 | __field(dev_t, dev) |
| 411 | __field(ino_t, ino) |
| 412 | __field(nid_t, nid[3]) |
| 413 | __field(int, depth) |
| 414 | __field(int, err) |
| 415 | ), |
| 416 | |
| 417 | TP_fast_assign( |
| 418 | __entry->dev = inode->i_sb->s_dev; |
| 419 | __entry->ino = inode->i_ino; |
| 420 | __entry->nid[0] = nid[0]; |
| 421 | __entry->nid[1] = nid[1]; |
| 422 | __entry->nid[2] = nid[2]; |
| 423 | __entry->depth = depth; |
| 424 | __entry->err = err; |
| 425 | ), |
| 426 | |
| 427 | TP_printk("dev = (%d,%d), ino = %lu, " |
| 428 | "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d", |
| 429 | show_dev_ino(__entry), |
| 430 | (unsigned int)__entry->nid[0], |
| 431 | (unsigned int)__entry->nid[1], |
| 432 | (unsigned int)__entry->nid[2], |
| 433 | __entry->depth, |
| 434 | __entry->err) |
| 435 | ); |
| 436 | |
Jaegeuk Kim | 93dfe2a | 2013-11-30 12:51:14 +0900 | [diff] [blame] | 437 | TRACE_EVENT_CONDITION(f2fs_submit_page_bio, |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 438 | |
| 439 | TP_PROTO(struct page *page, sector_t blkaddr, int type), |
| 440 | |
| 441 | TP_ARGS(page, blkaddr, type), |
| 442 | |
| 443 | TP_CONDITION(page->mapping), |
| 444 | |
| 445 | TP_STRUCT__entry( |
| 446 | __field(dev_t, dev) |
| 447 | __field(ino_t, ino) |
| 448 | __field(pgoff_t, index) |
| 449 | __field(sector_t, blkaddr) |
| 450 | __field(int, type) |
| 451 | ), |
| 452 | |
| 453 | TP_fast_assign( |
| 454 | __entry->dev = page->mapping->host->i_sb->s_dev; |
| 455 | __entry->ino = page->mapping->host->i_ino; |
| 456 | __entry->index = page->index; |
| 457 | __entry->blkaddr = blkaddr; |
| 458 | __entry->type = type; |
| 459 | ), |
| 460 | |
| 461 | TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, " |
Jaegeuk Kim | a709f4a | 2013-11-24 14:42:23 +0900 | [diff] [blame] | 462 | "blkaddr = 0x%llx, bio_type = %s%s", |
Namjae Jeon | 848753a | 2013-04-23 16:38:02 +0900 | [diff] [blame] | 463 | show_dev_ino(__entry), |
| 464 | (unsigned long)__entry->index, |
| 465 | (unsigned long long)__entry->blkaddr, |
| 466 | show_bio_type(__entry->type)) |
| 467 | ); |
| 468 | |
| 469 | TRACE_EVENT(f2fs_get_data_block, |
| 470 | TP_PROTO(struct inode *inode, sector_t iblock, |
| 471 | struct buffer_head *bh, int ret), |
| 472 | |
| 473 | TP_ARGS(inode, iblock, bh, ret), |
| 474 | |
| 475 | TP_STRUCT__entry( |
| 476 | __field(dev_t, dev) |
| 477 | __field(ino_t, ino) |
| 478 | __field(sector_t, iblock) |
| 479 | __field(sector_t, bh_start) |
| 480 | __field(size_t, bh_size) |
| 481 | __field(int, ret) |
| 482 | ), |
| 483 | |
| 484 | TP_fast_assign( |
| 485 | __entry->dev = inode->i_sb->s_dev; |
| 486 | __entry->ino = inode->i_ino; |
| 487 | __entry->iblock = iblock; |
| 488 | __entry->bh_start = bh->b_blocknr; |
| 489 | __entry->bh_size = bh->b_size; |
| 490 | __entry->ret = ret; |
| 491 | ), |
| 492 | |
| 493 | TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, " |
| 494 | "start blkaddr = 0x%llx, len = 0x%llx bytes, err = %d", |
| 495 | show_dev_ino(__entry), |
| 496 | (unsigned long long)__entry->iblock, |
| 497 | (unsigned long long)__entry->bh_start, |
| 498 | (unsigned long long)__entry->bh_size, |
| 499 | __entry->ret) |
| 500 | ); |
| 501 | |
Namjae Jeon | 8e46b3e | 2013-04-23 16:42:53 +0900 | [diff] [blame] | 502 | TRACE_EVENT(f2fs_get_victim, |
| 503 | |
| 504 | TP_PROTO(struct super_block *sb, int type, int gc_type, |
| 505 | struct victim_sel_policy *p, unsigned int pre_victim, |
| 506 | unsigned int prefree, unsigned int free), |
| 507 | |
| 508 | TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free), |
| 509 | |
| 510 | TP_STRUCT__entry( |
| 511 | __field(dev_t, dev) |
| 512 | __field(int, type) |
| 513 | __field(int, gc_type) |
| 514 | __field(int, alloc_mode) |
| 515 | __field(int, gc_mode) |
| 516 | __field(unsigned int, victim) |
| 517 | __field(unsigned int, ofs_unit) |
| 518 | __field(unsigned int, pre_victim) |
| 519 | __field(unsigned int, prefree) |
| 520 | __field(unsigned int, free) |
| 521 | ), |
| 522 | |
| 523 | TP_fast_assign( |
| 524 | __entry->dev = sb->s_dev; |
| 525 | __entry->type = type; |
| 526 | __entry->gc_type = gc_type; |
| 527 | __entry->alloc_mode = p->alloc_mode; |
| 528 | __entry->gc_mode = p->gc_mode; |
| 529 | __entry->victim = p->min_segno; |
| 530 | __entry->ofs_unit = p->ofs_unit; |
| 531 | __entry->pre_victim = pre_victim; |
| 532 | __entry->prefree = prefree; |
| 533 | __entry->free = free; |
| 534 | ), |
| 535 | |
| 536 | TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u " |
| 537 | "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u", |
| 538 | show_dev(__entry), |
| 539 | show_data_type(__entry->type), |
| 540 | show_gc_type(__entry->gc_type), |
| 541 | show_alloc_mode(__entry->alloc_mode), |
| 542 | show_victim_policy(__entry->gc_mode), |
| 543 | __entry->victim, |
| 544 | __entry->ofs_unit, |
| 545 | (int)__entry->pre_victim, |
| 546 | __entry->prefree, |
| 547 | __entry->free) |
| 548 | ); |
| 549 | |
Namjae Jeon | c01e285 | 2013-04-23 17:00:52 +0900 | [diff] [blame] | 550 | TRACE_EVENT(f2fs_fallocate, |
| 551 | |
| 552 | TP_PROTO(struct inode *inode, int mode, |
| 553 | loff_t offset, loff_t len, int ret), |
| 554 | |
| 555 | TP_ARGS(inode, mode, offset, len, ret), |
| 556 | |
| 557 | TP_STRUCT__entry( |
| 558 | __field(dev_t, dev) |
| 559 | __field(ino_t, ino) |
| 560 | __field(int, mode) |
| 561 | __field(loff_t, offset) |
| 562 | __field(loff_t, len) |
| 563 | __field(loff_t, size) |
| 564 | __field(blkcnt_t, blocks) |
| 565 | __field(int, ret) |
| 566 | ), |
| 567 | |
| 568 | TP_fast_assign( |
| 569 | __entry->dev = inode->i_sb->s_dev; |
| 570 | __entry->ino = inode->i_ino; |
| 571 | __entry->mode = mode; |
| 572 | __entry->offset = offset; |
| 573 | __entry->len = len; |
| 574 | __entry->size = inode->i_size; |
| 575 | __entry->blocks = inode->i_blocks; |
| 576 | __entry->ret = ret; |
| 577 | ), |
| 578 | |
| 579 | TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, " |
| 580 | "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d", |
| 581 | show_dev_ino(__entry), |
| 582 | __entry->mode, |
| 583 | (unsigned long long)__entry->offset, |
| 584 | (unsigned long long)__entry->len, |
| 585 | (unsigned long long)__entry->size, |
| 586 | (unsigned long long)__entry->blocks, |
| 587 | __entry->ret) |
| 588 | ); |
| 589 | |
| 590 | TRACE_EVENT(f2fs_reserve_new_block, |
| 591 | |
| 592 | TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node), |
| 593 | |
| 594 | TP_ARGS(inode, nid, ofs_in_node), |
| 595 | |
| 596 | TP_STRUCT__entry( |
| 597 | __field(dev_t, dev) |
| 598 | __field(nid_t, nid) |
| 599 | __field(unsigned int, ofs_in_node) |
| 600 | ), |
| 601 | |
| 602 | TP_fast_assign( |
| 603 | __entry->dev = inode->i_sb->s_dev; |
| 604 | __entry->nid = nid; |
| 605 | __entry->ofs_in_node = ofs_in_node; |
| 606 | ), |
| 607 | |
| 608 | TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u", |
| 609 | show_dev(__entry), |
| 610 | (unsigned int)__entry->nid, |
| 611 | __entry->ofs_in_node) |
| 612 | ); |
| 613 | |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 614 | DECLARE_EVENT_CLASS(f2fs__submit_bio, |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 615 | |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 616 | TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio), |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 617 | |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 618 | TP_ARGS(sb, rw, type, bio), |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 619 | |
| 620 | TP_STRUCT__entry( |
| 621 | __field(dev_t, dev) |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 622 | __field(int, rw) |
| 623 | __field(int, type) |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 624 | __field(sector_t, sector) |
| 625 | __field(unsigned int, size) |
| 626 | ), |
| 627 | |
| 628 | TP_fast_assign( |
| 629 | __entry->dev = sb->s_dev; |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 630 | __entry->rw = rw; |
| 631 | __entry->type = type; |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 632 | __entry->sector = bio->bi_iter.bi_sector; |
| 633 | __entry->size = bio->bi_iter.bi_size; |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 634 | ), |
| 635 | |
Jaegeuk Kim | a709f4a | 2013-11-24 14:42:23 +0900 | [diff] [blame] | 636 | TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u", |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 637 | show_dev(__entry), |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 638 | show_bio_type(__entry->rw), |
| 639 | show_block_type(__entry->type), |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 640 | (unsigned long long)__entry->sector, |
| 641 | __entry->size) |
| 642 | ); |
| 643 | |
Jaegeuk Kim | 93dfe2a | 2013-11-30 12:51:14 +0900 | [diff] [blame] | 644 | DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_write_bio, |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 645 | |
| 646 | TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio), |
| 647 | |
Jaegeuk Kim | 93dfe2a | 2013-11-30 12:51:14 +0900 | [diff] [blame] | 648 | TP_ARGS(sb, rw, type, bio), |
| 649 | |
| 650 | TP_CONDITION(bio) |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 651 | ); |
| 652 | |
Jaegeuk Kim | 93dfe2a | 2013-11-30 12:51:14 +0900 | [diff] [blame] | 653 | DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio, |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 654 | |
| 655 | TP_PROTO(struct super_block *sb, int rw, int type, struct bio *bio), |
| 656 | |
Jaegeuk Kim | 93dfe2a | 2013-11-30 12:51:14 +0900 | [diff] [blame] | 657 | TP_ARGS(sb, rw, type, bio), |
| 658 | |
| 659 | TP_CONDITION(bio) |
Chao Yu | d4d288b | 2013-11-24 12:36:42 +0900 | [diff] [blame] | 660 | ); |
| 661 | |
Chao Yu | 62aed04 | 2014-05-06 16:46:04 +0800 | [diff] [blame] | 662 | TRACE_EVENT(f2fs_write_begin, |
| 663 | |
| 664 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 665 | unsigned int flags), |
| 666 | |
| 667 | TP_ARGS(inode, pos, len, flags), |
| 668 | |
| 669 | TP_STRUCT__entry( |
| 670 | __field(dev_t, dev) |
| 671 | __field(ino_t, ino) |
| 672 | __field(loff_t, pos) |
| 673 | __field(unsigned int, len) |
| 674 | __field(unsigned int, flags) |
| 675 | ), |
| 676 | |
| 677 | TP_fast_assign( |
| 678 | __entry->dev = inode->i_sb->s_dev; |
| 679 | __entry->ino = inode->i_ino; |
| 680 | __entry->pos = pos; |
| 681 | __entry->len = len; |
| 682 | __entry->flags = flags; |
| 683 | ), |
| 684 | |
| 685 | TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u", |
| 686 | show_dev_ino(__entry), |
| 687 | (unsigned long long)__entry->pos, |
| 688 | __entry->len, |
| 689 | __entry->flags) |
| 690 | ); |
| 691 | |
Chao Yu | dfb2bf3 | 2014-05-06 16:47:23 +0800 | [diff] [blame] | 692 | TRACE_EVENT(f2fs_write_end, |
| 693 | |
| 694 | TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, |
| 695 | unsigned int copied), |
| 696 | |
| 697 | TP_ARGS(inode, pos, len, copied), |
| 698 | |
| 699 | TP_STRUCT__entry( |
| 700 | __field(dev_t, dev) |
| 701 | __field(ino_t, ino) |
| 702 | __field(loff_t, pos) |
| 703 | __field(unsigned int, len) |
| 704 | __field(unsigned int, copied) |
| 705 | ), |
| 706 | |
| 707 | TP_fast_assign( |
| 708 | __entry->dev = inode->i_sb->s_dev; |
| 709 | __entry->ino = inode->i_ino; |
| 710 | __entry->pos = pos; |
| 711 | __entry->len = len; |
| 712 | __entry->copied = copied; |
| 713 | ), |
| 714 | |
| 715 | TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u", |
| 716 | show_dev_ino(__entry), |
| 717 | (unsigned long long)__entry->pos, |
| 718 | __entry->len, |
| 719 | __entry->copied) |
| 720 | ); |
| 721 | |
Jaegeuk Kim | 26c6b88 | 2013-10-24 17:53:29 +0900 | [diff] [blame] | 722 | DECLARE_EVENT_CLASS(f2fs__page, |
| 723 | |
| 724 | TP_PROTO(struct page *page, int type), |
| 725 | |
| 726 | TP_ARGS(page, type), |
| 727 | |
| 728 | TP_STRUCT__entry( |
| 729 | __field(dev_t, dev) |
| 730 | __field(ino_t, ino) |
| 731 | __field(int, type) |
| 732 | __field(int, dir) |
| 733 | __field(pgoff_t, index) |
| 734 | __field(int, dirty) |
| 735 | ), |
| 736 | |
| 737 | TP_fast_assign( |
| 738 | __entry->dev = page->mapping->host->i_sb->s_dev; |
| 739 | __entry->ino = page->mapping->host->i_ino; |
| 740 | __entry->type = type; |
| 741 | __entry->dir = S_ISDIR(page->mapping->host->i_mode); |
| 742 | __entry->index = page->index; |
| 743 | __entry->dirty = PageDirty(page); |
| 744 | ), |
| 745 | |
| 746 | TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, dirty = %d", |
| 747 | show_dev_ino(__entry), |
| 748 | show_block_type(__entry->type), |
| 749 | show_file_type(__entry->dir), |
| 750 | (unsigned long)__entry->index, |
| 751 | __entry->dirty) |
| 752 | ); |
| 753 | |
Chao Yu | ecda0de | 2014-05-06 16:48:26 +0800 | [diff] [blame^] | 754 | DEFINE_EVENT(f2fs__page, f2fs_writepage, |
| 755 | |
| 756 | TP_PROTO(struct page *page, int type), |
| 757 | |
| 758 | TP_ARGS(page, type) |
| 759 | ); |
| 760 | |
Jaegeuk Kim | 26c6b88 | 2013-10-24 17:53:29 +0900 | [diff] [blame] | 761 | DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty, |
| 762 | |
| 763 | TP_PROTO(struct page *page, int type), |
| 764 | |
| 765 | TP_ARGS(page, type) |
| 766 | ); |
| 767 | |
Jaegeuk Kim | e943a10 | 2013-10-25 14:26:31 +0900 | [diff] [blame] | 768 | DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite, |
| 769 | |
| 770 | TP_PROTO(struct page *page, int type), |
| 771 | |
| 772 | TP_ARGS(page, type) |
| 773 | ); |
| 774 | |
Jaegeuk Kim | 93dfe2a | 2013-11-30 12:51:14 +0900 | [diff] [blame] | 775 | TRACE_EVENT(f2fs_submit_page_mbio, |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 776 | |
Chao Yu | 87b8872 | 2013-11-20 16:40:10 +0800 | [diff] [blame] | 777 | TP_PROTO(struct page *page, int rw, int type, block_t blk_addr), |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 778 | |
Chao Yu | 87b8872 | 2013-11-20 16:40:10 +0800 | [diff] [blame] | 779 | TP_ARGS(page, rw, type, blk_addr), |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 780 | |
| 781 | TP_STRUCT__entry( |
| 782 | __field(dev_t, dev) |
| 783 | __field(ino_t, ino) |
Chao Yu | 87b8872 | 2013-11-20 16:40:10 +0800 | [diff] [blame] | 784 | __field(int, rw) |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 785 | __field(int, type) |
| 786 | __field(pgoff_t, index) |
| 787 | __field(block_t, block) |
| 788 | ), |
| 789 | |
| 790 | TP_fast_assign( |
| 791 | __entry->dev = page->mapping->host->i_sb->s_dev; |
| 792 | __entry->ino = page->mapping->host->i_ino; |
Chao Yu | 87b8872 | 2013-11-20 16:40:10 +0800 | [diff] [blame] | 793 | __entry->rw = rw; |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 794 | __entry->type = type; |
| 795 | __entry->index = page->index; |
| 796 | __entry->block = blk_addr; |
| 797 | ), |
| 798 | |
Jaegeuk Kim | a709f4a | 2013-11-24 14:42:23 +0900 | [diff] [blame] | 799 | TP_printk("dev = (%d,%d), ino = %lu, %s%s, %s, index = %lu, blkaddr = 0x%llx", |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 800 | show_dev_ino(__entry), |
Chao Yu | 87b8872 | 2013-11-20 16:40:10 +0800 | [diff] [blame] | 801 | show_bio_type(__entry->rw), |
Namjae Jeon | 6ec178d | 2013-04-23 17:51:43 +0900 | [diff] [blame] | 802 | show_block_type(__entry->type), |
| 803 | (unsigned long)__entry->index, |
| 804 | (unsigned long long)__entry->block) |
| 805 | ); |
| 806 | |
Namjae Jeon | 2af4bd6 | 2013-04-23 18:26:54 +0900 | [diff] [blame] | 807 | TRACE_EVENT(f2fs_write_checkpoint, |
| 808 | |
| 809 | TP_PROTO(struct super_block *sb, bool is_umount, char *msg), |
| 810 | |
| 811 | TP_ARGS(sb, is_umount, msg), |
| 812 | |
| 813 | TP_STRUCT__entry( |
| 814 | __field(dev_t, dev) |
| 815 | __field(bool, is_umount) |
| 816 | __field(char *, msg) |
| 817 | ), |
| 818 | |
| 819 | TP_fast_assign( |
| 820 | __entry->dev = sb->s_dev; |
| 821 | __entry->is_umount = is_umount; |
| 822 | __entry->msg = msg; |
| 823 | ), |
| 824 | |
| 825 | TP_printk("dev = (%d,%d), checkpoint for %s, state = %s", |
| 826 | show_dev(__entry), |
| 827 | __entry->is_umount ? "clean umount" : "consistency", |
| 828 | __entry->msg) |
| 829 | ); |
| 830 | |
Jaegeuk Kim | 1661d07 | 2013-11-12 17:01:00 +0900 | [diff] [blame] | 831 | TRACE_EVENT(f2fs_issue_discard, |
| 832 | |
| 833 | TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen), |
| 834 | |
| 835 | TP_ARGS(sb, blkstart, blklen), |
| 836 | |
| 837 | TP_STRUCT__entry( |
| 838 | __field(dev_t, dev) |
| 839 | __field(block_t, blkstart) |
| 840 | __field(block_t, blklen) |
| 841 | ), |
| 842 | |
| 843 | TP_fast_assign( |
| 844 | __entry->dev = sb->s_dev; |
| 845 | __entry->blkstart = blkstart; |
| 846 | __entry->blklen = blklen; |
| 847 | ), |
| 848 | |
| 849 | TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx", |
| 850 | show_dev(__entry), |
| 851 | (unsigned long long)__entry->blkstart, |
| 852 | (unsigned long long)__entry->blklen) |
| 853 | ); |
Namjae Jeon | a2a4a7e | 2013-04-20 01:28:40 +0900 | [diff] [blame] | 854 | #endif /* _TRACE_F2FS_H */ |
| 855 | |
| 856 | /* This part must be outside protection */ |
| 857 | #include <trace/define_trace.h> |