LCOV - code coverage report
Current view: top level - fs/xfs/scrub - trace.c (source / functions) Hit Total Coverage
Test: fstests of 6.5.0-rc3-acha @ Mon Jul 31 20:08:06 PDT 2023 Lines: 5 12 41.7 %
Date: 2023-07-31 20:08:07 Functions: 1 2 50.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0-or-later
       2             : /*
       3             :  * Copyright (C) 2017-2023 Oracle.  All Rights Reserved.
       4             :  * Author: Darrick J. Wong <djwong@kernel.org>
       5             :  */
       6             : #include "xfs.h"
       7             : #include "xfs_fs.h"
       8             : #include "xfs_shared.h"
       9             : #include "xfs_format.h"
      10             : #include "xfs_log_format.h"
      11             : #include "xfs_trans_resv.h"
      12             : #include "xfs_mount.h"
      13             : #include "xfs_inode.h"
      14             : #include "xfs_btree.h"
      15             : #include "xfs_btree_mem.h"
      16             : #include "xfs_ag.h"
      17             : #include "xfs_quota_defs.h"
      18             : #include "xfs_dir2.h"
      19             : #include "xfs_da_format.h"
      20             : #include "xfs_rmap.h"
      21             : #include "xfs_parent.h"
      22             : #include "scrub/scrub.h"
      23             : #include "scrub/xfile.h"
      24             : #include "scrub/xfarray.h"
      25             : #include "scrub/iscan.h"
      26             : #include "scrub/orphanage.h"
      27             : #include "scrub/nlinks.h"
      28             : #include "scrub/fscounters.h"
      29             : #include "scrub/xfbtree.h"
      30             : #include "scrub/bitmap.h"
      31             : #include "scrub/xfblob.h"
      32             : #include "scrub/dirtree.h"
      33             : 
      34             : /* Figure out which block the btree cursor was pointing to. */
      35             : static inline xfs_fsblock_t
      36           0 : xchk_btree_cur_fsbno(
      37             :         struct xfs_btree_cur    *cur,
      38             :         int                     level)
      39             : {
      40           0 :         if (level < cur->bc_nlevels && cur->bc_levels[level].bp)
      41           0 :                 return XFS_DADDR_TO_FSB(cur->bc_mp,
      42             :                                 xfs_buf_daddr(cur->bc_levels[level].bp));
      43             : 
      44           0 :         if (level == cur->bc_nlevels - 1 &&
      45           0 :             (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE))
      46           0 :                 return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino);
      47             : 
      48             :         return NULLFSBLOCK;
      49             : }
      50             : 
      51             : #ifdef CONFIG_XFS_BTREE_IN_XFILE
      52             : static inline unsigned long
      53             : xfbtree_ino(
      54             :         struct xfbtree          *xfbt)
      55             : {
      56           0 :         return file_inode(xfbt->target->bt_xfile->file)->i_ino;
      57             : }
      58             : #endif /* CONFIG_XFS_BTREE_IN_XFILE */
      59             : 
      60             : /*
      61             :  * We include this last to have the helpers above available for the trace
      62             :  * event implementations.
      63             :  */
      64             : #define CREATE_TRACE_POINTS
      65             : #include "scrub/trace.h"
      66             : 
      67             : /* xchk_whine stuff */
      68             : struct xchk_tstr {
      69             :         unsigned int    type;
      70             :         const char      *tag;
      71             : };
      72             : 
      73             : static const struct xchk_tstr xchk_tstr_tags[] = { XFS_SCRUB_TYPE_STRINGS };
      74             : 
      75             : const char *
      76       66624 : xchk_type_string(
      77             :         unsigned int    type)
      78             : {
      79       66624 :         unsigned int    i;
      80             : 
      81      804290 :         for (i = 0; i < ARRAY_SIZE(xchk_tstr_tags); i++) {
      82      804290 :                 if (xchk_tstr_tags[i].type == type)
      83       66624 :                         return xchk_tstr_tags[i].tag;
      84             :         }
      85             : 
      86             :         return "???";
      87             : }

Generated by: LCOV version 1.14