2023-04-12 09:59:56 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-10-18 12:37:34 +08:00
|
|
|
/*
|
2023-04-12 09:59:57 +08:00
|
|
|
* Copyright (C) 2017-2023 Oracle. All Rights Reserved.
|
2023-04-12 09:59:56 +08:00
|
|
|
* Author: Darrick J. Wong <djwong@kernel.org>
|
2017-10-18 12:37:34 +08: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"
|
|
|
|
#include "scrub/scrub.h"
|
2021-06-02 08:48:24 +08:00
|
|
|
#include "xfs_ag.h"
|
2017-10-18 12:37:34 +08:00
|
|
|
|
2017-10-18 12:37:37 +08:00
|
|
|
/* Figure out which block the btree cursor was pointing to. */
|
|
|
|
static inline xfs_fsblock_t
|
2018-07-20 03:29:11 +08:00
|
|
|
xchk_btree_cur_fsbno(
|
2018-07-20 03:29:12 +08:00
|
|
|
struct xfs_btree_cur *cur,
|
|
|
|
int level)
|
2017-10-18 12:37:37 +08:00
|
|
|
{
|
2021-09-17 03:24:04 +08:00
|
|
|
if (level < cur->bc_nlevels && cur->bc_levels[level].bp)
|
2021-08-19 09:47:05 +08:00
|
|
|
return XFS_DADDR_TO_FSB(cur->bc_mp,
|
2021-09-17 03:24:04 +08:00
|
|
|
xfs_buf_daddr(cur->bc_levels[level].bp));
|
2021-10-14 06:11:02 +08:00
|
|
|
|
|
|
|
if (level == cur->bc_nlevels - 1 &&
|
|
|
|
(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE))
|
2020-03-11 08:52:53 +08:00
|
|
|
return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino);
|
2021-10-14 06:11:02 +08:00
|
|
|
|
2017-10-18 12:37:37 +08:00
|
|
|
return NULLFSBLOCK;
|
|
|
|
}
|
|
|
|
|
2017-10-18 12:37:34 +08:00
|
|
|
/*
|
|
|
|
* We include this last to have the helpers above available for the trace
|
|
|
|
* event implementations.
|
|
|
|
*/
|
|
|
|
#define CREATE_TRACE_POINTS
|
|
|
|
#include "scrub/trace.h"
|