2018-06-06 02:42:14 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2017-10-18 04:37:37 +00: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-19 19:29:12 +00:00
|
|
|
bool xchk_btree_process_error(struct xfs_scrub *sc,
|
2017-10-18 04:37:37 +00:00
|
|
|
struct xfs_btree_cur *cur, int level, int *error);
|
|
|
|
|
2018-01-17 02:52:14 +00:00
|
|
|
/* Check for btree xref operation errors. */
|
2018-07-19 19:29:12 +00:00
|
|
|
bool xchk_btree_xref_process_error(struct xfs_scrub *sc,
|
2018-01-17 02:52:14 +00:00
|
|
|
struct xfs_btree_cur *cur, int level,
|
|
|
|
int *error);
|
|
|
|
|
2017-10-18 04:37:37 +00:00
|
|
|
/* Check for btree corruption. */
|
2018-07-19 19:29:12 +00:00
|
|
|
void xchk_btree_set_corrupt(struct xfs_scrub *sc,
|
2017-10-18 04:37:37 +00:00
|
|
|
struct xfs_btree_cur *cur, int level);
|
|
|
|
|
2018-01-17 02:52:14 +00:00
|
|
|
/* Check for btree xref discrepancies. */
|
2018-07-19 19:29:12 +00:00
|
|
|
void xchk_btree_xref_set_corrupt(struct xfs_scrub *sc,
|
2018-01-17 02:52:14 +00:00
|
|
|
struct xfs_btree_cur *cur, int level);
|
|
|
|
|
2018-07-19 19:29:11 +00:00
|
|
|
struct xchk_btree;
|
|
|
|
typedef int (*xchk_btree_rec_fn)(
|
|
|
|
struct xchk_btree *bs,
|
2017-10-18 04:37:37 +00:00
|
|
|
union xfs_btree_rec *rec);
|
|
|
|
|
2018-07-19 19:29:11 +00:00
|
|
|
struct xchk_btree {
|
2017-10-18 04:37:37 +00:00
|
|
|
/* caller-provided scrub state */
|
2018-07-19 19:29:12 +00:00
|
|
|
struct xfs_scrub *sc;
|
2017-10-18 04:37:37 +00:00
|
|
|
struct xfs_btree_cur *cur;
|
2018-07-19 19:29:11 +00:00
|
|
|
xchk_btree_rec_fn scrub_rec;
|
2017-10-18 04:37:37 +00:00
|
|
|
struct xfs_owner_info *oinfo;
|
|
|
|
void *private;
|
|
|
|
|
|
|
|
/* internal scrub state */
|
|
|
|
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;
|
|
|
|
};
|
2018-07-19 19:29:12 +00:00
|
|
|
int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
|
2018-07-19 19:29:11 +00:00
|
|
|
xchk_btree_rec_fn scrub_fn,
|
2017-10-18 04:37:37 +00:00
|
|
|
struct xfs_owner_info *oinfo, void *private);
|
|
|
|
|
|
|
|
#endif /* __XFS_SCRUB_BTREE_H__ */
|