Lines Matching refs:cur

27 	struct xfs_btree_cur	*cur,  in __xchk_btree_process_error()  argument
48 if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) in __xchk_btree_process_error()
49 trace_xchk_ifork_btree_op_error(sc, cur, level, in __xchk_btree_process_error()
52 trace_xchk_btree_op_error(sc, cur, level, in __xchk_btree_process_error()
62 struct xfs_btree_cur *cur, in xchk_btree_process_error() argument
66 return __xchk_btree_process_error(sc, cur, level, error, in xchk_btree_process_error()
73 struct xfs_btree_cur *cur, in xchk_btree_xref_process_error() argument
77 return __xchk_btree_process_error(sc, cur, level, error, in xchk_btree_xref_process_error()
85 struct xfs_btree_cur *cur, in __xchk_btree_set_corrupt() argument
92 if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) in __xchk_btree_set_corrupt()
93 trace_xchk_ifork_btree_error(sc, cur, level, in __xchk_btree_set_corrupt()
96 trace_xchk_btree_error(sc, cur, level, in __xchk_btree_set_corrupt()
103 struct xfs_btree_cur *cur, in xchk_btree_set_corrupt() argument
106 __xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_CORRUPT, in xchk_btree_set_corrupt()
113 struct xfs_btree_cur *cur, in xchk_btree_xref_set_corrupt() argument
116 __xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_XCORRUPT, in xchk_btree_xref_set_corrupt()
128 struct xfs_btree_cur *cur = bs->cur; in xchk_btree_rec() local
137 block = xfs_btree_get_block(cur, 0, &bp); in xchk_btree_rec()
138 rec = xfs_btree_rec_addr(cur, cur->bc_ptrs[0], block); in xchk_btree_rec()
140 trace_xchk_btree_rec(bs->sc, cur, 0); in xchk_btree_rec()
143 if (!bs->firstrec && !cur->bc_ops->recs_inorder(cur, &bs->lastrec, rec)) in xchk_btree_rec()
144 xchk_btree_set_corrupt(bs->sc, cur, 0); in xchk_btree_rec()
146 memcpy(&bs->lastrec, rec, cur->bc_ops->rec_len); in xchk_btree_rec()
148 if (cur->bc_nlevels == 1) in xchk_btree_rec()
152 cur->bc_ops->init_key_from_rec(&key, rec); in xchk_btree_rec()
153 keyblock = xfs_btree_get_block(cur, 1, &bp); in xchk_btree_rec()
154 keyp = xfs_btree_key_addr(cur, cur->bc_ptrs[1], keyblock); in xchk_btree_rec()
155 if (cur->bc_ops->diff_two_keys(cur, &key, keyp) < 0) in xchk_btree_rec()
156 xchk_btree_set_corrupt(bs->sc, cur, 1); in xchk_btree_rec()
158 if (!(cur->bc_flags & XFS_BTREE_OVERLAPPING)) in xchk_btree_rec()
162 cur->bc_ops->init_high_key_from_rec(&hkey, rec); in xchk_btree_rec()
163 keyp = xfs_btree_high_key_addr(cur, cur->bc_ptrs[1], keyblock); in xchk_btree_rec()
164 if (cur->bc_ops->diff_two_keys(cur, keyp, &hkey) < 0) in xchk_btree_rec()
165 xchk_btree_set_corrupt(bs->sc, cur, 1); in xchk_btree_rec()
177 struct xfs_btree_cur *cur = bs->cur; in xchk_btree_key() local
184 block = xfs_btree_get_block(cur, level, &bp); in xchk_btree_key()
185 key = xfs_btree_key_addr(cur, cur->bc_ptrs[level], block); in xchk_btree_key()
187 trace_xchk_btree_key(bs->sc, cur, level); in xchk_btree_key()
191 !cur->bc_ops->keys_inorder(cur, &bs->lastkey[level], key)) in xchk_btree_key()
192 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_key()
194 memcpy(&bs->lastkey[level], key, cur->bc_ops->key_len); in xchk_btree_key()
196 if (level + 1 >= cur->bc_nlevels) in xchk_btree_key()
200 keyblock = xfs_btree_get_block(cur, level + 1, &bp); in xchk_btree_key()
201 keyp = xfs_btree_key_addr(cur, cur->bc_ptrs[level + 1], keyblock); in xchk_btree_key()
202 if (cur->bc_ops->diff_two_keys(cur, key, keyp) < 0) in xchk_btree_key()
203 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_key()
205 if (!(cur->bc_flags & XFS_BTREE_OVERLAPPING)) in xchk_btree_key()
209 key = xfs_btree_high_key_addr(cur, cur->bc_ptrs[level], block); in xchk_btree_key()
210 keyp = xfs_btree_high_key_addr(cur, cur->bc_ptrs[level + 1], keyblock); in xchk_btree_key()
211 if (cur->bc_ops->diff_two_keys(cur, keyp, key) < 0) in xchk_btree_key()
212 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_key()
228 if ((bs->cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && in xchk_btree_ptr_ok()
229 level == bs->cur->bc_nlevels) in xchk_btree_ptr_ok()
233 if (bs->cur->bc_flags & XFS_BTREE_LONG_PTRS) in xchk_btree_ptr_ok()
234 res = xfs_btree_check_lptr(bs->cur, be64_to_cpu(ptr->l), level); in xchk_btree_ptr_ok()
236 res = xfs_btree_check_sptr(bs->cur, be32_to_cpu(ptr->s), level); in xchk_btree_ptr_ok()
238 xchk_btree_set_corrupt(bs->sc, bs->cur, level); in xchk_btree_ptr_ok()
251 struct xfs_btree_cur *cur = bs->cur; in xchk_btree_block_check_sibling() local
259 error = xfs_btree_dup_cursor(cur, &ncur); in xchk_btree_block_check_sibling()
260 if (!xchk_btree_process_error(bs->sc, cur, level + 1, &error) || in xchk_btree_block_check_sibling()
268 if (xfs_btree_ptr_is_null(cur, sibling)) { in xchk_btree_block_check_sibling()
274 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_block_check_sibling()
284 if (!xchk_btree_process_error(bs->sc, cur, level + 1, &error)) in xchk_btree_block_check_sibling()
287 xchk_btree_set_corrupt(bs->sc, cur, level + 1); in xchk_btree_block_check_sibling()
299 if (xfs_btree_diff_two_ptrs(cur, pp, sibling)) in xchk_btree_block_check_sibling()
300 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_block_check_sibling()
312 struct xfs_btree_cur *cur = bs->cur; in xchk_btree_block_check_siblings() local
318 xfs_btree_get_sibling(cur, block, &leftsib, XFS_BB_LEFTSIB); in xchk_btree_block_check_siblings()
319 xfs_btree_get_sibling(cur, block, &rightsib, XFS_BB_RIGHTSIB); in xchk_btree_block_check_siblings()
323 if (level == cur->bc_nlevels - 1) { in xchk_btree_block_check_siblings()
324 if (!xfs_btree_ptr_is_null(cur, &leftsib) || in xchk_btree_block_check_siblings()
325 !xfs_btree_ptr_is_null(cur, &rightsib)) in xchk_btree_block_check_siblings()
326 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_block_check_siblings()
367 if (!bs->cur) in xchk_btree_check_block_owner()
370 btnum = bs->cur->bc_btnum; in xchk_btree_check_block_owner()
371 agno = xfs_daddr_to_agno(bs->cur->bc_mp, daddr); in xchk_btree_check_block_owner()
372 agbno = xfs_daddr_to_agbno(bs->cur->bc_mp, daddr); in xchk_btree_check_block_owner()
374 init_sa = bs->cur->bc_flags & XFS_BTREE_LONG_PTRS; in xchk_btree_check_block_owner()
377 if (!xchk_btree_xref_process_error(bs->sc, bs->cur, in xchk_btree_check_block_owner()
389 bs->cur = NULL; in xchk_btree_check_block_owner()
393 bs->cur = NULL; in xchk_btree_check_block_owner()
408 struct xfs_btree_cur *cur = bs->cur; in xchk_btree_check_owner() local
418 if (!(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE)) in xchk_btree_check_owner()
419 xchk_btree_set_corrupt(bs->sc, bs->cur, level); in xchk_btree_check_owner()
431 if (cur->bc_btnum == XFS_BTNUM_BNO || cur->bc_btnum == XFS_BTNUM_RMAP) { in xchk_btree_check_owner()
455 struct xfs_btree_cur *cur = bs->cur; in xchk_btree_check_minrecs() local
456 unsigned int root_level = cur->bc_nlevels - 1; in xchk_btree_check_minrecs()
460 if (numrecs >= cur->bc_ops->get_minrecs(cur, level)) in xchk_btree_check_minrecs()
470 if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && in xchk_btree_check_minrecs()
471 level == cur->bc_nlevels - 2) { in xchk_btree_check_minrecs()
476 root_block = xfs_btree_get_block(cur, root_level, &root_bp); in xchk_btree_check_minrecs()
477 root_maxrecs = cur->bc_ops->get_dmaxrecs(cur, root_level); in xchk_btree_check_minrecs()
480 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_check_minrecs()
489 xchk_btree_set_corrupt(bs->sc, cur, level); in xchk_btree_check_minrecs()
510 error = xfs_btree_lookup_get_block(bs->cur, level, pp, pblock); in xchk_btree_get_block()
511 if (!xchk_btree_process_error(bs->sc, bs->cur, level, &error) || in xchk_btree_get_block()
515 xfs_btree_get_block(bs->cur, level, pbp); in xchk_btree_get_block()
516 if (bs->cur->bc_flags & XFS_BTREE_LONG_PTRS) in xchk_btree_get_block()
517 failed_at = __xfs_btree_check_lblock(bs->cur, *pblock, in xchk_btree_get_block()
520 failed_at = __xfs_btree_check_sblock(bs->cur, *pblock, in xchk_btree_get_block()
523 xchk_btree_set_corrupt(bs->sc, bs->cur, level); in xchk_btree_get_block()
557 struct xfs_btree_cur *cur = bs->cur; in xchk_btree_block_keys() local
564 if (level >= cur->bc_nlevels - 1) in xchk_btree_block_keys()
568 xfs_btree_get_keys(cur, block, &block_keys); in xchk_btree_block_keys()
571 parent_block = xfs_btree_get_block(cur, level + 1, &bp); in xchk_btree_block_keys()
572 parent_keys = xfs_btree_key_addr(cur, cur->bc_ptrs[level + 1], in xchk_btree_block_keys()
575 if (cur->bc_ops->diff_two_keys(cur, &block_keys, parent_keys) != 0) in xchk_btree_block_keys()
576 xchk_btree_set_corrupt(bs->sc, cur, 1); in xchk_btree_block_keys()
578 if (!(cur->bc_flags & XFS_BTREE_OVERLAPPING)) in xchk_btree_block_keys()
582 high_bk = xfs_btree_high_key_from_key(cur, &block_keys); in xchk_btree_block_keys()
583 high_pk = xfs_btree_high_key_addr(cur, cur->bc_ptrs[level + 1], in xchk_btree_block_keys()
586 if (cur->bc_ops->diff_two_keys(cur, high_bk, high_pk) != 0) in xchk_btree_block_keys()
587 xchk_btree_set_corrupt(bs->sc, cur, 1); in xchk_btree_block_keys()
598 struct xfs_btree_cur *cur, in xchk_btree() argument
604 .cur = cur, in xchk_btree()
628 if (cur->bc_nlevels > XFS_BTREE_MAXLEVELS) { in xchk_btree()
629 xchk_btree_set_corrupt(sc, cur, 0); in xchk_btree()
637 level = cur->bc_nlevels - 1; in xchk_btree()
638 cur->bc_ops->init_ptr_from_cur(cur, &ptr); in xchk_btree()
639 if (!xchk_btree_ptr_ok(&bs, cur->bc_nlevels, &ptr)) in xchk_btree()
645 cur->bc_ptrs[level] = 1; in xchk_btree()
647 while (level < cur->bc_nlevels) { in xchk_btree()
648 block = xfs_btree_get_block(cur, level, &bp); in xchk_btree()
652 if (cur->bc_ptrs[level] > in xchk_btree()
655 if (level < cur->bc_nlevels - 1) in xchk_btree()
656 cur->bc_ptrs[level + 1]++; in xchk_btree()
665 recp = xfs_btree_rec_addr(cur, cur->bc_ptrs[0], block); in xchk_btree()
673 cur->bc_ptrs[level]++; in xchk_btree()
678 if (cur->bc_ptrs[level] > be16_to_cpu(block->bb_numrecs)) { in xchk_btree()
680 if (level < cur->bc_nlevels - 1) in xchk_btree()
681 cur->bc_ptrs[level + 1]++; in xchk_btree()
690 pp = xfs_btree_ptr_addr(cur, cur->bc_ptrs[level], block); in xchk_btree()
692 cur->bc_ptrs[level]++; in xchk_btree()
700 cur->bc_ptrs[level] = 1; in xchk_btree()
706 if (!error && bs.cur) in xchk_btree()