2018-06-06 10:42:14 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-10-18 12:37:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Oracle. All Rights Reserved.
|
|
|
|
* Author: Darrick J. Wong <darrick.wong@oracle.com>
|
|
|
|
*/
|
|
|
|
#ifndef __XFS_SCRUB_BTREE_H__
|
|
|
|
#define __XFS_SCRUB_BTREE_H__
|
|
|
|
|
|
|
|
/* btree scrub */
|
|
|
|
|
|
|
|
/* Check for btree operation errors. */
|
2018-07-20 03:29:12 +08:00
|
|
|
bool xchk_btree_process_error(struct xfs_scrub *sc,
|
2017-10-18 12:37:37 +08:00
|
|
|
struct xfs_btree_cur *cur, int level, int *error);
|
|
|
|
|
2018-01-17 10:52:14 +08:00
|
|
|
/* Check for btree xref operation errors. */
|
2018-07-20 03:29:12 +08:00
|
|
|
bool xchk_btree_xref_process_error(struct xfs_scrub *sc,
|
2018-07-20 03:29:12 +08:00
|
|
|
struct xfs_btree_cur *cur, int level, int *error);
|
2018-01-17 10:52:14 +08:00
|
|
|
|
2017-10-18 12:37:37 +08:00
|
|
|
/* Check for btree corruption. */
|
2018-07-20 03:29:12 +08:00
|
|
|
void xchk_btree_set_corrupt(struct xfs_scrub *sc,
|
2017-10-18 12:37:37 +08:00
|
|
|
struct xfs_btree_cur *cur, int level);
|
|
|
|
|
2018-01-17 10:52:14 +08:00
|
|
|
/* Check for btree xref discrepancies. */
|
2018-07-20 03:29:12 +08:00
|
|
|
void xchk_btree_xref_set_corrupt(struct xfs_scrub *sc,
|
2018-01-17 10:52:14 +08:00
|
|
|
struct xfs_btree_cur *cur, int level);
|
|
|
|
|
2018-07-20 03:29:11 +08:00
|
|
|
struct xchk_btree;
|
|
|
|
typedef int (*xchk_btree_rec_fn)(
|
|
|
|
struct xchk_btree *bs,
|
2017-10-18 12:37:37 +08:00
|
|
|
union xfs_btree_rec *rec);
|
|
|
|
|
2018-07-20 03:29:11 +08:00
|
|
|
struct xchk_btree {
|
2017-10-18 12:37:37 +08:00
|
|
|
/* caller-provided scrub state */
|
2018-07-20 03:29:12 +08:00
|
|
|
struct xfs_scrub *sc;
|
2018-07-20 03:29:12 +08:00
|
|
|
struct xfs_btree_cur *cur;
|
|
|
|
xchk_btree_rec_fn scrub_rec;
|
|
|
|
struct xfs_owner_info *oinfo;
|
|
|
|
void *private;
|
2017-10-18 12:37:37 +08:00
|
|
|
|
|
|
|
/* internal scrub state */
|
2018-07-20 03:29:12 +08:00
|
|
|
union xfs_btree_rec lastrec;
|
|
|
|
bool firstrec;
|
|
|
|
union xfs_btree_key lastkey[XFS_BTREE_MAXLEVELS];
|
|
|
|
bool firstkey[XFS_BTREE_MAXLEVELS];
|
|
|
|
struct list_head to_check;
|
2017-10-18 12:37:37 +08:00
|
|
|
};
|
2018-07-20 03:29:12 +08:00
|
|
|
int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
|
2018-07-20 03:29:12 +08:00
|
|
|
xchk_btree_rec_fn scrub_fn, struct xfs_owner_info *oinfo,
|
|
|
|
void *private);
|
2017-10-18 12:37:37 +08:00
|
|
|
|
|
|
|
#endif /* __XFS_SCRUB_BTREE_H__ */
|