1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 #ifndef __XFS_SCRUB_BTREE_H__
7 #define __XFS_SCRUB_BTREE_H__
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
);
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
);
19 /* Check for btree corruption. */
20 void xchk_btree_set_corrupt(struct xfs_scrub
*sc
,
21 struct xfs_btree_cur
*cur
, int level
);
23 /* Check for btree xref discrepancies. */
24 void xchk_btree_xref_set_corrupt(struct xfs_scrub
*sc
,
25 struct xfs_btree_cur
*cur
, int level
);
28 typedef int (*xchk_btree_rec_fn
)(
29 struct xchk_btree
*bs
,
30 union xfs_btree_rec
*rec
);
33 /* caller-provided scrub state */
35 struct xfs_btree_cur
*cur
;
36 xchk_btree_rec_fn scrub_rec
;
37 const struct xfs_owner_info
*oinfo
;
40 /* internal scrub state */
41 union xfs_btree_rec lastrec
;
43 union xfs_btree_key lastkey
[XFS_BTREE_MAXLEVELS
];
44 bool firstkey
[XFS_BTREE_MAXLEVELS
];
45 struct list_head to_check
;
47 int xchk_btree(struct xfs_scrub
*sc
, struct xfs_btree_cur
*cur
,
48 xchk_btree_rec_fn scrub_fn
, const struct xfs_owner_info
*oinfo
,
51 #endif /* __XFS_SCRUB_BTREE_H__ */