Lines Matching refs:ds
31 struct xchk_da_btree *ds, in xchk_da_process_error() argument
35 struct xfs_scrub *sc = ds->sc; in xchk_da_process_error()
52 trace_xchk_file_op_error(sc, ds->dargs.whichfork, in xchk_da_process_error()
53 xfs_dir2_da_to_db(ds->dargs.geo, in xchk_da_process_error()
54 ds->state->path.blk[level].blkno), in xchk_da_process_error()
67 struct xchk_da_btree *ds, in xchk_da_set_corrupt() argument
70 struct xfs_scrub *sc = ds->sc; in xchk_da_set_corrupt()
74 trace_xchk_fblock_error(sc, ds->dargs.whichfork, in xchk_da_set_corrupt()
75 xfs_dir2_da_to_db(ds->dargs.geo, in xchk_da_set_corrupt()
76 ds->state->path.blk[level].blkno), in xchk_da_set_corrupt()
82 struct xchk_da_btree *ds, in xchk_da_btree_node_entry() argument
85 struct xfs_da_state_blk *blk = &ds->state->path.blk[level]; in xchk_da_btree_node_entry()
90 xfs_da3_node_hdr_from_disk(ds->sc->mp, &hdr, blk->bp->b_addr); in xchk_da_btree_node_entry()
97 struct xchk_da_btree *ds, in xchk_da_btree_hash() argument
107 if (hash < ds->hashes[level]) in xchk_da_btree_hash()
108 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
109 ds->hashes[level] = hash; in xchk_da_btree_hash()
115 entry = xchk_da_btree_node_entry(ds, level - 1); in xchk_da_btree_hash()
118 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
129 struct xchk_da_btree *ds, in xchk_da_btree_ptr_ok() argument
133 if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) { in xchk_da_btree_ptr_ok()
134 xchk_da_set_corrupt(ds, level); in xchk_da_btree_ptr_ok()
217 struct xchk_da_btree *ds, in xchk_da_btree_block_check_sibling() argument
222 struct xfs_da_state_path *path = &ds->state->path; in xchk_da_btree_block_check_sibling()
223 struct xfs_da_state_path *altpath = &ds->state->altpath; in xchk_da_btree_block_check_sibling()
228 memcpy(altpath, path, sizeof(ds->state->altpath)); in xchk_da_btree_block_check_sibling()
235 error = xfs_da3_path_shift(ds->state, altpath, direction, in xchk_da_btree_block_check_sibling()
238 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
244 error = xfs_da3_path_shift(ds->state, altpath, direction, false, in xchk_da_btree_block_check_sibling()
246 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block_check_sibling()
249 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
253 xchk_buffer_recheck(ds->sc, altpath->blk[level].bp); in xchk_da_btree_block_check_sibling()
257 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
267 xfs_trans_brelse(ds->dargs.trans, altpath->blk[plevel].bp); in xchk_da_btree_block_check_sibling()
277 struct xchk_da_btree *ds, in xchk_da_btree_block_check_siblings() argument
291 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_siblings()
299 error = xchk_da_btree_block_check_sibling(ds, level, 0, back); in xchk_da_btree_block_check_siblings()
302 error = xchk_da_btree_block_check_sibling(ds, level, 1, forw); in xchk_da_btree_block_check_siblings()
305 memset(&ds->state->altpath, 0, sizeof(ds->state->altpath)); in xchk_da_btree_block_check_siblings()
312 struct xchk_da_btree *ds, in xchk_da_btree_block() argument
320 struct xfs_da_args *dargs = &ds->dargs; in xchk_da_btree_block()
321 struct xfs_inode *ip = ds->dargs.dp; in xchk_da_btree_block()
327 blk = &ds->state->path.blk[level]; in xchk_da_btree_block()
328 ds->state->path.active = level + 1; in xchk_da_btree_block()
338 if (!xchk_da_btree_ptr_ok(ds, level, blkno)) in xchk_da_btree_block()
345 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block()
348 xchk_buffer_recheck(ds->sc, blk->bp); in xchk_da_btree_block()
355 if (ds->dargs.whichfork == XFS_DATA_FORK && level == 0 && in xchk_da_btree_block()
361 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
367 pmaxrecs = &ds->maxrecs[level]; in xchk_da_btree_block()
370 if (xfs_has_crc(ds->sc->mp) && hdr3->hdr.pad) in xchk_da_btree_block()
371 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
377 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
381 error = xchk_da_btree_block_check_siblings(ds, level, &hdr3->hdr); in xchk_da_btree_block()
393 if (ds->tree_level != 0) in xchk_da_btree_block()
394 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
402 if (ds->tree_level != 0) in xchk_da_btree_block()
403 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
411 if (ds->tree_level != 0) in xchk_da_btree_block()
412 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
426 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
429 ds->tree_level = nodehdr.level; in xchk_da_btree_block()
431 if (ds->tree_level != nodehdr.level) { in xchk_da_btree_block()
432 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
440 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
451 key = xchk_da_btree_node_entry(ds, level - 1); in xchk_da_btree_block()
453 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
476 struct xchk_da_btree *ds; in xchk_da_btree() local
489 ds = kmem_zalloc(sizeof(struct xchk_da_btree), KM_NOFS | KM_MAYFAIL); in xchk_da_btree()
490 if (!ds) in xchk_da_btree()
492 ds->dargs.dp = sc->ip; in xchk_da_btree()
493 ds->dargs.whichfork = whichfork; in xchk_da_btree()
494 ds->dargs.trans = sc->tp; in xchk_da_btree()
495 ds->dargs.op_flags = XFS_DA_OP_OKNOENT; in xchk_da_btree()
496 ds->state = xfs_da_state_alloc(&ds->dargs); in xchk_da_btree()
497 ds->sc = sc; in xchk_da_btree()
498 ds->private = private; in xchk_da_btree()
500 ds->dargs.geo = mp->m_attr_geo; in xchk_da_btree()
501 ds->lowest = 0; in xchk_da_btree()
502 ds->highest = 0; in xchk_da_btree()
504 ds->dargs.geo = mp->m_dir_geo; in xchk_da_btree()
505 ds->lowest = ds->dargs.geo->leafblk; in xchk_da_btree()
506 ds->highest = ds->dargs.geo->freeblk; in xchk_da_btree()
508 blkno = ds->lowest; in xchk_da_btree()
512 blks = ds->state->path.blk; in xchk_da_btree()
513 error = xchk_da_btree_block(ds, level, blkno); in xchk_da_btree()
529 if (blks[level].index >= ds->maxrecs[level]) { in xchk_da_btree()
532 ds->tree_level++; in xchk_da_btree()
538 error = scrub_fn(ds, level); in xchk_da_btree()
551 if (blks[level].index >= ds->maxrecs[level]) { in xchk_da_btree()
554 ds->tree_level++; in xchk_da_btree()
560 key = xchk_da_btree_node_entry(ds, level); in xchk_da_btree()
561 error = xchk_da_btree_hash(ds, level, &key->hashval); in xchk_da_btree()
570 xchk_da_set_corrupt(ds, level - 1); in xchk_da_btree()
573 ds->tree_level--; in xchk_da_btree()
574 error = xchk_da_btree_block(ds, level, blkno); in xchk_da_btree()
593 xfs_da_state_free(ds->state); in xchk_da_btree()
594 kmem_free(ds); in xchk_da_btree()