| .. | .. |
|---|
| 7 | 7 | #include "xfs_fs.h" |
|---|
| 8 | 8 | #include "xfs_shared.h" |
|---|
| 9 | 9 | #include "xfs_format.h" |
|---|
| 10 | | -#include "xfs_trans_resv.h" |
|---|
| 11 | | -#include "xfs_mount.h" |
|---|
| 12 | | -#include "xfs_defer.h" |
|---|
| 13 | 10 | #include "xfs_btree.h" |
|---|
| 14 | | -#include "xfs_bit.h" |
|---|
| 15 | | -#include "xfs_log_format.h" |
|---|
| 16 | | -#include "xfs_trans.h" |
|---|
| 17 | | -#include "xfs_sb.h" |
|---|
| 18 | | -#include "xfs_alloc.h" |
|---|
| 19 | 11 | #include "xfs_rmap.h" |
|---|
| 20 | 12 | #include "xfs_refcount.h" |
|---|
| 21 | | -#include "scrub/xfs_scrub.h" |
|---|
| 22 | 13 | #include "scrub/scrub.h" |
|---|
| 23 | 14 | #include "scrub/common.h" |
|---|
| 24 | 15 | #include "scrub/btree.h" |
|---|
| 25 | | -#include "scrub/trace.h" |
|---|
| 26 | 16 | |
|---|
| 27 | 17 | /* |
|---|
| 28 | 18 | * Set us up to scrub reference count btrees. |
|---|
| .. | .. |
|---|
| 344 | 334 | { |
|---|
| 345 | 335 | struct xfs_mount *mp = bs->cur->bc_mp; |
|---|
| 346 | 336 | xfs_agblock_t *cow_blocks = bs->private; |
|---|
| 347 | | - xfs_agnumber_t agno = bs->cur->bc_private.a.agno; |
|---|
| 337 | + xfs_agnumber_t agno = bs->cur->bc_ag.agno; |
|---|
| 348 | 338 | xfs_agblock_t bno; |
|---|
| 349 | 339 | xfs_extlen_t len; |
|---|
| 350 | 340 | xfs_nlink_t refcount; |
|---|
| 351 | 341 | bool has_cowflag; |
|---|
| 352 | | - int error = 0; |
|---|
| 353 | 342 | |
|---|
| 354 | 343 | bno = be32_to_cpu(rec->refc.rc_startblock); |
|---|
| 355 | 344 | len = be32_to_cpu(rec->refc.rc_blockcount); |
|---|
| .. | .. |
|---|
| 374 | 363 | |
|---|
| 375 | 364 | xchk_refcountbt_xref(bs->sc, bno, len, refcount); |
|---|
| 376 | 365 | |
|---|
| 377 | | - return error; |
|---|
| 366 | + return 0; |
|---|
| 378 | 367 | } |
|---|
| 379 | 368 | |
|---|
| 380 | 369 | /* Make sure we have as many refc blocks as the rmap says. */ |
|---|
| 381 | 370 | STATIC void |
|---|
| 382 | 371 | xchk_refcount_xref_rmap( |
|---|
| 383 | 372 | struct xfs_scrub *sc, |
|---|
| 384 | | - struct xfs_owner_info *oinfo, |
|---|
| 385 | 373 | xfs_filblks_t cow_blocks) |
|---|
| 386 | 374 | { |
|---|
| 387 | 375 | xfs_extlen_t refcbt_blocks = 0; |
|---|
| .. | .. |
|---|
| 395 | 383 | error = xfs_btree_count_blocks(sc->sa.refc_cur, &refcbt_blocks); |
|---|
| 396 | 384 | if (!xchk_btree_process_error(sc, sc->sa.refc_cur, 0, &error)) |
|---|
| 397 | 385 | return; |
|---|
| 398 | | - error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, oinfo, |
|---|
| 399 | | - &blocks); |
|---|
| 386 | + error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, |
|---|
| 387 | + &XFS_RMAP_OINFO_REFC, &blocks); |
|---|
| 400 | 388 | if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) |
|---|
| 401 | 389 | return; |
|---|
| 402 | 390 | if (blocks != refcbt_blocks) |
|---|
| 403 | 391 | xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0); |
|---|
| 404 | 392 | |
|---|
| 405 | 393 | /* Check that we saw as many cow blocks as the rmap knows about. */ |
|---|
| 406 | | - xfs_rmap_ag_owner(oinfo, XFS_RMAP_OWN_COW); |
|---|
| 407 | | - error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, oinfo, |
|---|
| 408 | | - &blocks); |
|---|
| 394 | + error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, |
|---|
| 395 | + &XFS_RMAP_OINFO_COW, &blocks); |
|---|
| 409 | 396 | if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) |
|---|
| 410 | 397 | return; |
|---|
| 411 | 398 | if (blocks != cow_blocks) |
|---|
| .. | .. |
|---|
| 417 | 404 | xchk_refcountbt( |
|---|
| 418 | 405 | struct xfs_scrub *sc) |
|---|
| 419 | 406 | { |
|---|
| 420 | | - struct xfs_owner_info oinfo; |
|---|
| 421 | 407 | xfs_agblock_t cow_blocks = 0; |
|---|
| 422 | 408 | int error; |
|---|
| 423 | 409 | |
|---|
| 424 | | - xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_REFC); |
|---|
| 425 | 410 | error = xchk_btree(sc, sc->sa.refc_cur, xchk_refcountbt_rec, |
|---|
| 426 | | - &oinfo, &cow_blocks); |
|---|
| 411 | + &XFS_RMAP_OINFO_REFC, &cow_blocks); |
|---|
| 427 | 412 | if (error) |
|---|
| 428 | 413 | return error; |
|---|
| 429 | 414 | |
|---|
| 430 | | - xchk_refcount_xref_rmap(sc, &oinfo, cow_blocks); |
|---|
| 415 | + xchk_refcount_xref_rmap(sc, cow_blocks); |
|---|
| 431 | 416 | |
|---|
| 432 | 417 | return 0; |
|---|
| 433 | 418 | } |
|---|