Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 Oracle. All Rights Reserved. |
| 3 | * |
| 4 | * Author: Darrick J. Wong <darrick.wong@oracle.com> |
| 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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. |
| 19 | */ |
| 20 | #include "xfs.h" |
| 21 | #include "xfs_fs.h" |
| 22 | #include "xfs_shared.h" |
| 23 | #include "xfs_format.h" |
| 24 | #include "xfs_log_format.h" |
| 25 | #include "xfs_trans_resv.h" |
| 26 | #include "xfs_mount.h" |
| 27 | #include "xfs_defer.h" |
| 28 | #include "xfs_da_format.h" |
| 29 | #include "xfs_defer.h" |
| 30 | #include "xfs_inode.h" |
| 31 | #include "xfs_btree.h" |
| 32 | #include "xfs_trans.h" |
Darrick J. Wong | 537964bc | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 33 | #include "xfs_bit.h" |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 34 | #include "scrub/xfs_scrub.h" |
| 35 | #include "scrub/scrub.h" |
Darrick J. Wong | dcb660f | 2017-10-17 21:37:36 -0700 | [diff] [blame] | 36 | #include "scrub/common.h" |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 37 | |
Darrick J. Wong | 537964bc | 2017-10-17 21:37:37 -0700 | [diff] [blame] | 38 | /* Figure out which block the btree cursor was pointing to. */ |
| 39 | static inline xfs_fsblock_t |
| 40 | xfs_scrub_btree_cur_fsbno( |
| 41 | struct xfs_btree_cur *cur, |
| 42 | int level) |
| 43 | { |
| 44 | if (level < cur->bc_nlevels && cur->bc_bufs[level]) |
| 45 | return XFS_DADDR_TO_FSB(cur->bc_mp, cur->bc_bufs[level]->b_bn); |
| 46 | else if (level == cur->bc_nlevels - 1 && |
| 47 | cur->bc_flags & XFS_BTREE_LONG_PTRS) |
| 48 | return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_private.b.ip->i_ino); |
| 49 | else if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS)) |
| 50 | return XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_private.a.agno, 0); |
| 51 | return NULLFSBLOCK; |
| 52 | } |
| 53 | |
Darrick J. Wong | 36fd6e8 | 2017-10-17 21:37:34 -0700 | [diff] [blame] | 54 | /* |
| 55 | * We include this last to have the helpers above available for the trace |
| 56 | * event implementations. |
| 57 | */ |
| 58 | #define CREATE_TRACE_POINTS |
| 59 | #include "scrub/trace.h" |