Merge branch 'regmap-4.21' into regmap-5.0
[linux-2.6-block.git] / fs / xfs / scrub / btree.h
CommitLineData
0b61f8a4 1// SPDX-License-Identifier: GPL-2.0+
537964bc
DW
2/*
3 * Copyright (C) 2017 Oracle. All Rights Reserved.
537964bc 4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
537964bc
DW
5 */
6#ifndef __XFS_SCRUB_BTREE_H__
7#define __XFS_SCRUB_BTREE_H__
8
9/* btree scrub */
10
11/* Check for btree operation errors. */
1d8a748a 12bool xchk_btree_process_error(struct xfs_scrub *sc,
537964bc
DW
13 struct xfs_btree_cur *cur, int level, int *error);
14
64b12563 15/* Check for btree xref operation errors. */
1d8a748a 16bool xchk_btree_xref_process_error(struct xfs_scrub *sc,
032d91f9 17 struct xfs_btree_cur *cur, int level, int *error);
64b12563 18
537964bc 19/* Check for btree corruption. */
1d8a748a 20void xchk_btree_set_corrupt(struct xfs_scrub *sc,
537964bc
DW
21 struct xfs_btree_cur *cur, int level);
22
64b12563 23/* Check for btree xref discrepancies. */
1d8a748a 24void xchk_btree_xref_set_corrupt(struct xfs_scrub *sc,
64b12563
DW
25 struct xfs_btree_cur *cur, int level);
26
c517b3aa
DW
27struct xchk_btree;
28typedef int (*xchk_btree_rec_fn)(
29 struct xchk_btree *bs,
537964bc
DW
30 union xfs_btree_rec *rec);
31
c517b3aa 32struct xchk_btree {
537964bc 33 /* caller-provided scrub state */
66e3237e
DW
34 struct xfs_scrub *sc;
35 struct xfs_btree_cur *cur;
36 xchk_btree_rec_fn scrub_rec;
37 const struct xfs_owner_info *oinfo;
38 void *private;
537964bc
DW
39
40 /* internal scrub state */
66e3237e
DW
41 union xfs_btree_rec lastrec;
42 bool firstrec;
43 union xfs_btree_key lastkey[XFS_BTREE_MAXLEVELS];
44 bool firstkey[XFS_BTREE_MAXLEVELS];
45 struct list_head to_check;
537964bc 46};
1d8a748a 47int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
66e3237e 48 xchk_btree_rec_fn scrub_fn, const struct xfs_owner_info *oinfo,
032d91f9 49 void *private);
537964bc
DW
50
51#endif /* __XFS_SCRUB_BTREE_H__ */