LCOV - code coverage report
Current view: top level - fs/iomap - trace.h (source / functions) Hit Total Coverage
Test: fstests of 6.5.0-rc3-achx @ Mon Jul 31 20:08:12 PDT 2023 Lines: 13 16 81.2 %
Date: 2023-07-31 20:08:12 Functions: 13 63 20.6 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: GPL-2.0 */
       2             : /*
       3             :  * Copyright (c) 2009-2021 Christoph Hellwig
       4             :  *
       5             :  * NOTE: none of these tracepoints shall be considered a stable kernel ABI
       6             :  * as they can change at any time.
       7             :  *
       8             :  * Current conventions for printing numbers measuring specific units:
       9             :  *
      10             :  * offset: byte offset into a subcomponent of a file operation
      11             :  * pos: file offset, in bytes
      12             :  * length: length of a file operation, in bytes
      13             :  * ino: inode number
      14             :  *
      15             :  * Numbers describing space allocations should be formatted in hexadecimal.
      16             :  */
      17             : #undef TRACE_SYSTEM
      18             : #define TRACE_SYSTEM iomap
      19             : 
      20             : #if !defined(_IOMAP_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
      21             : #define _IOMAP_TRACE_H
      22             : 
      23             : #include <linux/tracepoint.h>
      24             : 
      25             : struct inode;
      26             : 
      27           0 : DECLARE_EVENT_CLASS(iomap_readpage_class,
      28             :         TP_PROTO(struct inode *inode, int nr_pages),
      29             :         TP_ARGS(inode, nr_pages),
      30             :         TP_STRUCT__entry(
      31             :                 __field(dev_t, dev)
      32             :                 __field(u64, ino)
      33             :                 __field(int, nr_pages)
      34             :         ),
      35             :         TP_fast_assign(
      36             :                 __entry->dev = inode->i_sb->s_dev;
      37             :                 __entry->ino = inode->i_ino;
      38             :                 __entry->nr_pages = nr_pages;
      39             :         ),
      40             :         TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
      41             :                   MAJOR(__entry->dev), MINOR(__entry->dev),
      42             :                   __entry->ino,
      43             :                   __entry->nr_pages)
      44             : )
      45             : 
      46             : #define DEFINE_READPAGE_EVENT(name)             \
      47             : DEFINE_EVENT(iomap_readpage_class, name,        \
      48             :         TP_PROTO(struct inode *inode, int nr_pages), \
      49             :         TP_ARGS(inode, nr_pages))
      50  1648159949 : DEFINE_READPAGE_EVENT(iomap_readpage);
      51    38755064 : DEFINE_READPAGE_EVENT(iomap_readahead);
      52             : 
      53           0 : DECLARE_EVENT_CLASS(iomap_range_class,
      54             :         TP_PROTO(struct inode *inode, loff_t off, u64 len),
      55             :         TP_ARGS(inode, off, len),
      56             :         TP_STRUCT__entry(
      57             :                 __field(dev_t, dev)
      58             :                 __field(u64, ino)
      59             :                 __field(loff_t, size)
      60             :                 __field(loff_t, offset)
      61             :                 __field(u64, length)
      62             :         ),
      63             :         TP_fast_assign(
      64             :                 __entry->dev = inode->i_sb->s_dev;
      65             :                 __entry->ino = inode->i_ino;
      66             :                 __entry->size = i_size_read(inode);
      67             :                 __entry->offset = off;
      68             :                 __entry->length = len;
      69             :         ),
      70             :         TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx length 0x%llx",
      71             :                   MAJOR(__entry->dev), MINOR(__entry->dev),
      72             :                   __entry->ino,
      73             :                   __entry->size,
      74             :                   __entry->offset,
      75             :                   __entry->length)
      76             : )
      77             : 
      78             : #define DEFINE_RANGE_EVENT(name)                \
      79             : DEFINE_EVENT(iomap_range_class, name,   \
      80             :         TP_PROTO(struct inode *inode, loff_t off, u64 len),\
      81             :         TP_ARGS(inode, off, len))
      82   679990664 : DEFINE_RANGE_EVENT(iomap_writepage);
      83    19180484 : DEFINE_RANGE_EVENT(iomap_release_folio);
      84   117669332 : DEFINE_RANGE_EVENT(iomap_invalidate_folio);
      85         534 : DEFINE_RANGE_EVENT(iomap_dio_invalidate_fail);
      86     8071631 : DEFINE_RANGE_EVENT(iomap_dio_rw_queued);
      87             : 
      88             : #define IOMAP_TYPE_STRINGS \
      89             :         { IOMAP_HOLE,           "HOLE" }, \
      90             :         { IOMAP_DELALLOC,       "DELALLOC" }, \
      91             :         { IOMAP_MAPPED,         "MAPPED" }, \
      92             :         { IOMAP_UNWRITTEN,      "UNWRITTEN" }, \
      93             :         { IOMAP_INLINE,         "INLINE" }
      94             : 
      95             : #define IOMAP_FLAGS_STRINGS \
      96             :         { IOMAP_WRITE,          "WRITE" }, \
      97             :         { IOMAP_ZERO,           "ZERO" }, \
      98             :         { IOMAP_REPORT,         "REPORT" }, \
      99             :         { IOMAP_FAULT,          "FAULT" }, \
     100             :         { IOMAP_DIRECT,         "DIRECT" }, \
     101             :         { IOMAP_NOWAIT,         "NOWAIT" }
     102             : 
     103             : #define IOMAP_F_FLAGS_STRINGS \
     104             :         { IOMAP_F_NEW,          "NEW" }, \
     105             :         { IOMAP_F_DIRTY,        "DIRTY" }, \
     106             :         { IOMAP_F_SHARED,       "SHARED" }, \
     107             :         { IOMAP_F_MERGED,       "MERGED" }, \
     108             :         { IOMAP_F_BUFFER_HEAD,  "BH" }, \
     109             :         { IOMAP_F_SIZE_CHANGED, "SIZE_CHANGED" }
     110             : 
     111             : #define IOMAP_DIO_STRINGS \
     112             :         {IOMAP_DIO_FORCE_WAIT,  "DIO_FORCE_WAIT" }, \
     113             :         {IOMAP_DIO_OVERWRITE_ONLY, "DIO_OVERWRITE_ONLY" }, \
     114             :         {IOMAP_DIO_PARTIAL,     "DIO_PARTIAL" }
     115             : 
     116           0 : DECLARE_EVENT_CLASS(iomap_class,
     117             :         TP_PROTO(struct inode *inode, struct iomap *iomap),
     118             :         TP_ARGS(inode, iomap),
     119             :         TP_STRUCT__entry(
     120             :                 __field(dev_t, dev)
     121             :                 __field(u64, ino)
     122             :                 __field(u64, addr)
     123             :                 __field(loff_t, offset)
     124             :                 __field(u64, length)
     125             :                 __field(u16, type)
     126             :                 __field(u16, flags)
     127             :                 __field(dev_t, bdev)
     128             :         ),
     129             :         TP_fast_assign(
     130             :                 __entry->dev = inode->i_sb->s_dev;
     131             :                 __entry->ino = inode->i_ino;
     132             :                 __entry->addr = iomap->addr;
     133             :                 __entry->offset = iomap->offset;
     134             :                 __entry->length = iomap->length;
     135             :                 __entry->type = iomap->type;
     136             :                 __entry->flags = iomap->flags;
     137             :                 __entry->bdev = iomap->bdev ? iomap->bdev->bd_dev : 0;
     138             :         ),
     139             :         TP_printk("dev %d:%d ino 0x%llx bdev %d:%d addr 0x%llx offset 0x%llx "
     140             :                   "length 0x%llx type %s flags %s",
     141             :                   MAJOR(__entry->dev), MINOR(__entry->dev),
     142             :                   __entry->ino,
     143             :                   MAJOR(__entry->bdev), MINOR(__entry->bdev),
     144             :                   __entry->addr,
     145             :                   __entry->offset,
     146             :                   __entry->length,
     147             :                   __print_symbolic(__entry->type, IOMAP_TYPE_STRINGS),
     148             :                   __print_flags(__entry->flags, "|", IOMAP_F_FLAGS_STRINGS))
     149             : )
     150             : 
     151             : #define DEFINE_IOMAP_EVENT(name)                \
     152             : DEFINE_EVENT(iomap_class, name, \
     153             :         TP_PROTO(struct inode *inode, struct iomap *iomap), \
     154             :         TP_ARGS(inode, iomap))
     155  2257342301 : DEFINE_IOMAP_EVENT(iomap_iter_dstmap);
     156    13065604 : DEFINE_IOMAP_EVENT(iomap_iter_srcmap);
     157   725996484 : DEFINE_IOMAP_EVENT(iomap_writepage_map);
     158             : 
     159  4436133819 : TRACE_EVENT(iomap_iter,
     160             :         TP_PROTO(struct iomap_iter *iter, const void *ops,
     161             :                  unsigned long caller),
     162             :         TP_ARGS(iter, ops, caller),
     163             :         TP_STRUCT__entry(
     164             :                 __field(dev_t, dev)
     165             :                 __field(u64, ino)
     166             :                 __field(loff_t, pos)
     167             :                 __field(u64, length)
     168             :                 __field(unsigned int, flags)
     169             :                 __field(const void *, ops)
     170             :                 __field(unsigned long, caller)
     171             :         ),
     172             :         TP_fast_assign(
     173             :                 __entry->dev = iter->inode->i_sb->s_dev;
     174             :                 __entry->ino = iter->inode->i_ino;
     175             :                 __entry->pos = iter->pos;
     176             :                 __entry->length = iomap_length(iter);
     177             :                 __entry->flags = iter->flags;
     178             :                 __entry->ops = ops;
     179             :                 __entry->caller = caller;
     180             :         ),
     181             :         TP_printk("dev %d:%d ino 0x%llx pos 0x%llx length 0x%llx flags %s (0x%x) ops %ps caller %pS",
     182             :                   MAJOR(__entry->dev), MINOR(__entry->dev),
     183             :                    __entry->ino,
     184             :                    __entry->pos,
     185             :                    __entry->length,
     186             :                    __print_flags(__entry->flags, "|", IOMAP_FLAGS_STRINGS),
     187             :                    __entry->flags,
     188             :                    __entry->ops,
     189             :                    (void *)__entry->caller)
     190             : );
     191             : 
     192   558356951 : TRACE_EVENT(iomap_dio_rw_begin,
     193             :         TP_PROTO(struct kiocb *iocb, struct iov_iter *iter,
     194             :                  unsigned int dio_flags, size_t done_before),
     195             :         TP_ARGS(iocb, iter, dio_flags, done_before),
     196             :         TP_STRUCT__entry(
     197             :                 __field(dev_t,  dev)
     198             :                 __field(ino_t,  ino)
     199             :                 __field(loff_t, isize)
     200             :                 __field(loff_t, pos)
     201             :                 __field(size_t, count)
     202             :                 __field(size_t, done_before)
     203             :                 __field(int,    ki_flags)
     204             :                 __field(unsigned int,   dio_flags)
     205             :                 __field(bool,   aio)
     206             :         ),
     207             :         TP_fast_assign(
     208             :                 __entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
     209             :                 __entry->ino = file_inode(iocb->ki_filp)->i_ino;
     210             :                 __entry->isize = file_inode(iocb->ki_filp)->i_size;
     211             :                 __entry->pos = iocb->ki_pos;
     212             :                 __entry->count = iov_iter_count(iter);
     213             :                 __entry->done_before = done_before;
     214             :                 __entry->ki_flags = iocb->ki_flags;
     215             :                 __entry->dio_flags = dio_flags;
     216             :                 __entry->aio = !is_sync_kiocb(iocb);
     217             :         ),
     218             :         TP_printk("dev %d:%d ino 0x%lx size 0x%llx offset 0x%llx length 0x%zx done_before 0x%zx flags %s dio_flags %s aio %d",
     219             :                   MAJOR(__entry->dev), MINOR(__entry->dev),
     220             :                   __entry->ino,
     221             :                   __entry->isize,
     222             :                   __entry->pos,
     223             :                   __entry->count,
     224             :                   __entry->done_before,
     225             :                   __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS),
     226             :                   __print_flags(__entry->dio_flags, "|", IOMAP_DIO_STRINGS),
     227             :                   __entry->aio)
     228             : );
     229             : 
     230    35306954 : TRACE_EVENT(iomap_dio_complete,
     231             :         TP_PROTO(struct kiocb *iocb, int error, ssize_t ret),
     232             :         TP_ARGS(iocb, error, ret),
     233             :         TP_STRUCT__entry(
     234             :                 __field(dev_t,  dev)
     235             :                 __field(ino_t,  ino)
     236             :                 __field(loff_t, isize)
     237             :                 __field(loff_t, pos)
     238             :                 __field(int,    ki_flags)
     239             :                 __field(bool,   aio)
     240             :                 __field(int,    error)
     241             :                 __field(ssize_t, ret)
     242             :         ),
     243             :         TP_fast_assign(
     244             :                 __entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
     245             :                 __entry->ino = file_inode(iocb->ki_filp)->i_ino;
     246             :                 __entry->isize = file_inode(iocb->ki_filp)->i_size;
     247             :                 __entry->pos = iocb->ki_pos;
     248             :                 __entry->ki_flags = iocb->ki_flags;
     249             :                 __entry->aio = !is_sync_kiocb(iocb);
     250             :                 __entry->error = error;
     251             :                 __entry->ret = ret;
     252             :         ),
     253             :         TP_printk("dev %d:%d ino 0x%lx size 0x%llx offset 0x%llx flags %s aio %d error %d ret %zd",
     254             :                   MAJOR(__entry->dev), MINOR(__entry->dev),
     255             :                   __entry->ino,
     256             :                   __entry->isize,
     257             :                   __entry->pos,
     258             :                   __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS),
     259             :                   __entry->aio,
     260             :                   __entry->error,
     261             :                   __entry->ret)
     262             : );
     263             : 
     264             : #endif /* _IOMAP_TRACE_H */
     265             : 
     266             : #undef TRACE_INCLUDE_PATH
     267             : #define TRACE_INCLUDE_PATH .
     268             : #define TRACE_INCLUDE_FILE trace
     269             : #include <trace/define_trace.h>

Generated by: LCOV version 1.14