Lines Matching full: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()
53 trace_xchk_file_op_error(sc, ds->dargs.whichfork, in xchk_da_process_error()
54 xfs_dir2_da_to_db(ds->dargs.geo, in xchk_da_process_error()
55 ds->state->path.blk[level].blkno), in xchk_da_process_error()
68 struct xchk_da_btree *ds, in xchk_da_set_corrupt() argument
71 struct xfs_scrub *sc = ds->sc; in xchk_da_set_corrupt()
75 trace_xchk_fblock_error(sc, ds->dargs.whichfork, in xchk_da_set_corrupt()
76 xfs_dir2_da_to_db(ds->dargs.geo, in xchk_da_set_corrupt()
77 ds->state->path.blk[level].blkno), in xchk_da_set_corrupt()
84 struct xchk_da_btree *ds, in xchk_da_set_preen() argument
87 struct xfs_scrub *sc = ds->sc; in xchk_da_set_preen()
90 trace_xchk_fblock_preen(sc, ds->dargs.whichfork, in xchk_da_set_preen()
91 xfs_dir2_da_to_db(ds->dargs.geo, in xchk_da_set_preen()
92 ds->state->path.blk[level].blkno), in xchk_da_set_preen()
99 struct xchk_da_btree *ds, in xchk_da_btree_node_entry() argument
102 struct xfs_da_state_blk *blk = &ds->state->path.blk[level]; in xchk_da_btree_node_entry()
107 xfs_da3_node_hdr_from_disk(ds->sc->mp, &hdr, blk->bp->b_addr); in xchk_da_btree_node_entry()
114 struct xchk_da_btree *ds, in xchk_da_btree_hash() argument
124 if (hash < ds->hashes[level]) in xchk_da_btree_hash()
125 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
126 ds->hashes[level] = hash; in xchk_da_btree_hash()
132 entry = xchk_da_btree_node_entry(ds, level - 1); in xchk_da_btree_hash()
135 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
146 struct xchk_da_btree *ds, in xchk_da_btree_ptr_ok() argument
150 if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) { in xchk_da_btree_ptr_ok()
151 xchk_da_set_corrupt(ds, level); in xchk_da_btree_ptr_ok()
234 struct xchk_da_btree *ds, in xchk_da_btree_block_check_sibling() argument
239 struct xfs_da_state_path *path = &ds->state->path; in xchk_da_btree_block_check_sibling()
240 struct xfs_da_state_path *altpath = &ds->state->altpath; in xchk_da_btree_block_check_sibling()
245 memcpy(altpath, path, sizeof(ds->state->altpath)); in xchk_da_btree_block_check_sibling()
252 error = xfs_da3_path_shift(ds->state, altpath, direction, in xchk_da_btree_block_check_sibling()
255 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
261 error = xfs_da3_path_shift(ds->state, altpath, direction, false, in xchk_da_btree_block_check_sibling()
263 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block_check_sibling()
266 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
270 xchk_buffer_recheck(ds->sc, altpath->blk[level].bp); in xchk_da_btree_block_check_sibling()
274 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
284 xfs_trans_brelse(ds->dargs.trans, altpath->blk[plevel].bp); in xchk_da_btree_block_check_sibling()
294 struct xchk_da_btree *ds, in xchk_da_btree_block_check_siblings() argument
308 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_siblings()
316 error = xchk_da_btree_block_check_sibling(ds, level, 0, back); in xchk_da_btree_block_check_siblings()
319 error = xchk_da_btree_block_check_sibling(ds, level, 1, forw); in xchk_da_btree_block_check_siblings()
322 memset(&ds->state->altpath, 0, sizeof(ds->state->altpath)); in xchk_da_btree_block_check_siblings()
329 struct xchk_da_btree *ds, in xchk_da_btree_block() argument
337 struct xfs_da_args *dargs = &ds->dargs; in xchk_da_btree_block()
338 struct xfs_inode *ip = ds->dargs.dp; in xchk_da_btree_block()
345 blk = &ds->state->path.blk[level]; in xchk_da_btree_block()
346 ds->state->path.active = level + 1; in xchk_da_btree_block()
356 if (!xchk_da_btree_ptr_ok(ds, level, blkno)) in xchk_da_btree_block()
363 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block()
366 xchk_buffer_recheck(ds->sc, blk->bp); in xchk_da_btree_block()
373 if (ds->dargs.whichfork == XFS_DATA_FORK && level == 0 && in xchk_da_btree_block()
379 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
385 pmaxrecs = &ds->maxrecs[level]; in xchk_da_btree_block()
388 if (xfs_has_crc(ds->sc->mp) && hdr3->hdr.pad) in xchk_da_btree_block()
389 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
395 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
399 error = xchk_da_btree_block_check_siblings(ds, level, &hdr3->hdr); 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()
420 if (ds->tree_level != 0) in xchk_da_btree_block()
421 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
429 if (ds->tree_level != 0) in xchk_da_btree_block()
430 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
444 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
447 ds->tree_level = nodehdr.level; in xchk_da_btree_block()
449 if (ds->tree_level != nodehdr.level) { in xchk_da_btree_block()
450 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
458 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
464 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
475 key = xchk_da_btree_node_entry(ds, level - 1); in xchk_da_btree_block()
477 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
500 struct xchk_da_btree *ds; in xchk_da_btree() local
513 ds = kzalloc(sizeof(struct xchk_da_btree), XCHK_GFP_FLAGS); in xchk_da_btree()
514 if (!ds) in xchk_da_btree()
516 ds->dargs.dp = sc->ip; in xchk_da_btree()
517 ds->dargs.whichfork = whichfork; in xchk_da_btree()
518 ds->dargs.trans = sc->tp; in xchk_da_btree()
519 ds->dargs.op_flags = XFS_DA_OP_OKNOENT; in xchk_da_btree()
520 ds->dargs.owner = sc->ip->i_ino; in xchk_da_btree()
521 ds->state = xfs_da_state_alloc(&ds->dargs); in xchk_da_btree()
522 ds->sc = sc; in xchk_da_btree()
523 ds->private = private; in xchk_da_btree()
525 ds->dargs.geo = mp->m_attr_geo; in xchk_da_btree()
526 ds->lowest = 0; in xchk_da_btree()
527 ds->highest = 0; in xchk_da_btree()
529 ds->dargs.geo = mp->m_dir_geo; in xchk_da_btree()
530 ds->lowest = ds->dargs.geo->leafblk; in xchk_da_btree()
531 ds->highest = ds->dargs.geo->freeblk; in xchk_da_btree()
533 blkno = ds->lowest; in xchk_da_btree()
537 blks = ds->state->path.blk; in xchk_da_btree()
538 error = xchk_da_btree_block(ds, level, blkno); in xchk_da_btree()
542 * We didn't find a block at ds->lowest, which means that there's in xchk_da_btree()
554 if (blks[level].index >= ds->maxrecs[level]) { in xchk_da_btree()
557 ds->tree_level++; in xchk_da_btree()
563 error = scrub_fn(ds, level); in xchk_da_btree()
576 if (blks[level].index >= ds->maxrecs[level]) { in xchk_da_btree()
579 ds->tree_level++; in xchk_da_btree()
585 key = xchk_da_btree_node_entry(ds, level); in xchk_da_btree()
586 error = xchk_da_btree_hash(ds, level, &key->hashval); in xchk_da_btree()
595 xchk_da_set_corrupt(ds, level - 1); in xchk_da_btree()
598 ds->tree_level--; in xchk_da_btree()
599 error = xchk_da_btree_block(ds, level, blkno); in xchk_da_btree()
618 xfs_da_state_free(ds->state); in xchk_da_btree()
619 kfree(ds); in xchk_da_btree()