2023-04-11 18:59:56 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-10-17 21:37:34 -07:00
|
|
|
/*
|
2023-04-11 18:59:57 -07:00
|
|
|
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
2023-04-11 18:59:56 -07:00
|
|
|
* Author: Darrick J. Wong <djwong@kernel.org>
|
2017-10-17 21:37:34 -07:00
|
|
|
*/
|
|
|
|
#include "xfs.h"
|
|
|
|
#include "xfs_fs.h"
|
|
|
|
#include "xfs_shared.h"
|
|
|
|
#include "xfs_format.h"
|
|
|
|
#include "xfs_log_format.h"
|
|
|
|
#include "xfs_trans_resv.h"
|
|
|
|
#include "xfs_mount.h"
|
|
|
|
#include "xfs_inode.h"
|
|
|
|
#include "xfs_btree.h"
|
2021-06-01 17:48:24 -07:00
|
|
|
#include "xfs_ag.h"
|
2023-10-16 09:51:16 -07:00
|
|
|
#include "xfs_rtbitmap.h"
|
2023-12-15 11:03:45 -07:00
|
|
|
#include "xfs_quota.h"
|
2023-12-15 11:03:45 -07:00
|
|
|
#include "xfs_quota_defs.h"
|
2024-02-22 13:30:51 -07:00
|
|
|
#include "xfs_da_format.h"
|
2024-02-22 13:30:58 -07:00
|
|
|
#include "xfs_dir2.h"
|
2024-02-22 13:43:40 -07:00
|
|
|
#include "xfs_rmap.h"
|
2024-04-22 09:48:05 -07:00
|
|
|
#include "xfs_parent.h"
|
2023-08-10 07:48:04 -07:00
|
|
|
#include "scrub/scrub.h"
|
|
|
|
#include "scrub/xfile.h"
|
|
|
|
#include "scrub/xfarray.h"
|
2023-12-15 11:03:45 -07:00
|
|
|
#include "scrub/quota.h"
|
2024-02-22 13:30:45 -07:00
|
|
|
#include "scrub/iscan.h"
|
2024-04-15 14:54:56 -07:00
|
|
|
#include "scrub/orphanage.h"
|
2024-02-22 13:30:58 -07:00
|
|
|
#include "scrub/nlinks.h"
|
2024-02-22 13:33:05 -07:00
|
|
|
#include "scrub/fscounters.h"
|
2024-04-22 09:48:20 -07:00
|
|
|
#include "scrub/bitmap.h"
|
|
|
|
#include "scrub/ino_bitmap.h"
|
|
|
|
#include "scrub/xfblob.h"
|
|
|
|
#include "scrub/dirtree.h"
|
2017-10-17 21:37:34 -07:00
|
|
|
|
2017-10-17 21:37:37 -07:00
|
|
|
/* Figure out which block the btree cursor was pointing to. */
|
|
|
|
static inline xfs_fsblock_t
|
2018-07-19 12:29:11 -07:00
|
|
|
xchk_btree_cur_fsbno(
|
2018-07-19 12:29:12 -07:00
|
|
|
struct xfs_btree_cur *cur,
|
|
|
|
int level)
|
2017-10-17 21:37:37 -07:00
|
|
|
{
|
2021-09-16 12:24:04 -07:00
|
|
|
if (level < cur->bc_nlevels && cur->bc_levels[level].bp)
|
2021-08-18 18:47:05 -07:00
|
|
|
return XFS_DADDR_TO_FSB(cur->bc_mp,
|
2021-09-16 12:24:04 -07:00
|
|
|
xfs_buf_daddr(cur->bc_levels[level].bp));
|
2021-10-13 15:11:02 -07:00
|
|
|
|
|
|
|
if (level == cur->bc_nlevels - 1 &&
|
2024-02-22 13:36:17 -07:00
|
|
|
cur->bc_ops->type == XFS_BTREE_TYPE_INODE)
|
2020-03-10 17:52:53 -07:00
|
|
|
return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino);
|
2021-10-13 15:11:02 -07:00
|
|
|
|
2017-10-17 21:37:37 -07:00
|
|
|
return NULLFSBLOCK;
|
|
|
|
}
|
|
|
|
|
2017-10-17 21:37:34 -07:00
|
|
|
/*
|
|
|
|
* We include this last to have the helpers above available for the trace
|
|
|
|
* event implementations.
|
|
|
|
*/
|
|
|
|
#define CREATE_TRACE_POINTS
|
|
|
|
#include "scrub/trace.h"
|