Merge tag 'xtensa-20180225' of git://github.com/jcmvbkbc/linux-xtensa
[cris-mirror.git] / fs / xfs / scrub / btree.h
blobe2b868ede70beb9174bafe9d2d6bf4874d47c5f3
1 /*
2 * Copyright (C) 2017 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it would be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __XFS_SCRUB_BTREE_H__
21 #define __XFS_SCRUB_BTREE_H__
23 /* btree scrub */
25 /* Check for btree operation errors. */
26 bool xfs_scrub_btree_process_error(struct xfs_scrub_context *sc,
27 struct xfs_btree_cur *cur, int level, int *error);
29 /* Check for btree xref operation errors. */
30 bool xfs_scrub_btree_xref_process_error(struct xfs_scrub_context *sc,
31 struct xfs_btree_cur *cur, int level,
32 int *error);
34 /* Check for btree corruption. */
35 void xfs_scrub_btree_set_corrupt(struct xfs_scrub_context *sc,
36 struct xfs_btree_cur *cur, int level);
38 /* Check for btree xref discrepancies. */
39 void xfs_scrub_btree_xref_set_corrupt(struct xfs_scrub_context *sc,
40 struct xfs_btree_cur *cur, int level);
42 struct xfs_scrub_btree;
43 typedef int (*xfs_scrub_btree_rec_fn)(
44 struct xfs_scrub_btree *bs,
45 union xfs_btree_rec *rec);
47 struct xfs_scrub_btree {
48 /* caller-provided scrub state */
49 struct xfs_scrub_context *sc;
50 struct xfs_btree_cur *cur;
51 xfs_scrub_btree_rec_fn scrub_rec;
52 struct xfs_owner_info *oinfo;
53 void *private;
55 /* internal scrub state */
56 union xfs_btree_rec lastrec;
57 bool firstrec;
58 union xfs_btree_key lastkey[XFS_BTREE_MAXLEVELS];
59 bool firstkey[XFS_BTREE_MAXLEVELS];
60 struct list_head to_check;
62 int xfs_scrub_btree(struct xfs_scrub_context *sc, struct xfs_btree_cur *cur,
63 xfs_scrub_btree_rec_fn scrub_fn,
64 struct xfs_owner_info *oinfo, void *private);
66 #endif /* __XFS_SCRUB_BTREE_H__ */