LCOV - code coverage report
Current view: top level - fs/xfs/scrub - btree.h (source / functions) Hit Total Coverage
Test: fstests of 6.5.0-rc4-xfsa @ Mon Jul 31 20:08:27 PDT 2023 Lines: 1 1 100.0 %
Date: 2023-07-31 20:08:27 Functions: 0 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             : #ifndef __XFS_SCRUB_BTREE_H__
       7             : #define __XFS_SCRUB_BTREE_H__
       8             : 
       9             : /* btree scrub */
      10             : 
      11             : /* Check for btree operation errors. */
      12             : bool xchk_btree_process_error(struct xfs_scrub *sc,
      13             :                 struct xfs_btree_cur *cur, int level, int *error);
      14             : 
      15             : /* Check for btree xref operation errors. */
      16             : bool xchk_btree_xref_process_error(struct xfs_scrub *sc,
      17             :                 struct xfs_btree_cur *cur, int level, int *error);
      18             : 
      19             : /* Check for btree corruption. */
      20             : void xchk_btree_set_corrupt(struct xfs_scrub *sc,
      21             :                 struct xfs_btree_cur *cur, int level);
      22             : void xchk_btree_set_preen(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
      23             :                 int level);
      24             : 
      25             : /* Check for btree xref discrepancies. */
      26             : void xchk_btree_xref_set_corrupt(struct xfs_scrub *sc,
      27             :                 struct xfs_btree_cur *cur, int level);
      28             : 
      29             : struct xchk_btree;
      30             : typedef int (*xchk_btree_rec_fn)(
      31             :         struct xchk_btree               *bs,
      32             :         const union xfs_btree_rec       *rec);
      33             : 
      34             : struct xchk_btree_key {
      35             :         union xfs_btree_key             key;
      36             :         bool                            valid;
      37             : };
      38             : 
      39             : struct xchk_btree {
      40             :         /* caller-provided scrub state */
      41             :         struct xfs_scrub                *sc;
      42             :         struct xfs_btree_cur            *cur;
      43             :         xchk_btree_rec_fn               scrub_rec;
      44             :         const struct xfs_owner_info     *oinfo;
      45             :         void                            *private;
      46             : 
      47             :         /* internal scrub state */
      48             :         bool                            lastrec_valid;
      49             :         union xfs_btree_rec             lastrec;
      50             :         struct list_head                to_check;
      51             : 
      52             :         /* this element must come last! */
      53             :         struct xchk_btree_key           lastkey[];
      54             : };
      55             : 
      56             : /*
      57             :  * Calculate the size of a xchk_btree structure.  There are nlevels-1 slots for
      58             :  * keys because we track leaf records separately in lastrec.
      59             :  */
      60             : static inline size_t
      61             : xchk_btree_sizeof(unsigned int nlevels)
      62             : {
      63     2798457 :         return struct_size_t(struct xchk_btree, lastkey, nlevels - 1);
      64             : }
      65             : 
      66             : int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
      67             :                 xchk_btree_rec_fn scrub_fn, const struct xfs_owner_info *oinfo,
      68             :                 void *private);
      69             : 
      70             : #endif /* __XFS_SCRUB_BTREE_H__ */

Generated by: LCOV version 1.14