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_DABTREE_H__
21 #define __XFS_SCRUB_DABTREE_H__
25 struct xfs_scrub_da_btree
{
26 struct xfs_da_args dargs
;
27 xfs_dahash_t hashes
[XFS_DA_NODE_MAXDEPTH
];
28 int maxrecs
[XFS_DA_NODE_MAXDEPTH
];
29 struct xfs_da_state
*state
;
30 struct xfs_scrub_context
*sc
;
34 * Lowest and highest directory block address in which we expect
35 * to find dir/attr btree node blocks. For a directory this
36 * (presumably) means between LEAF_OFFSET and FREE_OFFSET; for
37 * attributes there is no limit.
45 typedef int (*xfs_scrub_da_btree_rec_fn
)(struct xfs_scrub_da_btree
*ds
,
46 int level
, void *rec
);
48 /* Check for da btree operation errors. */
49 bool xfs_scrub_da_process_error(struct xfs_scrub_da_btree
*ds
, int level
, int *error
);
51 /* Check for da btree corruption. */
52 void xfs_scrub_da_set_corrupt(struct xfs_scrub_da_btree
*ds
, int level
);
54 int xfs_scrub_da_btree_hash(struct xfs_scrub_da_btree
*ds
, int level
,
56 int xfs_scrub_da_btree(struct xfs_scrub_context
*sc
, int whichfork
,
57 xfs_scrub_da_btree_rec_fn scrub_fn
, void *private);
59 #endif /* __XFS_SCRUB_DABTREE_H__ */