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()
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()
83 struct xchk_da_btree *ds, in xchk_da_btree_node_entry() argument
86 struct xfs_da_state_blk *blk = &ds->state->path.blk[level]; in xchk_da_btree_node_entry()
91 xfs_da3_node_hdr_from_disk(ds->sc->mp, &hdr, blk->bp->b_addr); in xchk_da_btree_node_entry()
98 struct xchk_da_btree *ds, in xchk_da_btree_hash() argument
108 if (hash < ds->hashes[level]) in xchk_da_btree_hash()
109 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
110 ds->hashes[level] = hash; in xchk_da_btree_hash()
116 entry = xchk_da_btree_node_entry(ds, level - 1); in xchk_da_btree_hash()
119 xchk_da_set_corrupt(ds, level); in xchk_da_btree_hash()
130 struct xchk_da_btree *ds, in xchk_da_btree_ptr_ok() argument
134 if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) { in xchk_da_btree_ptr_ok()
135 xchk_da_set_corrupt(ds, level); in xchk_da_btree_ptr_ok()
218 struct xchk_da_btree *ds, in xchk_da_btree_block_check_sibling() argument
223 struct xfs_da_state_path *path = &ds->state->path; in xchk_da_btree_block_check_sibling()
224 struct xfs_da_state_path *altpath = &ds->state->altpath; in xchk_da_btree_block_check_sibling()
229 memcpy(altpath, path, sizeof(ds->state->altpath)); in xchk_da_btree_block_check_sibling()
236 error = xfs_da3_path_shift(ds->state, altpath, direction, in xchk_da_btree_block_check_sibling()
239 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
245 error = xfs_da3_path_shift(ds->state, altpath, direction, false, in xchk_da_btree_block_check_sibling()
247 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block_check_sibling()
250 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
254 xchk_buffer_recheck(ds->sc, altpath->blk[level].bp); in xchk_da_btree_block_check_sibling()
258 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_sibling()
268 xfs_trans_brelse(ds->dargs.trans, altpath->blk[plevel].bp); in xchk_da_btree_block_check_sibling()
278 struct xchk_da_btree *ds, in xchk_da_btree_block_check_siblings() argument
292 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block_check_siblings()
300 error = xchk_da_btree_block_check_sibling(ds, level, 0, back); in xchk_da_btree_block_check_siblings()
303 error = xchk_da_btree_block_check_sibling(ds, level, 1, forw); in xchk_da_btree_block_check_siblings()
306 memset(&ds->state->altpath, 0, sizeof(ds->state->altpath)); in xchk_da_btree_block_check_siblings()
313 struct xchk_da_btree *ds, in xchk_da_btree_block() argument
321 struct xfs_da_args *dargs = &ds->dargs; in xchk_da_btree_block()
322 struct xfs_inode *ip = ds->dargs.dp; in xchk_da_btree_block()
328 blk = &ds->state->path.blk[level]; in xchk_da_btree_block()
329 ds->state->path.active = level + 1; in xchk_da_btree_block()
339 if (!xchk_da_btree_ptr_ok(ds, level, blkno)) in xchk_da_btree_block()
346 if (!xchk_da_process_error(ds, level, &error)) in xchk_da_btree_block()
349 xchk_buffer_recheck(ds->sc, blk->bp); in xchk_da_btree_block()
356 if (ds->dargs.whichfork == XFS_DATA_FORK && level == 0 && in xchk_da_btree_block()
362 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
368 pmaxrecs = &ds->maxrecs[level]; in xchk_da_btree_block()
371 if (xfs_has_crc(ds->sc->mp) && hdr3->hdr.pad) in xchk_da_btree_block()
372 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
378 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
382 error = xchk_da_btree_block_check_siblings(ds, level, &hdr3->hdr); in xchk_da_btree_block()
394 if (ds->tree_level != 0) in xchk_da_btree_block()
395 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
403 if (ds->tree_level != 0) in xchk_da_btree_block()
404 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
412 if (ds->tree_level != 0) in xchk_da_btree_block()
413 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
427 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
430 ds->tree_level = nodehdr.level; in xchk_da_btree_block()
432 if (ds->tree_level != nodehdr.level) { in xchk_da_btree_block()
433 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
441 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
452 key = xchk_da_btree_node_entry(ds, level - 1); in xchk_da_btree_block()
454 xchk_da_set_corrupt(ds, level); in xchk_da_btree_block()
477 struct xchk_da_btree *ds; in xchk_da_btree() local
490 ds = kzalloc(sizeof(struct xchk_da_btree), XCHK_GFP_FLAGS); in xchk_da_btree()
491 if (!ds) in xchk_da_btree()
493 ds->dargs.dp = sc->ip; in xchk_da_btree()
494 ds->dargs.whichfork = whichfork; in xchk_da_btree()
495 ds->dargs.trans = sc->tp; in xchk_da_btree()
496 ds->dargs.op_flags = XFS_DA_OP_OKNOENT; in xchk_da_btree()
497 ds->state = xfs_da_state_alloc(&ds->dargs); in xchk_da_btree()
498 ds->sc = sc; in xchk_da_btree()
499 ds->private = private; in xchk_da_btree()
501 ds->dargs.geo = mp->m_attr_geo; in xchk_da_btree()
502 ds->lowest = 0; in xchk_da_btree()
503 ds->highest = 0; in xchk_da_btree()
505 ds->dargs.geo = mp->m_dir_geo; in xchk_da_btree()
506 ds->lowest = ds->dargs.geo->leafblk; in xchk_da_btree()
507 ds->highest = ds->dargs.geo->freeblk; in xchk_da_btree()
509 blkno = ds->lowest; in xchk_da_btree()
513 blks = ds->state->path.blk; in xchk_da_btree()
514 error = xchk_da_btree_block(ds, level, blkno); in xchk_da_btree()
530 if (blks[level].index >= ds->maxrecs[level]) { in xchk_da_btree()
533 ds->tree_level++; in xchk_da_btree()
539 error = scrub_fn(ds, level); in xchk_da_btree()
552 if (blks[level].index >= ds->maxrecs[level]) { in xchk_da_btree()
555 ds->tree_level++; in xchk_da_btree()
561 key = xchk_da_btree_node_entry(ds, level); in xchk_da_btree()
562 error = xchk_da_btree_hash(ds, level, &key->hashval); in xchk_da_btree()
571 xchk_da_set_corrupt(ds, level - 1); in xchk_da_btree()
574 ds->tree_level--; in xchk_da_btree()
575 error = xchk_da_btree_block(ds, level, blkno); in xchk_da_btree()
594 xfs_da_state_free(ds->state); in xchk_da_btree()
595 kfree(ds); in xchk_da_btree()