Lines Matching refs:ds

39 	struct xchk_da_btree	*ds,  in xchk_da_process_error()  argument
43 struct xfs_scrub *sc = ds->sc; in xchk_da_process_error()
60 trace_xchk_file_op_error(sc, ds->dargs.whichfork, in xchk_da_process_error()
61 xfs_dir2_da_to_db(ds->dargs.geo, in xchk_da_process_error()
62 ds->state->path.blk[level].blkno), in xchk_da_process_error()
75 struct xchk_da_btree *ds, in xchk_da_set_corrupt() argument
78 struct xfs_scrub *sc = ds->sc; in xchk_da_set_corrupt()
82 trace_xchk_fblock_error(sc, ds->dargs.whichfork, in xchk_da_set_corrupt()
83 xfs_dir2_da_to_db(ds->dargs.geo, in xchk_da_set_corrupt()
84 ds->state->path.blk[level].blkno), in xchk_da_set_corrupt()
91 struct xchk_da_btree *ds, in xchk_da_btree_entry() argument
100 blk = &ds->state->path.blk[level]; in xchk_da_btree_entry()
109 ents = (char *)ds->dargs.dp->d_ops->leaf_ents_p(baddr); in xchk_da_btree_entry()
113 ents = (char *)ds->dargs.dp->d_ops->leaf_ents_p(baddr); in xchk_da_btree_entry()
117 ents = (char *)ds->dargs.dp->d_ops->node_tree_p(baddr); in xchk_da_btree_entry()
127 struct xchk_da_btree *ds, in xchk_da_btree_hash() argument
138 if (hash < ds->hashes[level]) in xchk_da_btree_hash()
139 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
140 ds->hashes[level] = hash; in xchk_da_btree_hash()
146 blks = ds->state->path.blk; in xchk_da_btree_hash()
147 entry = xchk_da_btree_entry(ds, level - 1, blks[level - 1].index); in xchk_da_btree_hash()
150 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
161 struct xchk_da_btree *ds, in xchk_da_btree_ptr_ok() argument
165 if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) { in xchk_da_btree_ptr_ok()
166 xchk_da_set_corrupt(ds, level); in xchk_da_btree_ptr_ok()
249 struct xchk_da_btree *ds, in xchk_da_btree_block_check_sibling() argument
257 memcpy(&ds->state->altpath, &ds->state->path, in xchk_da_btree_block_check_sibling()
258 sizeof(ds->state->altpath)); in xchk_da_btree_block_check_sibling()
265 error = xfs_da3_path_shift(ds->state, &ds->state->altpath, in xchk_da_btree_block_check_sibling()
268 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
274 error = xfs_da3_path_shift(ds->state, &ds->state->altpath, in xchk_da_btree_block_check_sibling()
276 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block_check_sibling()
279 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
282 if (ds->state->altpath.blk[level].bp) in xchk_da_btree_block_check_sibling()
283 xchk_buffer_recheck(ds->sc, in xchk_da_btree_block_check_sibling()
284 ds->state->altpath.blk[level].bp); in xchk_da_btree_block_check_sibling()
287 if (ds->state->altpath.blk[level].blkno != sibling) in xchk_da_btree_block_check_sibling()
288 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
289 xfs_trans_brelse(ds->dargs.trans, ds->state->altpath.blk[level].bp); in xchk_da_btree_block_check_sibling()
297 struct xchk_da_btree *ds, in xchk_da_btree_block_check_siblings() argument
311 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_siblings()
319 error = xchk_da_btree_block_check_sibling(ds, level, 0, back); in xchk_da_btree_block_check_siblings()
322 error = xchk_da_btree_block_check_sibling(ds, level, 1, forw); in xchk_da_btree_block_check_siblings()
325 memset(&ds->state->altpath, 0, sizeof(ds->state->altpath)); in xchk_da_btree_block_check_siblings()
332 struct xchk_da_btree *ds, in xchk_da_btree_block() argument
340 struct xfs_da_args *dargs = &ds->dargs; in xchk_da_btree_block()
341 struct xfs_inode *ip = ds->dargs.dp; in xchk_da_btree_block()
347 blk = &ds->state->path.blk[level]; in xchk_da_btree_block()
348 ds->state->path.active = level + 1; in xchk_da_btree_block()
358 if (!xchk_da_btree_ptr_ok(ds, level, blkno)) in xchk_da_btree_block()
365 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block()
368 xchk_buffer_recheck(ds->sc, blk->bp); in xchk_da_btree_block()
375 if (ds->dargs.whichfork == XFS_DATA_FORK && level == 0 && in xchk_da_btree_block()
381 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
387 pmaxrecs = &ds->maxrecs[level]; in xchk_da_btree_block()
390 if (xfs_sb_version_hascrc(&ds->sc->mp->m_sb) && hdr3->hdr.pad) in xchk_da_btree_block()
391 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
397 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
401 error = xchk_da_btree_block_check_siblings(ds, level, &hdr3->hdr); in xchk_da_btree_block()
413 if (ds->tree_level != 0) in xchk_da_btree_block()
414 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
422 if (ds->tree_level != 0) in xchk_da_btree_block()
423 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
431 if (ds->tree_level != 0) in xchk_da_btree_block()
432 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
446 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
449 ds->tree_level = nodehdr.level; in xchk_da_btree_block()
451 if (ds->tree_level != nodehdr.level) { in xchk_da_btree_block()
452 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
460 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
482 struct xchk_da_btree ds = {}; in xchk_da_btree() local
497 ds.dargs.dp = sc->ip; in xchk_da_btree()
498 ds.dargs.whichfork = whichfork; in xchk_da_btree()
499 ds.dargs.trans = sc->tp; in xchk_da_btree()
500 ds.dargs.op_flags = XFS_DA_OP_OKNOENT; in xchk_da_btree()
501 ds.state = xfs_da_state_alloc(); in xchk_da_btree()
502 ds.state->args = &ds.dargs; in xchk_da_btree()
503 ds.state->mp = mp; in xchk_da_btree()
504 ds.sc = sc; in xchk_da_btree()
505 ds.private = private; in xchk_da_btree()
507 ds.dargs.geo = mp->m_attr_geo; in xchk_da_btree()
508 ds.lowest = 0; in xchk_da_btree()
509 ds.highest = 0; in xchk_da_btree()
511 ds.dargs.geo = mp->m_dir_geo; in xchk_da_btree()
512 ds.lowest = ds.dargs.geo->leafblk; in xchk_da_btree()
513 ds.highest = ds.dargs.geo->freeblk; in xchk_da_btree()
515 blkno = ds.lowest; in xchk_da_btree()
519 blks = ds.state->path.blk; in xchk_da_btree()
520 error = xchk_da_btree_block(&ds, level, blkno); in xchk_da_btree()
536 if (blks[level].index >= ds.maxrecs[level]) { in xchk_da_btree()
539 ds.tree_level++; in xchk_da_btree()
545 rec = xchk_da_btree_entry(&ds, level, in xchk_da_btree()
547 error = scrub_fn(&ds, level, rec); in xchk_da_btree()
560 if (blks[level].index >= ds.maxrecs[level]) { in xchk_da_btree()
563 ds.tree_level++; in xchk_da_btree()
569 key = xchk_da_btree_entry(&ds, level, blks[level].index); in xchk_da_btree()
570 error = xchk_da_btree_hash(&ds, level, &key->hashval); in xchk_da_btree()
577 ds.tree_level--; in xchk_da_btree()
578 error = xchk_da_btree_block(&ds, level, blkno); in xchk_da_btree()
597 xfs_da_state_free(ds.state); in xchk_da_btree()