Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: fix indentation and other whitespace problems in scrub/repair

Now that we've shortened everything, fix up all the indentation and
whitespace problems. There are no functional changes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>

+832 -843
+86 -86
fs/xfs/scrub/agheader.c
··· 30 30 STATIC void 31 31 xchk_superblock_xref( 32 32 struct xfs_scrub *sc, 33 - struct xfs_buf *bp) 33 + struct xfs_buf *bp) 34 34 { 35 - struct xfs_owner_info oinfo; 36 - struct xfs_mount *mp = sc->mp; 37 - xfs_agnumber_t agno = sc->sm->sm_agno; 38 - xfs_agblock_t agbno; 39 - int error; 35 + struct xfs_owner_info oinfo; 36 + struct xfs_mount *mp = sc->mp; 37 + xfs_agnumber_t agno = sc->sm->sm_agno; 38 + xfs_agblock_t agbno; 39 + int error; 40 40 41 41 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 42 42 return; ··· 68 68 xchk_superblock( 69 69 struct xfs_scrub *sc) 70 70 { 71 - struct xfs_mount *mp = sc->mp; 72 - struct xfs_buf *bp; 73 - struct xfs_dsb *sb; 74 - xfs_agnumber_t agno; 75 - uint32_t v2_ok; 76 - __be32 features_mask; 77 - int error; 78 - __be16 vernum_mask; 71 + struct xfs_mount *mp = sc->mp; 72 + struct xfs_buf *bp; 73 + struct xfs_dsb *sb; 74 + xfs_agnumber_t agno; 75 + uint32_t v2_ok; 76 + __be32 features_mask; 77 + int error; 78 + __be16 vernum_mask; 79 79 80 80 agno = sc->sm->sm_agno; 81 81 if (agno == 0) ··· 367 367 xchk_agf_xref_freeblks( 368 368 struct xfs_scrub *sc) 369 369 { 370 - struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 371 - xfs_extlen_t blocks = 0; 372 - int error; 370 + struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 371 + xfs_extlen_t blocks = 0; 372 + int error; 373 373 374 374 if (!sc->sa.bno_cur) 375 375 return; ··· 387 387 xchk_agf_xref_cntbt( 388 388 struct xfs_scrub *sc) 389 389 { 390 - struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 391 - xfs_agblock_t agbno; 392 - xfs_extlen_t blocks; 393 - int have; 394 - int error; 390 + struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 391 + xfs_agblock_t agbno; 392 + xfs_extlen_t blocks; 393 + int have; 394 + int error; 395 395 396 396 if (!sc->sa.cnt_cur) 397 397 return; ··· 419 419 xchk_agf_xref_btreeblks( 420 420 struct xfs_scrub *sc) 421 421 { 422 - struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 423 - struct xfs_mount *mp = sc->mp; 424 - xfs_agblock_t blocks; 425 - xfs_agblock_t btreeblks; 426 - int error; 422 + struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 423 + struct xfs_mount *mp = sc->mp; 424 + xfs_agblock_t blocks; 425 + xfs_agblock_t btreeblks; 426 + int error; 427 427 428 428 /* Check agf_rmap_blocks; set up for agf_btreeblks check */ 429 429 if (sc->sa.rmap_cur) { ··· 465 465 xchk_agf_xref_refcblks( 466 466 struct xfs_scrub *sc) 467 467 { 468 - struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 469 - xfs_agblock_t blocks; 470 - int error; 468 + struct xfs_agf *agf = XFS_BUF_TO_AGF(sc->sa.agf_bp); 469 + xfs_agblock_t blocks; 470 + int error; 471 471 472 472 if (!sc->sa.refc_cur) 473 473 return; ··· 484 484 xchk_agf_xref( 485 485 struct xfs_scrub *sc) 486 486 { 487 - struct xfs_owner_info oinfo; 488 - struct xfs_mount *mp = sc->mp; 489 - xfs_agblock_t agbno; 490 - int error; 487 + struct xfs_owner_info oinfo; 488 + struct xfs_mount *mp = sc->mp; 489 + xfs_agblock_t agbno; 490 + int error; 491 491 492 492 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 493 493 return; ··· 516 516 xchk_agf( 517 517 struct xfs_scrub *sc) 518 518 { 519 - struct xfs_mount *mp = sc->mp; 520 - struct xfs_agf *agf; 521 - xfs_agnumber_t agno; 522 - xfs_agblock_t agbno; 523 - xfs_agblock_t eoag; 524 - xfs_agblock_t agfl_first; 525 - xfs_agblock_t agfl_last; 526 - xfs_agblock_t agfl_count; 527 - xfs_agblock_t fl_count; 528 - int level; 529 - int error = 0; 519 + struct xfs_mount *mp = sc->mp; 520 + struct xfs_agf *agf; 521 + xfs_agnumber_t agno; 522 + xfs_agblock_t agbno; 523 + xfs_agblock_t eoag; 524 + xfs_agblock_t agfl_first; 525 + xfs_agblock_t agfl_last; 526 + xfs_agblock_t agfl_count; 527 + xfs_agblock_t fl_count; 528 + int level; 529 + int error = 0; 530 530 531 531 agno = sc->sa.agno = sc->sm->sm_agno; 532 532 error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp, ··· 598 598 /* AGFL */ 599 599 600 600 struct xchk_agfl_info { 601 - struct xfs_owner_info oinfo; 602 - unsigned int sz_entries; 603 - unsigned int nr_entries; 604 - xfs_agblock_t *entries; 601 + struct xfs_owner_info oinfo; 602 + unsigned int sz_entries; 603 + unsigned int nr_entries; 604 + xfs_agblock_t *entries; 605 605 struct xfs_scrub *sc; 606 606 }; 607 607 ··· 609 609 STATIC void 610 610 xchk_agfl_block_xref( 611 611 struct xfs_scrub *sc, 612 - xfs_agblock_t agbno, 613 - struct xfs_owner_info *oinfo) 612 + xfs_agblock_t agbno, 613 + struct xfs_owner_info *oinfo) 614 614 { 615 615 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 616 616 return; ··· 624 624 /* Scrub an AGFL block. */ 625 625 STATIC int 626 626 xchk_agfl_block( 627 - struct xfs_mount *mp, 628 - xfs_agblock_t agbno, 629 - void *priv) 627 + struct xfs_mount *mp, 628 + xfs_agblock_t agbno, 629 + void *priv) 630 630 { 631 - struct xchk_agfl_info *sai = priv; 631 + struct xchk_agfl_info *sai = priv; 632 632 struct xfs_scrub *sc = sai->sc; 633 - xfs_agnumber_t agno = sc->sa.agno; 633 + xfs_agnumber_t agno = sc->sa.agno; 634 634 635 635 if (xfs_verify_agbno(mp, agno, agbno) && 636 636 sai->nr_entries < sai->sz_entries) ··· 662 662 xchk_agfl_xref( 663 663 struct xfs_scrub *sc) 664 664 { 665 - struct xfs_owner_info oinfo; 666 - struct xfs_mount *mp = sc->mp; 667 - xfs_agblock_t agbno; 668 - int error; 665 + struct xfs_owner_info oinfo; 666 + struct xfs_mount *mp = sc->mp; 667 + xfs_agblock_t agbno; 668 + int error; 669 669 670 670 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 671 671 return; ··· 693 693 xchk_agfl( 694 694 struct xfs_scrub *sc) 695 695 { 696 - struct xchk_agfl_info sai; 697 - struct xfs_agf *agf; 698 - xfs_agnumber_t agno; 699 - unsigned int agflcount; 700 - unsigned int i; 701 - int error; 696 + struct xchk_agfl_info sai; 697 + struct xfs_agf *agf; 698 + xfs_agnumber_t agno; 699 + unsigned int agflcount; 700 + unsigned int i; 701 + int error; 702 702 703 703 agno = sc->sa.agno = sc->sm->sm_agno; 704 704 error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp, ··· 770 770 xchk_agi_xref_icounts( 771 771 struct xfs_scrub *sc) 772 772 { 773 - struct xfs_agi *agi = XFS_BUF_TO_AGI(sc->sa.agi_bp); 774 - xfs_agino_t icount; 775 - xfs_agino_t freecount; 776 - int error; 773 + struct xfs_agi *agi = XFS_BUF_TO_AGI(sc->sa.agi_bp); 774 + xfs_agino_t icount; 775 + xfs_agino_t freecount; 776 + int error; 777 777 778 778 if (!sc->sa.ino_cur) 779 779 return; ··· 791 791 xchk_agi_xref( 792 792 struct xfs_scrub *sc) 793 793 { 794 - struct xfs_owner_info oinfo; 795 - struct xfs_mount *mp = sc->mp; 796 - xfs_agblock_t agbno; 797 - int error; 794 + struct xfs_owner_info oinfo; 795 + struct xfs_mount *mp = sc->mp; 796 + xfs_agblock_t agbno; 797 + int error; 798 798 799 799 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 800 800 return; ··· 820 820 xchk_agi( 821 821 struct xfs_scrub *sc) 822 822 { 823 - struct xfs_mount *mp = sc->mp; 824 - struct xfs_agi *agi; 825 - xfs_agnumber_t agno; 826 - xfs_agblock_t agbno; 827 - xfs_agblock_t eoag; 828 - xfs_agino_t agino; 829 - xfs_agino_t first_agino; 830 - xfs_agino_t last_agino; 831 - xfs_agino_t icount; 832 - int i; 833 - int level; 834 - int error = 0; 823 + struct xfs_mount *mp = sc->mp; 824 + struct xfs_agi *agi; 825 + xfs_agnumber_t agno; 826 + xfs_agblock_t agbno; 827 + xfs_agblock_t eoag; 828 + xfs_agino_t agino; 829 + xfs_agino_t first_agino; 830 + xfs_agino_t last_agino; 831 + xfs_agino_t icount; 832 + int i; 833 + int level; 834 + int error = 0; 835 835 836 836 agno = sc->sa.agno = sc->sm->sm_agno; 837 837 error = xchk_ag_read_headers(sc, agno, &sc->sa.agi_bp,
+4 -4
fs/xfs/scrub/agheader_repair.c
··· 31 31 xrep_superblock( 32 32 struct xfs_scrub *sc) 33 33 { 34 - struct xfs_mount *mp = sc->mp; 35 - struct xfs_buf *bp; 36 - xfs_agnumber_t agno; 37 - int error; 34 + struct xfs_mount *mp = sc->mp; 35 + struct xfs_buf *bp; 36 + xfs_agnumber_t agno; 37 + int error; 38 38 39 39 /* Don't try to repair AG 0's sb; let xfs_repair deal with it. */ 40 40 agno = sc->sm->sm_agno;
+24 -24
fs/xfs/scrub/alloc.c
··· 30 30 int 31 31 xchk_setup_ag_allocbt( 32 32 struct xfs_scrub *sc, 33 - struct xfs_inode *ip) 33 + struct xfs_inode *ip) 34 34 { 35 35 return xchk_setup_ag_btree(sc, ip, false); 36 36 } ··· 43 43 STATIC void 44 44 xchk_allocbt_xref_other( 45 45 struct xfs_scrub *sc, 46 - xfs_agblock_t agbno, 47 - xfs_extlen_t len) 46 + xfs_agblock_t agbno, 47 + xfs_extlen_t len) 48 48 { 49 - struct xfs_btree_cur **pcur; 50 - xfs_agblock_t fbno; 51 - xfs_extlen_t flen; 52 - int has_otherrec; 53 - int error; 49 + struct xfs_btree_cur **pcur; 50 + xfs_agblock_t fbno; 51 + xfs_extlen_t flen; 52 + int has_otherrec; 53 + int error; 54 54 55 55 if (sc->sm->sm_type == XFS_SCRUB_TYPE_BNOBT) 56 56 pcur = &sc->sa.cnt_cur; ··· 83 83 STATIC void 84 84 xchk_allocbt_xref( 85 85 struct xfs_scrub *sc, 86 - xfs_agblock_t agbno, 87 - xfs_extlen_t len) 86 + xfs_agblock_t agbno, 87 + xfs_extlen_t len) 88 88 { 89 89 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 90 90 return; ··· 98 98 /* Scrub a bnobt/cntbt record. */ 99 99 STATIC int 100 100 xchk_allocbt_rec( 101 - struct xchk_btree *bs, 102 - union xfs_btree_rec *rec) 101 + struct xchk_btree *bs, 102 + union xfs_btree_rec *rec) 103 103 { 104 - struct xfs_mount *mp = bs->cur->bc_mp; 105 - xfs_agnumber_t agno = bs->cur->bc_private.a.agno; 106 - xfs_agblock_t bno; 107 - xfs_extlen_t len; 108 - int error = 0; 104 + struct xfs_mount *mp = bs->cur->bc_mp; 105 + xfs_agnumber_t agno = bs->cur->bc_private.a.agno; 106 + xfs_agblock_t bno; 107 + xfs_extlen_t len; 108 + int error = 0; 109 109 110 110 bno = be32_to_cpu(rec->alloc.ar_startblock); 111 111 len = be32_to_cpu(rec->alloc.ar_blockcount); ··· 124 124 STATIC int 125 125 xchk_allocbt( 126 126 struct xfs_scrub *sc, 127 - xfs_btnum_t which) 127 + xfs_btnum_t which) 128 128 { 129 - struct xfs_owner_info oinfo; 130 - struct xfs_btree_cur *cur; 129 + struct xfs_owner_info oinfo; 130 + struct xfs_btree_cur *cur; 131 131 132 132 xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG); 133 133 cur = which == XFS_BTNUM_BNO ? sc->sa.bno_cur : sc->sa.cnt_cur; ··· 152 152 void 153 153 xchk_xref_is_used_space( 154 154 struct xfs_scrub *sc, 155 - xfs_agblock_t agbno, 156 - xfs_extlen_t len) 155 + xfs_agblock_t agbno, 156 + xfs_extlen_t len) 157 157 { 158 - bool is_freesp; 159 - int error; 158 + bool is_freesp; 159 + int error; 160 160 161 161 if (!sc->sa.bno_cur || xchk_skip_xref(sc->sm)) 162 162 return;
+10 -10
fs/xfs/scrub/attr.c
··· 34 34 int 35 35 xchk_setup_xattr( 36 36 struct xfs_scrub *sc, 37 - struct xfs_inode *ip) 37 + struct xfs_inode *ip) 38 38 { 39 - size_t sz; 39 + size_t sz; 40 40 41 41 /* 42 42 * Allocate the buffer without the inode lock held. We need enough ··· 57 57 58 58 struct xchk_xattr { 59 59 struct xfs_attr_list_context context; 60 - struct xfs_scrub *sc; 60 + struct xfs_scrub *sc; 61 61 }; 62 62 63 63 /* ··· 128 128 STATIC bool 129 129 xchk_xattr_set_map( 130 130 struct xfs_scrub *sc, 131 - unsigned long *map, 132 - unsigned int start, 133 - unsigned int len) 131 + unsigned long *map, 132 + unsigned int start, 133 + unsigned int len) 134 134 { 135 - unsigned int mapsize = sc->mp->m_attr_geo->blksize; 136 - bool ret = true; 135 + unsigned int mapsize = sc->mp->m_attr_geo->blksize; 136 + bool ret = true; 137 137 138 138 if (start >= mapsize) 139 139 return false; ··· 155 155 */ 156 156 STATIC bool 157 157 xchk_xattr_check_freemap( 158 - struct xfs_scrub *sc, 158 + struct xfs_scrub *sc, 159 159 unsigned long *map, 160 160 struct xfs_attr3_icleaf_hdr *leafhdr) 161 161 { ··· 405 405 /* Scrub the extended attribute metadata. */ 406 406 int 407 407 xchk_xattr( 408 - struct xfs_scrub *sc) 408 + struct xfs_scrub *sc) 409 409 { 410 410 struct xchk_xattr sx; 411 411 struct attrlist_cursor_kern cursor = { 0 };
+75 -75
fs/xfs/scrub/bmap.c
··· 35 35 int 36 36 xchk_setup_inode_bmap( 37 37 struct xfs_scrub *sc, 38 - struct xfs_inode *ip) 38 + struct xfs_inode *ip) 39 39 { 40 - int error; 40 + int error; 41 41 42 42 error = xchk_get_inode(sc, ip); 43 43 if (error) ··· 80 80 81 81 struct xchk_bmap_info { 82 82 struct xfs_scrub *sc; 83 - xfs_fileoff_t lastoff; 84 - bool is_rt; 85 - bool is_shared; 86 - int whichfork; 83 + xfs_fileoff_t lastoff; 84 + bool is_rt; 85 + bool is_shared; 86 + int whichfork; 87 87 }; 88 88 89 89 /* Look for a corresponding rmap for this irec. */ 90 90 static inline bool 91 91 xchk_bmap_get_rmap( 92 - struct xchk_bmap_info *info, 93 - struct xfs_bmbt_irec *irec, 94 - xfs_agblock_t agbno, 95 - uint64_t owner, 96 - struct xfs_rmap_irec *rmap) 92 + struct xchk_bmap_info *info, 93 + struct xfs_bmbt_irec *irec, 94 + xfs_agblock_t agbno, 95 + uint64_t owner, 96 + struct xfs_rmap_irec *rmap) 97 97 { 98 - xfs_fileoff_t offset; 99 - unsigned int rflags = 0; 100 - int has_rmap; 101 - int error; 98 + xfs_fileoff_t offset; 99 + unsigned int rflags = 0; 100 + int has_rmap; 101 + int error; 102 102 103 103 if (info->whichfork == XFS_ATTR_FORK) 104 104 rflags |= XFS_RMAP_ATTR_FORK; ··· 152 152 /* Make sure that we have rmapbt records for this extent. */ 153 153 STATIC void 154 154 xchk_bmap_xref_rmap( 155 - struct xchk_bmap_info *info, 156 - struct xfs_bmbt_irec *irec, 157 - xfs_agblock_t agbno) 155 + struct xchk_bmap_info *info, 156 + struct xfs_bmbt_irec *irec, 157 + xfs_agblock_t agbno) 158 158 { 159 - struct xfs_rmap_irec rmap; 160 - unsigned long long rmap_end; 161 - uint64_t owner; 159 + struct xfs_rmap_irec rmap; 160 + unsigned long long rmap_end; 161 + uint64_t owner; 162 162 163 163 if (!info->sc->sa.rmap_cur || xchk_skip_xref(info->sc->sm)) 164 164 return; ··· 222 222 /* Cross-reference a single rtdev extent record. */ 223 223 STATIC void 224 224 xchk_bmap_rt_extent_xref( 225 - struct xchk_bmap_info *info, 226 - struct xfs_inode *ip, 227 - struct xfs_btree_cur *cur, 228 - struct xfs_bmbt_irec *irec) 225 + struct xchk_bmap_info *info, 226 + struct xfs_inode *ip, 227 + struct xfs_btree_cur *cur, 228 + struct xfs_bmbt_irec *irec) 229 229 { 230 230 if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 231 231 return; ··· 237 237 /* Cross-reference a single datadev extent record. */ 238 238 STATIC void 239 239 xchk_bmap_extent_xref( 240 - struct xchk_bmap_info *info, 241 - struct xfs_inode *ip, 242 - struct xfs_btree_cur *cur, 243 - struct xfs_bmbt_irec *irec) 240 + struct xchk_bmap_info *info, 241 + struct xfs_inode *ip, 242 + struct xfs_btree_cur *cur, 243 + struct xfs_bmbt_irec *irec) 244 244 { 245 - struct xfs_mount *mp = info->sc->mp; 246 - xfs_agnumber_t agno; 247 - xfs_agblock_t agbno; 248 - xfs_extlen_t len; 249 - int error; 245 + struct xfs_mount *mp = info->sc->mp; 246 + xfs_agnumber_t agno; 247 + xfs_agblock_t agbno; 248 + xfs_extlen_t len; 249 + int error; 250 250 251 251 if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 252 252 return; ··· 284 284 /* Scrub a single extent record. */ 285 285 STATIC int 286 286 xchk_bmap_extent( 287 - struct xfs_inode *ip, 288 - struct xfs_btree_cur *cur, 289 - struct xchk_bmap_info *info, 290 - struct xfs_bmbt_irec *irec) 287 + struct xfs_inode *ip, 288 + struct xfs_btree_cur *cur, 289 + struct xchk_bmap_info *info, 290 + struct xfs_bmbt_irec *irec) 291 291 { 292 - struct xfs_mount *mp = info->sc->mp; 293 - struct xfs_buf *bp = NULL; 294 - xfs_filblks_t end; 295 - int error = 0; 292 + struct xfs_mount *mp = info->sc->mp; 293 + struct xfs_buf *bp = NULL; 294 + xfs_filblks_t end; 295 + int error = 0; 296 296 297 297 if (cur) 298 298 xfs_btree_get_block(cur, 0, &bp); ··· 357 357 /* Scrub a bmbt record. */ 358 358 STATIC int 359 359 xchk_bmapbt_rec( 360 - struct xchk_btree *bs, 361 - union xfs_btree_rec *rec) 360 + struct xchk_btree *bs, 361 + union xfs_btree_rec *rec) 362 362 { 363 - struct xfs_bmbt_irec irec; 364 - struct xchk_bmap_info *info = bs->private; 365 - struct xfs_inode *ip = bs->cur->bc_private.b.ip; 366 - struct xfs_buf *bp = NULL; 367 - struct xfs_btree_block *block; 368 - uint64_t owner; 369 - int i; 363 + struct xfs_bmbt_irec irec; 364 + struct xchk_bmap_info *info = bs->private; 365 + struct xfs_inode *ip = bs->cur->bc_private.b.ip; 366 + struct xfs_buf *bp = NULL; 367 + struct xfs_btree_block *block; 368 + uint64_t owner; 369 + int i; 370 370 371 371 /* 372 372 * Check the owners of the btree blocks up to the level below ··· 392 392 STATIC int 393 393 xchk_bmap_btree( 394 394 struct xfs_scrub *sc, 395 - int whichfork, 396 - struct xchk_bmap_info *info) 395 + int whichfork, 396 + struct xchk_bmap_info *info) 397 397 { 398 - struct xfs_owner_info oinfo; 399 - struct xfs_mount *mp = sc->mp; 400 - struct xfs_inode *ip = sc->ip; 401 - struct xfs_btree_cur *cur; 402 - int error; 398 + struct xfs_owner_info oinfo; 399 + struct xfs_mount *mp = sc->mp; 400 + struct xfs_inode *ip = sc->ip; 401 + struct xfs_btree_cur *cur; 402 + int error; 403 403 404 404 cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork); 405 405 xfs_rmap_ino_bmbt_owner(&oinfo, ip->i_ino, whichfork); ··· 410 410 411 411 struct xchk_bmap_check_rmap_info { 412 412 struct xfs_scrub *sc; 413 - int whichfork; 414 - struct xfs_iext_cursor icur; 413 + int whichfork; 414 + struct xfs_iext_cursor icur; 415 415 }; 416 416 417 417 /* Can we find bmaps that fit this rmap? */ ··· 424 424 struct xfs_bmbt_irec irec; 425 425 struct xchk_bmap_check_rmap_info *sbcri = priv; 426 426 struct xfs_ifork *ifp; 427 - struct xfs_scrub *sc = sbcri->sc; 427 + struct xfs_scrub *sc = sbcri->sc; 428 428 bool have_map; 429 429 430 430 /* Is this even the right fork? */ ··· 488 488 /* Make sure each rmap has a corresponding bmbt entry. */ 489 489 STATIC int 490 490 xchk_bmap_check_ag_rmaps( 491 - struct xfs_scrub *sc, 491 + struct xfs_scrub *sc, 492 492 int whichfork, 493 493 xfs_agnumber_t agno) 494 494 { ··· 523 523 STATIC int 524 524 xchk_bmap_check_rmaps( 525 525 struct xfs_scrub *sc, 526 - int whichfork) 526 + int whichfork) 527 527 { 528 - loff_t size; 529 - xfs_agnumber_t agno; 530 - int error; 528 + loff_t size; 529 + xfs_agnumber_t agno; 530 + int error; 531 531 532 532 if (!xfs_sb_version_hasrmapbt(&sc->mp->m_sb) || 533 533 whichfork == XFS_COW_FORK || ··· 580 580 STATIC int 581 581 xchk_bmap( 582 582 struct xfs_scrub *sc, 583 - int whichfork) 583 + int whichfork) 584 584 { 585 - struct xfs_bmbt_irec irec; 586 - struct xchk_bmap_info info = { NULL }; 587 - struct xfs_mount *mp = sc->mp; 588 - struct xfs_inode *ip = sc->ip; 589 - struct xfs_ifork *ifp; 590 - xfs_fileoff_t endoff; 591 - struct xfs_iext_cursor icur; 592 - int error = 0; 585 + struct xfs_bmbt_irec irec; 586 + struct xchk_bmap_info info = { NULL }; 587 + struct xfs_mount *mp = sc->mp; 588 + struct xfs_inode *ip = sc->ip; 589 + struct xfs_ifork *ifp; 590 + xfs_fileoff_t endoff; 591 + struct xfs_iext_cursor icur; 592 + int error = 0; 593 593 594 594 ifp = XFS_IFORK_PTR(ip, whichfork); 595 595
+86 -86
fs/xfs/scrub/btree.c
··· 31 31 static bool 32 32 __xchk_btree_process_error( 33 33 struct xfs_scrub *sc, 34 - struct xfs_btree_cur *cur, 35 - int level, 36 - int *error, 37 - __u32 errflag, 38 - void *ret_ip) 34 + struct xfs_btree_cur *cur, 35 + int level, 36 + int *error, 37 + __u32 errflag, 38 + void *ret_ip) 39 39 { 40 40 if (*error == 0) 41 41 return true; ··· 66 66 bool 67 67 xchk_btree_process_error( 68 68 struct xfs_scrub *sc, 69 - struct xfs_btree_cur *cur, 70 - int level, 71 - int *error) 69 + struct xfs_btree_cur *cur, 70 + int level, 71 + int *error) 72 72 { 73 73 return __xchk_btree_process_error(sc, cur, level, error, 74 74 XFS_SCRUB_OFLAG_CORRUPT, __return_address); ··· 77 77 bool 78 78 xchk_btree_xref_process_error( 79 79 struct xfs_scrub *sc, 80 - struct xfs_btree_cur *cur, 81 - int level, 82 - int *error) 80 + struct xfs_btree_cur *cur, 81 + int level, 82 + int *error) 83 83 { 84 84 return __xchk_btree_process_error(sc, cur, level, error, 85 85 XFS_SCRUB_OFLAG_XFAIL, __return_address); ··· 89 89 static void 90 90 __xchk_btree_set_corrupt( 91 91 struct xfs_scrub *sc, 92 - struct xfs_btree_cur *cur, 93 - int level, 94 - __u32 errflag, 95 - void *ret_ip) 92 + struct xfs_btree_cur *cur, 93 + int level, 94 + __u32 errflag, 95 + void *ret_ip) 96 96 { 97 97 sc->sm->sm_flags |= errflag; 98 98 ··· 107 107 void 108 108 xchk_btree_set_corrupt( 109 109 struct xfs_scrub *sc, 110 - struct xfs_btree_cur *cur, 111 - int level) 110 + struct xfs_btree_cur *cur, 111 + int level) 112 112 { 113 113 __xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_CORRUPT, 114 114 __return_address); ··· 117 117 void 118 118 xchk_btree_xref_set_corrupt( 119 119 struct xfs_scrub *sc, 120 - struct xfs_btree_cur *cur, 121 - int level) 120 + struct xfs_btree_cur *cur, 121 + int level) 122 122 { 123 123 __xchk_btree_set_corrupt(sc, cur, level, XFS_SCRUB_OFLAG_XCORRUPT, 124 124 __return_address); ··· 225 225 */ 226 226 static bool 227 227 xchk_btree_ptr_ok( 228 - struct xchk_btree *bs, 229 - int level, 230 - union xfs_btree_ptr *ptr) 228 + struct xchk_btree *bs, 229 + int level, 230 + union xfs_btree_ptr *ptr) 231 231 { 232 - bool res; 232 + bool res; 233 233 234 234 /* A btree rooted in an inode has no block pointer to the root. */ 235 235 if ((bs->cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && ··· 250 250 /* Check that a btree block's sibling matches what we expect it. */ 251 251 STATIC int 252 252 xchk_btree_block_check_sibling( 253 - struct xchk_btree *bs, 254 - int level, 255 - int direction, 256 - union xfs_btree_ptr *sibling) 253 + struct xchk_btree *bs, 254 + int level, 255 + int direction, 256 + union xfs_btree_ptr *sibling) 257 257 { 258 - struct xfs_btree_cur *cur = bs->cur; 259 - struct xfs_btree_block *pblock; 260 - struct xfs_buf *pbp; 261 - struct xfs_btree_cur *ncur = NULL; 262 - union xfs_btree_ptr *pp; 263 - int success; 264 - int error; 258 + struct xfs_btree_cur *cur = bs->cur; 259 + struct xfs_btree_block *pblock; 260 + struct xfs_buf *pbp; 261 + struct xfs_btree_cur *ncur = NULL; 262 + union xfs_btree_ptr *pp; 263 + int success; 264 + int error; 265 265 266 266 error = xfs_btree_dup_cursor(cur, &ncur); 267 267 if (!xchk_btree_process_error(bs->sc, cur, level + 1, &error) || ··· 313 313 /* Check the siblings of a btree block. */ 314 314 STATIC int 315 315 xchk_btree_block_check_siblings( 316 - struct xchk_btree *bs, 317 - struct xfs_btree_block *block) 316 + struct xchk_btree *bs, 317 + struct xfs_btree_block *block) 318 318 { 319 - struct xfs_btree_cur *cur = bs->cur; 320 - union xfs_btree_ptr leftsib; 321 - union xfs_btree_ptr rightsib; 322 - int level; 323 - int error = 0; 319 + struct xfs_btree_cur *cur = bs->cur; 320 + union xfs_btree_ptr leftsib; 321 + union xfs_btree_ptr rightsib; 322 + int level; 323 + int error = 0; 324 324 325 325 xfs_btree_get_sibling(cur, block, &leftsib, XFS_BB_LEFTSIB); 326 326 xfs_btree_get_sibling(cur, block, &rightsib, XFS_BB_RIGHTSIB); ··· 361 361 */ 362 362 STATIC int 363 363 xchk_btree_check_block_owner( 364 - struct xchk_btree *bs, 365 - int level, 366 - xfs_daddr_t daddr) 364 + struct xchk_btree *bs, 365 + int level, 366 + xfs_daddr_t daddr) 367 367 { 368 - xfs_agnumber_t agno; 369 - xfs_agblock_t agbno; 370 - xfs_btnum_t btnum; 371 - bool init_sa; 372 - int error = 0; 368 + xfs_agnumber_t agno; 369 + xfs_agblock_t agbno; 370 + xfs_btnum_t btnum; 371 + bool init_sa; 372 + int error = 0; 373 373 374 374 if (!bs->cur) 375 375 return 0; ··· 408 408 /* Check the owner of a btree block. */ 409 409 STATIC int 410 410 xchk_btree_check_owner( 411 - struct xchk_btree *bs, 412 - int level, 413 - struct xfs_buf *bp) 411 + struct xchk_btree *bs, 412 + int level, 413 + struct xfs_buf *bp) 414 414 { 415 - struct xfs_btree_cur *cur = bs->cur; 416 - struct check_owner *co; 415 + struct xfs_btree_cur *cur = bs->cur; 416 + struct check_owner *co; 417 417 418 418 if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) && bp == NULL) 419 419 return 0; ··· 484 484 */ 485 485 STATIC int 486 486 xchk_btree_get_block( 487 - struct xchk_btree *bs, 488 - int level, 489 - union xfs_btree_ptr *pp, 490 - struct xfs_btree_block **pblock, 491 - struct xfs_buf **pbp) 487 + struct xchk_btree *bs, 488 + int level, 489 + union xfs_btree_ptr *pp, 490 + struct xfs_btree_block **pblock, 491 + struct xfs_buf **pbp) 492 492 { 493 - void *failed_at; 494 - int error; 493 + xfs_failaddr_t failed_at; 494 + int error; 495 495 496 496 *pblock = NULL; 497 497 *pbp = NULL; ··· 538 538 */ 539 539 STATIC void 540 540 xchk_btree_block_keys( 541 - struct xchk_btree *bs, 542 - int level, 543 - struct xfs_btree_block *block) 541 + struct xchk_btree *bs, 542 + int level, 543 + struct xfs_btree_block *block) 544 544 { 545 - union xfs_btree_key block_keys; 546 - struct xfs_btree_cur *cur = bs->cur; 547 - union xfs_btree_key *high_bk; 548 - union xfs_btree_key *parent_keys; 549 - union xfs_btree_key *high_pk; 550 - struct xfs_btree_block *parent_block; 551 - struct xfs_buf *bp; 545 + union xfs_btree_key block_keys; 546 + struct xfs_btree_cur *cur = bs->cur; 547 + union xfs_btree_key *high_bk; 548 + union xfs_btree_key *parent_keys; 549 + union xfs_btree_key *high_pk; 550 + struct xfs_btree_block *parent_block; 551 + struct xfs_buf *bp; 552 552 553 553 if (level >= cur->bc_nlevels - 1) 554 554 return; ··· 584 584 int 585 585 xchk_btree( 586 586 struct xfs_scrub *sc, 587 - struct xfs_btree_cur *cur, 588 - xchk_btree_rec_fn scrub_fn, 589 - struct xfs_owner_info *oinfo, 590 - void *private) 587 + struct xfs_btree_cur *cur, 588 + xchk_btree_rec_fn scrub_fn, 589 + struct xfs_owner_info *oinfo, 590 + void *private) 591 591 { 592 - struct xchk_btree bs = { NULL }; 593 - union xfs_btree_ptr ptr; 594 - union xfs_btree_ptr *pp; 595 - union xfs_btree_rec *recp; 596 - struct xfs_btree_block *block; 597 - int level; 598 - struct xfs_buf *bp; 599 - struct check_owner *co; 600 - struct check_owner *n; 601 - int i; 602 - int error = 0; 592 + struct xchk_btree bs = { NULL }; 593 + union xfs_btree_ptr ptr; 594 + union xfs_btree_ptr *pp; 595 + union xfs_btree_rec *recp; 596 + struct xfs_btree_block *block; 597 + int level; 598 + struct xfs_buf *bp; 599 + struct check_owner *co; 600 + struct check_owner *n; 601 + int i; 602 + int error = 0; 603 603 604 604 /* Initialize scrub state */ 605 605 bs.cur = cur;
+12 -13
fs/xfs/scrub/btree.h
··· 14 14 15 15 /* Check for btree xref operation errors. */ 16 16 bool xchk_btree_xref_process_error(struct xfs_scrub *sc, 17 - struct xfs_btree_cur *cur, int level, 18 - int *error); 17 + struct xfs_btree_cur *cur, int level, int *error); 19 18 20 19 /* Check for btree corruption. */ 21 20 void xchk_btree_set_corrupt(struct xfs_scrub *sc, ··· 32 33 struct xchk_btree { 33 34 /* caller-provided scrub state */ 34 35 struct xfs_scrub *sc; 35 - struct xfs_btree_cur *cur; 36 - xchk_btree_rec_fn scrub_rec; 37 - struct xfs_owner_info *oinfo; 38 - void *private; 36 + struct xfs_btree_cur *cur; 37 + xchk_btree_rec_fn scrub_rec; 38 + struct xfs_owner_info *oinfo; 39 + void *private; 39 40 40 41 /* internal scrub state */ 41 - union xfs_btree_rec lastrec; 42 - bool firstrec; 43 - union xfs_btree_key lastkey[XFS_BTREE_MAXLEVELS]; 44 - bool firstkey[XFS_BTREE_MAXLEVELS]; 45 - struct list_head to_check; 42 + union xfs_btree_rec lastrec; 43 + bool firstrec; 44 + union xfs_btree_key lastkey[XFS_BTREE_MAXLEVELS]; 45 + bool firstkey[XFS_BTREE_MAXLEVELS]; 46 + struct list_head to_check; 46 47 }; 47 48 int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 48 - xchk_btree_rec_fn scrub_fn, 49 - struct xfs_owner_info *oinfo, void *private); 49 + xchk_btree_rec_fn scrub_fn, struct xfs_owner_info *oinfo, 50 + void *private); 50 51 51 52 #endif /* __XFS_SCRUB_BTREE_H__ */
+79 -79
fs/xfs/scrub/common.c
··· 70 70 static bool 71 71 __xchk_process_error( 72 72 struct xfs_scrub *sc, 73 - xfs_agnumber_t agno, 74 - xfs_agblock_t bno, 75 - int *error, 76 - __u32 errflag, 77 - void *ret_ip) 73 + xfs_agnumber_t agno, 74 + xfs_agblock_t bno, 75 + int *error, 76 + __u32 errflag, 77 + void *ret_ip) 78 78 { 79 79 switch (*error) { 80 80 case 0: ··· 100 100 bool 101 101 xchk_process_error( 102 102 struct xfs_scrub *sc, 103 - xfs_agnumber_t agno, 104 - xfs_agblock_t bno, 105 - int *error) 103 + xfs_agnumber_t agno, 104 + xfs_agblock_t bno, 105 + int *error) 106 106 { 107 107 return __xchk_process_error(sc, agno, bno, error, 108 108 XFS_SCRUB_OFLAG_CORRUPT, __return_address); ··· 111 111 bool 112 112 xchk_xref_process_error( 113 113 struct xfs_scrub *sc, 114 - xfs_agnumber_t agno, 115 - xfs_agblock_t bno, 116 - int *error) 114 + xfs_agnumber_t agno, 115 + xfs_agblock_t bno, 116 + int *error) 117 117 { 118 118 return __xchk_process_error(sc, agno, bno, error, 119 119 XFS_SCRUB_OFLAG_XFAIL, __return_address); ··· 123 123 static bool 124 124 __xchk_fblock_process_error( 125 125 struct xfs_scrub *sc, 126 - int whichfork, 127 - xfs_fileoff_t offset, 128 - int *error, 129 - __u32 errflag, 130 - void *ret_ip) 126 + int whichfork, 127 + xfs_fileoff_t offset, 128 + int *error, 129 + __u32 errflag, 130 + void *ret_ip) 131 131 { 132 132 switch (*error) { 133 133 case 0: ··· 153 153 bool 154 154 xchk_fblock_process_error( 155 155 struct xfs_scrub *sc, 156 - int whichfork, 157 - xfs_fileoff_t offset, 158 - int *error) 156 + int whichfork, 157 + xfs_fileoff_t offset, 158 + int *error) 159 159 { 160 160 return __xchk_fblock_process_error(sc, whichfork, offset, error, 161 161 XFS_SCRUB_OFLAG_CORRUPT, __return_address); ··· 164 164 bool 165 165 xchk_fblock_xref_process_error( 166 166 struct xfs_scrub *sc, 167 - int whichfork, 168 - xfs_fileoff_t offset, 169 - int *error) 167 + int whichfork, 168 + xfs_fileoff_t offset, 169 + int *error) 170 170 { 171 171 return __xchk_fblock_process_error(sc, whichfork, offset, error, 172 172 XFS_SCRUB_OFLAG_XFAIL, __return_address); ··· 188 188 void 189 189 xchk_block_set_preen( 190 190 struct xfs_scrub *sc, 191 - struct xfs_buf *bp) 191 + struct xfs_buf *bp) 192 192 { 193 193 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; 194 194 trace_xchk_block_preen(sc, bp->b_bn, __return_address); ··· 202 202 void 203 203 xchk_ino_set_preen( 204 204 struct xfs_scrub *sc, 205 - xfs_ino_t ino) 205 + xfs_ino_t ino) 206 206 { 207 207 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; 208 208 trace_xchk_ino_preen(sc, ino, __return_address); ··· 212 212 void 213 213 xchk_block_set_corrupt( 214 214 struct xfs_scrub *sc, 215 - struct xfs_buf *bp) 215 + struct xfs_buf *bp) 216 216 { 217 217 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; 218 218 trace_xchk_block_error(sc, bp->b_bn, __return_address); ··· 222 222 void 223 223 xchk_block_xref_set_corrupt( 224 224 struct xfs_scrub *sc, 225 - struct xfs_buf *bp) 225 + struct xfs_buf *bp) 226 226 { 227 227 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; 228 228 trace_xchk_block_error(sc, bp->b_bn, __return_address); ··· 236 236 void 237 237 xchk_ino_set_corrupt( 238 238 struct xfs_scrub *sc, 239 - xfs_ino_t ino) 239 + xfs_ino_t ino) 240 240 { 241 241 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; 242 242 trace_xchk_ino_error(sc, ino, __return_address); ··· 246 246 void 247 247 xchk_ino_xref_set_corrupt( 248 248 struct xfs_scrub *sc, 249 - xfs_ino_t ino) 249 + xfs_ino_t ino) 250 250 { 251 251 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; 252 252 trace_xchk_ino_error(sc, ino, __return_address); ··· 256 256 void 257 257 xchk_fblock_set_corrupt( 258 258 struct xfs_scrub *sc, 259 - int whichfork, 260 - xfs_fileoff_t offset) 259 + int whichfork, 260 + xfs_fileoff_t offset) 261 261 { 262 262 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; 263 263 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); ··· 267 267 void 268 268 xchk_fblock_xref_set_corrupt( 269 269 struct xfs_scrub *sc, 270 - int whichfork, 271 - xfs_fileoff_t offset) 270 + int whichfork, 271 + xfs_fileoff_t offset) 272 272 { 273 273 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; 274 274 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); ··· 281 281 void 282 282 xchk_ino_set_warning( 283 283 struct xfs_scrub *sc, 284 - xfs_ino_t ino) 284 + xfs_ino_t ino) 285 285 { 286 286 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; 287 287 trace_xchk_ino_warning(sc, ino, __return_address); ··· 291 291 void 292 292 xchk_fblock_set_warning( 293 293 struct xfs_scrub *sc, 294 - int whichfork, 295 - xfs_fileoff_t offset) 294 + int whichfork, 295 + xfs_fileoff_t offset) 296 296 { 297 297 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; 298 298 trace_xchk_fblock_warning(sc, whichfork, offset, __return_address); ··· 319 319 320 320 STATIC int 321 321 xchk_count_rmap_ownedby_irec( 322 - struct xfs_btree_cur *cur, 323 - struct xfs_rmap_irec *rec, 324 - void *priv) 322 + struct xfs_btree_cur *cur, 323 + struct xfs_rmap_irec *rec, 324 + void *priv) 325 325 { 326 - struct xchk_rmap_ownedby_info *sroi = priv; 327 - bool irec_attr; 328 - bool oinfo_attr; 326 + struct xchk_rmap_ownedby_info *sroi = priv; 327 + bool irec_attr; 328 + bool oinfo_attr; 329 329 330 330 irec_attr = rec->rm_flags & XFS_RMAP_ATTR_FORK; 331 331 oinfo_attr = sroi->oinfo->oi_flags & XFS_OWNER_INFO_ATTR_FORK; ··· 346 346 int 347 347 xchk_count_rmap_ownedby_ag( 348 348 struct xfs_scrub *sc, 349 - struct xfs_btree_cur *cur, 350 - struct xfs_owner_info *oinfo, 351 - xfs_filblks_t *blocks) 349 + struct xfs_btree_cur *cur, 350 + struct xfs_owner_info *oinfo, 351 + xfs_filblks_t *blocks) 352 352 { 353 - struct xchk_rmap_ownedby_info sroi; 353 + struct xchk_rmap_ownedby_info sroi; 354 354 355 355 sroi.oinfo = oinfo; 356 356 *blocks = 0; ··· 372 372 static inline bool 373 373 want_ag_read_header_failure( 374 374 struct xfs_scrub *sc, 375 - unsigned int type) 375 + unsigned int type) 376 376 { 377 377 /* Return all AG header read failures when scanning btrees. */ 378 378 if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && ··· 399 399 int 400 400 xchk_ag_read_headers( 401 401 struct xfs_scrub *sc, 402 - xfs_agnumber_t agno, 403 - struct xfs_buf **agi, 404 - struct xfs_buf **agf, 405 - struct xfs_buf **agfl) 402 + xfs_agnumber_t agno, 403 + struct xfs_buf **agi, 404 + struct xfs_buf **agf, 405 + struct xfs_buf **agfl) 406 406 { 407 - struct xfs_mount *mp = sc->mp; 408 - int error; 407 + struct xfs_mount *mp = sc->mp; 408 + int error; 409 409 410 410 error = xfs_ialloc_read_agi(mp, sc->tp, agno, agi); 411 411 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) ··· 455 455 struct xfs_scrub *sc, 456 456 struct xchk_ag *sa) 457 457 { 458 - struct xfs_mount *mp = sc->mp; 459 - xfs_agnumber_t agno = sa->agno; 458 + struct xfs_mount *mp = sc->mp; 459 + xfs_agnumber_t agno = sa->agno; 460 460 461 461 if (sa->agf_bp) { 462 462 /* Set up a bnobt cursor for cross-referencing. */ ··· 545 545 int 546 546 xchk_ag_init( 547 547 struct xfs_scrub *sc, 548 - xfs_agnumber_t agno, 548 + xfs_agnumber_t agno, 549 549 struct xchk_ag *sa) 550 550 { 551 - int error; 551 + int error; 552 552 553 553 sa->agno = agno; 554 554 error = xchk_ag_read_headers(sc, agno, &sa->agi_bp, ··· 566 566 void 567 567 xchk_perag_get( 568 568 struct xfs_mount *mp, 569 - struct xchk_ag *sa) 569 + struct xchk_ag *sa) 570 570 { 571 571 if (!sa->pag) 572 572 sa->pag = xfs_perag_get(mp, sa->agno); ··· 587 587 int 588 588 xchk_trans_alloc( 589 589 struct xfs_scrub *sc, 590 - uint resblks) 590 + uint resblks) 591 591 { 592 592 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) 593 593 return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, ··· 600 600 int 601 601 xchk_setup_fs( 602 602 struct xfs_scrub *sc, 603 - struct xfs_inode *ip) 603 + struct xfs_inode *ip) 604 604 { 605 - uint resblks; 605 + uint resblks; 606 606 607 607 resblks = xrep_calc_ag_resblks(sc); 608 608 return xchk_trans_alloc(sc, resblks); ··· 612 612 int 613 613 xchk_setup_ag_btree( 614 614 struct xfs_scrub *sc, 615 - struct xfs_inode *ip, 616 - bool force_log) 615 + struct xfs_inode *ip, 616 + bool force_log) 617 617 { 618 - struct xfs_mount *mp = sc->mp; 619 - int error; 618 + struct xfs_mount *mp = sc->mp; 619 + int error; 620 620 621 621 /* 622 622 * If the caller asks us to checkpont the log, do so. This ··· 659 659 int 660 660 xchk_get_inode( 661 661 struct xfs_scrub *sc, 662 - struct xfs_inode *ip_in) 662 + struct xfs_inode *ip_in) 663 663 { 664 - struct xfs_imap imap; 665 - struct xfs_mount *mp = sc->mp; 666 - struct xfs_inode *ip = NULL; 667 - int error; 664 + struct xfs_imap imap; 665 + struct xfs_mount *mp = sc->mp; 666 + struct xfs_inode *ip = NULL; 667 + int error; 668 668 669 669 /* We want to scan the inode we already had opened. */ 670 670 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) { ··· 723 723 int 724 724 xchk_setup_inode_contents( 725 725 struct xfs_scrub *sc, 726 - struct xfs_inode *ip, 727 - unsigned int resblks) 726 + struct xfs_inode *ip, 727 + unsigned int resblks) 728 728 { 729 - int error; 729 + int error; 730 730 731 731 error = xchk_get_inode(sc, ip); 732 732 if (error) ··· 754 754 bool 755 755 xchk_should_check_xref( 756 756 struct xfs_scrub *sc, 757 - int *error, 758 - struct xfs_btree_cur **curpp) 757 + int *error, 758 + struct xfs_btree_cur **curpp) 759 759 { 760 760 /* No point in xref if we already know we're corrupt. */ 761 761 if (xchk_skip_xref(sc->sm)) ··· 789 789 void 790 790 xchk_buffer_recheck( 791 791 struct xfs_scrub *sc, 792 - struct xfs_buf *bp) 792 + struct xfs_buf *bp) 793 793 { 794 - xfs_failaddr_t fa; 794 + xfs_failaddr_t fa; 795 795 796 796 if (bp->b_ops == NULL) { 797 797 xchk_block_set_corrupt(sc, bp); ··· 816 816 xchk_metadata_inode_forks( 817 817 struct xfs_scrub *sc) 818 818 { 819 - __u32 smtype; 820 - bool shared; 821 - int error; 819 + __u32 smtype; 820 + bool shared; 821 + int error; 822 822 823 823 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 824 824 return 0;
+10 -13
fs/xfs/scrub/common.h
··· 108 108 109 109 void xchk_ag_free(struct xfs_scrub *sc, struct xchk_ag *sa); 110 110 int xchk_ag_init(struct xfs_scrub *sc, xfs_agnumber_t agno, 111 - struct xchk_ag *sa); 111 + struct xchk_ag *sa); 112 112 void xchk_perag_get(struct xfs_mount *mp, struct xchk_ag *sa); 113 113 int xchk_ag_read_headers(struct xfs_scrub *sc, xfs_agnumber_t agno, 114 - struct xfs_buf **agi, struct xfs_buf **agf, 115 - struct xfs_buf **agfl); 114 + struct xfs_buf **agi, struct xfs_buf **agf, 115 + struct xfs_buf **agfl); 116 116 void xchk_ag_btcur_free(struct xchk_ag *sa); 117 - int xchk_ag_btcur_init(struct xfs_scrub *sc, 118 - struct xchk_ag *sa); 119 - int xchk_count_rmap_ownedby_ag(struct xfs_scrub *sc, 120 - struct xfs_btree_cur *cur, 121 - struct xfs_owner_info *oinfo, 122 - xfs_filblks_t *blocks); 117 + int xchk_ag_btcur_init(struct xfs_scrub *sc, struct xchk_ag *sa); 118 + int xchk_count_rmap_ownedby_ag(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 119 + struct xfs_owner_info *oinfo, xfs_filblks_t *blocks); 123 120 124 - int xchk_setup_ag_btree(struct xfs_scrub *sc, 125 - struct xfs_inode *ip, bool force_log); 121 + int xchk_setup_ag_btree(struct xfs_scrub *sc, struct xfs_inode *ip, 122 + bool force_log); 126 123 int xchk_get_inode(struct xfs_scrub *sc, struct xfs_inode *ip_in); 127 - int xchk_setup_inode_contents(struct xfs_scrub *sc, 128 - struct xfs_inode *ip, unsigned int resblks); 124 + int xchk_setup_inode_contents(struct xfs_scrub *sc, struct xfs_inode *ip, 125 + unsigned int resblks); 129 126 void xchk_buffer_recheck(struct xfs_scrub *sc, struct xfs_buf *bp); 130 127 131 128 /*
+28 -28
fs/xfs/scrub/dabtree.c
··· 36 36 */ 37 37 bool 38 38 xchk_da_process_error( 39 - struct xchk_da_btree *ds, 40 - int level, 41 - int *error) 39 + struct xchk_da_btree *ds, 40 + int level, 41 + int *error) 42 42 { 43 43 struct xfs_scrub *sc = ds->sc; 44 44 ··· 72 72 */ 73 73 void 74 74 xchk_da_set_corrupt( 75 - struct xchk_da_btree *ds, 76 - int level) 75 + struct xchk_da_btree *ds, 76 + int level) 77 77 { 78 78 struct xfs_scrub *sc = ds->sc; 79 79 ··· 88 88 /* Find an entry at a certain level in a da btree. */ 89 89 STATIC void * 90 90 xchk_da_btree_entry( 91 - struct xchk_da_btree *ds, 92 - int level, 93 - int rec) 91 + struct xchk_da_btree *ds, 92 + int level, 93 + int rec) 94 94 { 95 - char *ents; 96 - struct xfs_da_state_blk *blk; 97 - void *baddr; 95 + char *ents; 96 + struct xfs_da_state_blk *blk; 97 + void *baddr; 98 98 99 99 /* Dispatch the entry finding function. */ 100 100 blk = &ds->state->path.blk[level]; ··· 158 158 */ 159 159 STATIC bool 160 160 xchk_da_btree_ptr_ok( 161 - struct xchk_da_btree *ds, 162 - int level, 163 - xfs_dablk_t blkno) 161 + struct xchk_da_btree *ds, 162 + int level, 163 + xfs_dablk_t blkno) 164 164 { 165 165 if (blkno < ds->lowest || (ds->highest != 0 && blkno >= ds->highest)) { 166 166 xchk_da_set_corrupt(ds, level); ··· 246 246 /* Check a block's sibling. */ 247 247 STATIC int 248 248 xchk_da_btree_block_check_sibling( 249 - struct xchk_da_btree *ds, 250 - int level, 251 - int direction, 252 - xfs_dablk_t sibling) 249 + struct xchk_da_btree *ds, 250 + int level, 251 + int direction, 252 + xfs_dablk_t sibling) 253 253 { 254 - int retval; 255 - int error; 254 + int retval; 255 + int error; 256 256 257 257 memcpy(&ds->state->altpath, &ds->state->path, 258 258 sizeof(ds->state->altpath)); ··· 294 294 /* Check a block's sibling pointers. */ 295 295 STATIC int 296 296 xchk_da_btree_block_check_siblings( 297 - struct xchk_da_btree *ds, 298 - int level, 299 - struct xfs_da_blkinfo *hdr) 297 + struct xchk_da_btree *ds, 298 + int level, 299 + struct xfs_da_blkinfo *hdr) 300 300 { 301 - xfs_dablk_t forw; 302 - xfs_dablk_t back; 303 - int error = 0; 301 + xfs_dablk_t forw; 302 + xfs_dablk_t back; 303 + int error = 0; 304 304 305 305 forw = be32_to_cpu(hdr->forw); 306 306 back = be32_to_cpu(hdr->back); ··· 474 474 /* Visit all nodes and leaves of a da btree. */ 475 475 int 476 476 xchk_da_btree( 477 - struct xfs_scrub *sc, 477 + struct xfs_scrub *sc, 478 478 int whichfork, 479 - xchk_da_btree_rec_fn scrub_fn, 479 + xchk_da_btree_rec_fn scrub_fn, 480 480 void *private) 481 481 { 482 482 struct xchk_da_btree ds = {};
+10 -11
fs/xfs/scrub/dabtree.h
··· 9 9 /* dir/attr btree */ 10 10 11 11 struct xchk_da_btree { 12 - struct xfs_da_args dargs; 13 - xfs_dahash_t hashes[XFS_DA_NODE_MAXDEPTH]; 14 - int maxrecs[XFS_DA_NODE_MAXDEPTH]; 15 - struct xfs_da_state *state; 12 + struct xfs_da_args dargs; 13 + xfs_dahash_t hashes[XFS_DA_NODE_MAXDEPTH]; 14 + int maxrecs[XFS_DA_NODE_MAXDEPTH]; 15 + struct xfs_da_state *state; 16 16 struct xfs_scrub *sc; 17 - void *private; 17 + void *private; 18 18 19 19 /* 20 20 * Lowest and highest directory block address in which we expect ··· 22 22 * (presumably) means between LEAF_OFFSET and FREE_OFFSET; for 23 23 * attributes there is no limit. 24 24 */ 25 - xfs_dablk_t lowest; 26 - xfs_dablk_t highest; 25 + xfs_dablk_t lowest; 26 + xfs_dablk_t highest; 27 27 28 - int tree_level; 28 + int tree_level; 29 29 }; 30 30 31 31 typedef int (*xchk_da_btree_rec_fn)(struct xchk_da_btree *ds, ··· 37 37 /* Check for da btree corruption. */ 38 38 void xchk_da_set_corrupt(struct xchk_da_btree *ds, int level); 39 39 40 - int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, 41 - __be32 *hashp); 40 + int xchk_da_btree_hash(struct xchk_da_btree *ds, int level, __be32 *hashp); 42 41 int xchk_da_btree(struct xfs_scrub *sc, int whichfork, 43 - xchk_da_btree_rec_fn scrub_fn, void *private); 42 + xchk_da_btree_rec_fn scrub_fn, void *private); 44 43 45 44 #endif /* __XFS_SCRUB_DABTREE_H__ */
+44 -44
fs/xfs/scrub/dir.c
··· 33 33 int 34 34 xchk_setup_directory( 35 35 struct xfs_scrub *sc, 36 - struct xfs_inode *ip) 36 + struct xfs_inode *ip) 37 37 { 38 38 return xchk_setup_inode_contents(sc, ip, 0); 39 39 } ··· 44 44 45 45 struct xchk_dir_ctx { 46 46 /* VFS fill-directory iterator */ 47 - struct dir_context dir_iter; 47 + struct dir_context dir_iter; 48 48 49 49 struct xfs_scrub *sc; 50 50 }; ··· 52 52 /* Check that an inode's mode matches a given DT_ type. */ 53 53 STATIC int 54 54 xchk_dir_check_ftype( 55 - struct xchk_dir_ctx *sdc, 56 - xfs_fileoff_t offset, 57 - xfs_ino_t inum, 58 - int dtype) 55 + struct xchk_dir_ctx *sdc, 56 + xfs_fileoff_t offset, 57 + xfs_ino_t inum, 58 + int dtype) 59 59 { 60 - struct xfs_mount *mp = sdc->sc->mp; 61 - struct xfs_inode *ip; 62 - int ino_dtype; 63 - int error = 0; 60 + struct xfs_mount *mp = sdc->sc->mp; 61 + struct xfs_inode *ip; 62 + int ino_dtype; 63 + int error = 0; 64 64 65 65 if (!xfs_sb_version_hasftype(&mp->m_sb)) { 66 66 if (dtype != DT_UNKNOWN && dtype != DT_DIR) ··· 102 102 */ 103 103 STATIC int 104 104 xchk_dir_actor( 105 - struct dir_context *dir_iter, 106 - const char *name, 107 - int namelen, 108 - loff_t pos, 109 - u64 ino, 110 - unsigned type) 105 + struct dir_context *dir_iter, 106 + const char *name, 107 + int namelen, 108 + loff_t pos, 109 + u64 ino, 110 + unsigned type) 111 111 { 112 - struct xfs_mount *mp; 113 - struct xfs_inode *ip; 114 - struct xchk_dir_ctx *sdc; 115 - struct xfs_name xname; 116 - xfs_ino_t lookup_ino; 117 - xfs_dablk_t offset; 118 - int error = 0; 112 + struct xfs_mount *mp; 113 + struct xfs_inode *ip; 114 + struct xchk_dir_ctx *sdc; 115 + struct xfs_name xname; 116 + xfs_ino_t lookup_ino; 117 + xfs_dablk_t offset; 118 + int error = 0; 119 119 120 120 sdc = container_of(dir_iter, struct xchk_dir_ctx, dir_iter); 121 121 ip = sdc->sc->ip; ··· 289 289 */ 290 290 STATIC void 291 291 xchk_directory_check_free_entry( 292 - struct xfs_scrub *sc, 292 + struct xfs_scrub *sc, 293 293 xfs_dablk_t lblk, 294 294 struct xfs_dir2_data_free *bf, 295 295 struct xfs_dir2_data_unused *dup) ··· 314 314 /* Check free space info in a directory data block. */ 315 315 STATIC int 316 316 xchk_directory_data_bestfree( 317 - struct xfs_scrub *sc, 317 + struct xfs_scrub *sc, 318 318 xfs_dablk_t lblk, 319 319 bool is_block) 320 320 { ··· 455 455 */ 456 456 STATIC void 457 457 xchk_directory_check_freesp( 458 - struct xfs_scrub *sc, 458 + struct xfs_scrub *sc, 459 459 xfs_dablk_t lblk, 460 460 struct xfs_buf *dbp, 461 461 unsigned int len) ··· 474 474 /* Check free space info in a directory leaf1 block. */ 475 475 STATIC int 476 476 xchk_directory_leaf1_bestfree( 477 - struct xfs_scrub *sc, 477 + struct xfs_scrub *sc, 478 478 struct xfs_da_args *args, 479 479 xfs_dablk_t lblk) 480 480 { ··· 572 572 /* Check free space info in a directory freespace block. */ 573 573 STATIC int 574 574 xchk_directory_free_bestfree( 575 - struct xfs_scrub *sc, 575 + struct xfs_scrub *sc, 576 576 struct xfs_da_args *args, 577 577 xfs_dablk_t lblk) 578 578 { ··· 628 628 xchk_directory_blocks( 629 629 struct xfs_scrub *sc) 630 630 { 631 - struct xfs_bmbt_irec got; 632 - struct xfs_da_args args; 633 - struct xfs_ifork *ifp; 634 - struct xfs_mount *mp = sc->mp; 635 - xfs_fileoff_t leaf_lblk; 636 - xfs_fileoff_t free_lblk; 637 - xfs_fileoff_t lblk; 638 - struct xfs_iext_cursor icur; 639 - xfs_dablk_t dabno; 640 - bool found; 641 - int is_block = 0; 642 - int error; 631 + struct xfs_bmbt_irec got; 632 + struct xfs_da_args args; 633 + struct xfs_ifork *ifp; 634 + struct xfs_mount *mp = sc->mp; 635 + xfs_fileoff_t leaf_lblk; 636 + xfs_fileoff_t free_lblk; 637 + xfs_fileoff_t lblk; 638 + struct xfs_iext_cursor icur; 639 + xfs_dablk_t dabno; 640 + bool found; 641 + int is_block = 0; 642 + int error; 643 643 644 644 /* Ignore local format directories. */ 645 645 if (sc->ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS && ··· 772 772 xchk_directory( 773 773 struct xfs_scrub *sc) 774 774 { 775 - struct xchk_dir_ctx sdc = { 775 + struct xchk_dir_ctx sdc = { 776 776 .dir_iter.actor = xchk_dir_actor, 777 777 .dir_iter.pos = 0, 778 778 .sc = sc, 779 779 }; 780 - size_t bufsize; 781 - loff_t oldpos; 782 - int error = 0; 780 + size_t bufsize; 781 + loff_t oldpos; 782 + int error = 0; 783 783 784 784 if (!S_ISDIR(VFS_I(sc->ip)->i_mode)) 785 785 return -ENOENT;
+29 -29
fs/xfs/scrub/ialloc.c
··· 37 37 int 38 38 xchk_setup_ag_iallocbt( 39 39 struct xfs_scrub *sc, 40 - struct xfs_inode *ip) 40 + struct xfs_inode *ip) 41 41 { 42 42 return xchk_setup_ag_btree(sc, ip, sc->try_harder); 43 43 } ··· 51 51 */ 52 52 static inline void 53 53 xchk_iallocbt_chunk_xref_other( 54 - struct xfs_scrub *sc, 54 + struct xfs_scrub *sc, 55 55 struct xfs_inobt_rec_incore *irec, 56 56 xfs_agino_t agino) 57 57 { ··· 76 76 /* Cross-reference with the other btrees. */ 77 77 STATIC void 78 78 xchk_iallocbt_chunk_xref( 79 - struct xfs_scrub *sc, 79 + struct xfs_scrub *sc, 80 80 struct xfs_inobt_rec_incore *irec, 81 81 xfs_agino_t agino, 82 82 xfs_agblock_t agbno, ··· 364 364 STATIC void 365 365 xchk_iallocbt_xref_rmap_btreeblks( 366 366 struct xfs_scrub *sc, 367 - int which) 367 + int which) 368 368 { 369 - struct xfs_owner_info oinfo; 370 - xfs_filblks_t blocks; 371 - xfs_extlen_t inobt_blocks = 0; 372 - xfs_extlen_t finobt_blocks = 0; 373 - int error; 369 + struct xfs_owner_info oinfo; 370 + xfs_filblks_t blocks; 371 + xfs_extlen_t inobt_blocks = 0; 372 + xfs_extlen_t finobt_blocks = 0; 373 + int error; 374 374 375 375 if (!sc->sa.ino_cur || !sc->sa.rmap_cur || 376 376 (xfs_sb_version_hasfinobt(&sc->mp->m_sb) && !sc->sa.fino_cur) || ··· 404 404 STATIC void 405 405 xchk_iallocbt_xref_rmap_inodes( 406 406 struct xfs_scrub *sc, 407 - int which, 408 - xfs_filblks_t inode_blocks) 407 + int which, 408 + xfs_filblks_t inode_blocks) 409 409 { 410 - struct xfs_owner_info oinfo; 411 - xfs_filblks_t blocks; 412 - int error; 410 + struct xfs_owner_info oinfo; 411 + xfs_filblks_t blocks; 412 + int error; 413 413 414 414 if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) 415 415 return; ··· 428 428 STATIC int 429 429 xchk_iallocbt( 430 430 struct xfs_scrub *sc, 431 - xfs_btnum_t which) 431 + xfs_btnum_t which) 432 432 { 433 - struct xfs_btree_cur *cur; 434 - struct xfs_owner_info oinfo; 435 - xfs_filblks_t inode_blocks = 0; 436 - int error; 433 + struct xfs_btree_cur *cur; 434 + struct xfs_owner_info oinfo; 435 + xfs_filblks_t inode_blocks = 0; 436 + int error; 437 437 438 438 xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_INOBT); 439 439 cur = which == XFS_BTNUM_INO ? sc->sa.ino_cur : sc->sa.fino_cur; ··· 475 475 static inline void 476 476 xchk_xref_inode_check( 477 477 struct xfs_scrub *sc, 478 - xfs_agblock_t agbno, 479 - xfs_extlen_t len, 480 - struct xfs_btree_cur **icur, 481 - bool should_have_inodes) 478 + xfs_agblock_t agbno, 479 + xfs_extlen_t len, 480 + struct xfs_btree_cur **icur, 481 + bool should_have_inodes) 482 482 { 483 - bool has_inodes; 484 - int error; 483 + bool has_inodes; 484 + int error; 485 485 486 486 if (!(*icur) || xchk_skip_xref(sc->sm)) 487 487 return; ··· 497 497 void 498 498 xchk_xref_is_not_inode_chunk( 499 499 struct xfs_scrub *sc, 500 - xfs_agblock_t agbno, 501 - xfs_extlen_t len) 500 + xfs_agblock_t agbno, 501 + xfs_extlen_t len) 502 502 { 503 503 xchk_xref_inode_check(sc, agbno, len, &sc->sa.ino_cur, false); 504 504 xchk_xref_inode_check(sc, agbno, len, &sc->sa.fino_cur, false); ··· 508 508 void 509 509 xchk_xref_is_inode_chunk( 510 510 struct xfs_scrub *sc, 511 - xfs_agblock_t agbno, 512 - xfs_extlen_t len) 511 + xfs_agblock_t agbno, 512 + xfs_extlen_t len) 513 513 { 514 514 xchk_xref_inode_check(sc, agbno, len, &sc->sa.ino_cur, true); 515 515 }
+51 -51
fs/xfs/scrub/inode.c
··· 39 39 int 40 40 xchk_setup_inode( 41 41 struct xfs_scrub *sc, 42 - struct xfs_inode *ip) 42 + struct xfs_inode *ip) 43 43 { 44 - int error; 44 + int error; 45 45 46 46 /* 47 47 * Try to get the inode. If the verifiers fail, we try again ··· 78 78 STATIC void 79 79 xchk_inode_extsize( 80 80 struct xfs_scrub *sc, 81 - struct xfs_dinode *dip, 82 - xfs_ino_t ino, 83 - uint16_t mode, 84 - uint16_t flags) 81 + struct xfs_dinode *dip, 82 + xfs_ino_t ino, 83 + uint16_t mode, 84 + uint16_t flags) 85 85 { 86 - xfs_failaddr_t fa; 86 + xfs_failaddr_t fa; 87 87 88 88 fa = xfs_inode_validate_extsize(sc->mp, be32_to_cpu(dip->di_extsize), 89 89 mode, flags); ··· 100 100 STATIC void 101 101 xchk_inode_cowextsize( 102 102 struct xfs_scrub *sc, 103 - struct xfs_dinode *dip, 104 - xfs_ino_t ino, 105 - uint16_t mode, 106 - uint16_t flags, 107 - uint64_t flags2) 103 + struct xfs_dinode *dip, 104 + xfs_ino_t ino, 105 + uint16_t mode, 106 + uint16_t flags, 107 + uint64_t flags2) 108 108 { 109 - xfs_failaddr_t fa; 109 + xfs_failaddr_t fa; 110 110 111 111 fa = xfs_inode_validate_cowextsize(sc->mp, 112 112 be32_to_cpu(dip->di_cowextsize), mode, flags, ··· 119 119 STATIC void 120 120 xchk_inode_flags( 121 121 struct xfs_scrub *sc, 122 - struct xfs_dinode *dip, 123 - xfs_ino_t ino, 124 - uint16_t mode, 125 - uint16_t flags) 122 + struct xfs_dinode *dip, 123 + xfs_ino_t ino, 124 + uint16_t mode, 125 + uint16_t flags) 126 126 { 127 - struct xfs_mount *mp = sc->mp; 127 + struct xfs_mount *mp = sc->mp; 128 128 129 129 if (flags & ~XFS_DIFLAG_ANY) 130 130 goto bad; ··· 164 164 STATIC void 165 165 xchk_inode_flags2( 166 166 struct xfs_scrub *sc, 167 - struct xfs_dinode *dip, 168 - xfs_ino_t ino, 169 - uint16_t mode, 170 - uint16_t flags, 171 - uint64_t flags2) 167 + struct xfs_dinode *dip, 168 + xfs_ino_t ino, 169 + uint16_t mode, 170 + uint16_t flags, 171 + uint64_t flags2) 172 172 { 173 - struct xfs_mount *mp = sc->mp; 173 + struct xfs_mount *mp = sc->mp; 174 174 175 175 if (flags2 & ~XFS_DIFLAG2_ANY) 176 176 goto bad; ··· 207 207 STATIC void 208 208 xchk_dinode( 209 209 struct xfs_scrub *sc, 210 - struct xfs_dinode *dip, 211 - xfs_ino_t ino) 210 + struct xfs_dinode *dip, 211 + xfs_ino_t ino) 212 212 { 213 - struct xfs_mount *mp = sc->mp; 214 - size_t fork_recs; 215 - unsigned long long isize; 216 - uint64_t flags2; 217 - uint32_t nextents; 218 - uint16_t flags; 219 - uint16_t mode; 213 + struct xfs_mount *mp = sc->mp; 214 + size_t fork_recs; 215 + unsigned long long isize; 216 + uint64_t flags2; 217 + uint32_t nextents; 218 + uint16_t flags; 219 + uint16_t mode; 220 220 221 221 flags = be16_to_cpu(dip->di_flags); 222 222 if (dip->di_version >= 3) ··· 426 426 */ 427 427 static void 428 428 xchk_inode_xref_finobt( 429 - struct xfs_scrub *sc, 429 + struct xfs_scrub *sc, 430 430 xfs_ino_t ino) 431 431 { 432 432 struct xfs_inobt_rec_incore rec; ··· 470 470 STATIC void 471 471 xchk_inode_xref_bmap( 472 472 struct xfs_scrub *sc, 473 - struct xfs_dinode *dip) 473 + struct xfs_dinode *dip) 474 474 { 475 - xfs_extnum_t nextents; 476 - xfs_filblks_t count; 477 - xfs_filblks_t acount; 478 - int error; 475 + xfs_extnum_t nextents; 476 + xfs_filblks_t count; 477 + xfs_filblks_t acount; 478 + int error; 479 479 480 480 if (xchk_skip_xref(sc->sm)) 481 481 return; ··· 504 504 STATIC void 505 505 xchk_inode_xref( 506 506 struct xfs_scrub *sc, 507 - xfs_ino_t ino, 508 - struct xfs_dinode *dip) 507 + xfs_ino_t ino, 508 + struct xfs_dinode *dip) 509 509 { 510 - struct xfs_owner_info oinfo; 511 - xfs_agnumber_t agno; 512 - xfs_agblock_t agbno; 513 - int error; 510 + struct xfs_owner_info oinfo; 511 + xfs_agnumber_t agno; 512 + xfs_agblock_t agbno; 513 + int error; 514 514 515 515 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 516 516 return; ··· 541 541 static void 542 542 xchk_inode_check_reflink_iflag( 543 543 struct xfs_scrub *sc, 544 - xfs_ino_t ino) 544 + xfs_ino_t ino) 545 545 { 546 - struct xfs_mount *mp = sc->mp; 547 - bool has_shared; 548 - int error; 546 + struct xfs_mount *mp = sc->mp; 547 + bool has_shared; 548 + int error; 549 549 550 550 if (!xfs_sb_version_hasreflink(&mp->m_sb)) 551 551 return; ··· 566 566 xchk_inode( 567 567 struct xfs_scrub *sc) 568 568 { 569 - struct xfs_dinode di; 570 - int error = 0; 569 + struct xfs_dinode di; 570 + int error = 0; 571 571 572 572 /* 573 573 * If sc->ip is NULL, that means that the setup function called
+30 -30
fs/xfs/scrub/parent.c
··· 29 29 int 30 30 xchk_setup_parent( 31 31 struct xfs_scrub *sc, 32 - struct xfs_inode *ip) 32 + struct xfs_inode *ip) 33 33 { 34 34 return xchk_setup_inode_contents(sc, ip, 0); 35 35 } ··· 39 39 /* Look for an entry in a parent pointing to this inode. */ 40 40 41 41 struct xchk_parent_ctx { 42 - struct dir_context dc; 43 - xfs_ino_t ino; 44 - xfs_nlink_t nlink; 42 + struct dir_context dc; 43 + xfs_ino_t ino; 44 + xfs_nlink_t nlink; 45 45 }; 46 46 47 47 /* Look for a single entry in a directory pointing to an inode. */ 48 48 STATIC int 49 49 xchk_parent_actor( 50 - struct dir_context *dc, 51 - const char *name, 52 - int namelen, 53 - loff_t pos, 54 - u64 ino, 55 - unsigned type) 50 + struct dir_context *dc, 51 + const char *name, 52 + int namelen, 53 + loff_t pos, 54 + u64 ino, 55 + unsigned type) 56 56 { 57 - struct xchk_parent_ctx *spc; 57 + struct xchk_parent_ctx *spc; 58 58 59 59 spc = container_of(dc, struct xchk_parent_ctx, dc); 60 60 if (spc->ino == ino) ··· 66 66 STATIC int 67 67 xchk_parent_count_parent_dentries( 68 68 struct xfs_scrub *sc, 69 - struct xfs_inode *parent, 70 - xfs_nlink_t *nlink) 69 + struct xfs_inode *parent, 70 + xfs_nlink_t *nlink) 71 71 { 72 - struct xchk_parent_ctx spc = { 72 + struct xchk_parent_ctx spc = { 73 73 .dc.actor = xchk_parent_actor, 74 74 .dc.pos = 0, 75 75 .ino = sc->ip->i_ino, 76 76 .nlink = 0, 77 77 }; 78 - size_t bufsize; 79 - loff_t oldpos; 80 - uint lock_mode; 81 - int error = 0; 78 + size_t bufsize; 79 + loff_t oldpos; 80 + uint lock_mode; 81 + int error = 0; 82 82 83 83 /* 84 84 * If there are any blocks, read-ahead block 0 as we're almost ··· 122 122 STATIC int 123 123 xchk_parent_validate( 124 124 struct xfs_scrub *sc, 125 - xfs_ino_t dnum, 126 - bool *try_again) 125 + xfs_ino_t dnum, 126 + bool *try_again) 127 127 { 128 - struct xfs_mount *mp = sc->mp; 129 - struct xfs_inode *dp = NULL; 130 - xfs_nlink_t expected_nlink; 131 - xfs_nlink_t nlink; 132 - int error = 0; 128 + struct xfs_mount *mp = sc->mp; 129 + struct xfs_inode *dp = NULL; 130 + xfs_nlink_t expected_nlink; 131 + xfs_nlink_t nlink; 132 + int error = 0; 133 133 134 134 *try_again = false; 135 135 ··· 257 257 xchk_parent( 258 258 struct xfs_scrub *sc) 259 259 { 260 - struct xfs_mount *mp = sc->mp; 261 - xfs_ino_t dnum; 262 - bool try_again; 263 - int tries = 0; 264 - int error = 0; 260 + struct xfs_mount *mp = sc->mp; 261 + xfs_ino_t dnum; 262 + bool try_again; 263 + int tries = 0; 264 + int error = 0; 265 265 266 266 /* 267 267 * If we're a directory, check that the '..' link points up to
+34 -34
fs/xfs/scrub/quota.c
··· 49 49 int 50 50 xchk_setup_quota( 51 51 struct xfs_scrub *sc, 52 - struct xfs_inode *ip) 52 + struct xfs_inode *ip) 53 53 { 54 - uint dqtype; 55 - int error; 54 + uint dqtype; 55 + int error; 56 56 57 57 if (!XFS_IS_QUOTA_RUNNING(sc->mp) || !XFS_IS_QUOTA_ON(sc->mp)) 58 58 return -ENOENT; ··· 77 77 78 78 struct xchk_quota_info { 79 79 struct xfs_scrub *sc; 80 - xfs_dqid_t last_id; 80 + xfs_dqid_t last_id; 81 81 }; 82 82 83 83 /* Scrub the fields in an individual quota item. */ 84 84 STATIC int 85 85 xchk_quota_item( 86 - struct xfs_dquot *dq, 87 - uint dqtype, 88 - void *priv) 86 + struct xfs_dquot *dq, 87 + uint dqtype, 88 + void *priv) 89 89 { 90 - struct xchk_quota_info *sqi = priv; 90 + struct xchk_quota_info *sqi = priv; 91 91 struct xfs_scrub *sc = sqi->sc; 92 - struct xfs_mount *mp = sc->mp; 93 - struct xfs_disk_dquot *d = &dq->q_core; 94 - struct xfs_quotainfo *qi = mp->m_quotainfo; 95 - xfs_fileoff_t offset; 96 - unsigned long long bsoft; 97 - unsigned long long isoft; 98 - unsigned long long rsoft; 99 - unsigned long long bhard; 100 - unsigned long long ihard; 101 - unsigned long long rhard; 102 - unsigned long long bcount; 103 - unsigned long long icount; 104 - unsigned long long rcount; 105 - xfs_ino_t fs_icount; 106 - xfs_dqid_t id = be32_to_cpu(d->d_id); 92 + struct xfs_mount *mp = sc->mp; 93 + struct xfs_disk_dquot *d = &dq->q_core; 94 + struct xfs_quotainfo *qi = mp->m_quotainfo; 95 + xfs_fileoff_t offset; 96 + unsigned long long bsoft; 97 + unsigned long long isoft; 98 + unsigned long long rsoft; 99 + unsigned long long bhard; 100 + unsigned long long ihard; 101 + unsigned long long rhard; 102 + unsigned long long bcount; 103 + unsigned long long icount; 104 + unsigned long long rcount; 105 + xfs_ino_t fs_icount; 106 + xfs_dqid_t id = be32_to_cpu(d->d_id); 107 107 108 108 /* 109 109 * Except for the root dquot, the actual dquot we got must either have ··· 197 197 xchk_quota_data_fork( 198 198 struct xfs_scrub *sc) 199 199 { 200 - struct xfs_bmbt_irec irec = { 0 }; 201 - struct xfs_iext_cursor icur; 202 - struct xfs_quotainfo *qi = sc->mp->m_quotainfo; 203 - struct xfs_ifork *ifp; 204 - xfs_fileoff_t max_dqid_off; 205 - int error = 0; 200 + struct xfs_bmbt_irec irec = { 0 }; 201 + struct xfs_iext_cursor icur; 202 + struct xfs_quotainfo *qi = sc->mp->m_quotainfo; 203 + struct xfs_ifork *ifp; 204 + xfs_fileoff_t max_dqid_off; 205 + int error = 0; 206 206 207 207 /* Invoke the fork scrubber. */ 208 208 error = xchk_metadata_inode_forks(sc); ··· 236 236 xchk_quota( 237 237 struct xfs_scrub *sc) 238 238 { 239 - struct xchk_quota_info sqi; 240 - struct xfs_mount *mp = sc->mp; 241 - struct xfs_quotainfo *qi = mp->m_quotainfo; 242 - uint dqtype; 243 - int error = 0; 239 + struct xchk_quota_info sqi; 240 + struct xfs_mount *mp = sc->mp; 241 + struct xfs_quotainfo *qi = mp->m_quotainfo; 242 + uint dqtype; 243 + int error = 0; 244 244 245 245 dqtype = xchk_quota_to_dqtype(sc); 246 246
+35 -35
fs/xfs/scrub/refcount.c
··· 30 30 int 31 31 xchk_setup_ag_refcountbt( 32 32 struct xfs_scrub *sc, 33 - struct xfs_inode *ip) 33 + struct xfs_inode *ip) 34 34 { 35 35 return xchk_setup_ag_btree(sc, ip, false); 36 36 } ··· 74 74 * should always hold true. If not, the refcount is incorrect. 75 75 */ 76 76 struct xchk_refcnt_frag { 77 - struct list_head list; 78 - struct xfs_rmap_irec rm; 77 + struct list_head list; 78 + struct xfs_rmap_irec rm; 79 79 }; 80 80 81 81 struct xchk_refcnt_check { 82 82 struct xfs_scrub *sc; 83 - struct list_head fragments; 83 + struct list_head fragments; 84 84 85 85 /* refcount extent we're examining */ 86 - xfs_agblock_t bno; 87 - xfs_extlen_t len; 88 - xfs_nlink_t refcount; 86 + xfs_agblock_t bno; 87 + xfs_extlen_t len; 88 + xfs_nlink_t refcount; 89 89 90 90 /* number of owners seen */ 91 - xfs_nlink_t seen; 91 + xfs_nlink_t seen; 92 92 }; 93 93 94 94 /* ··· 278 278 /* Use the rmap entries covering this extent to verify the refcount. */ 279 279 STATIC void 280 280 xchk_refcountbt_xref_rmap( 281 - struct xfs_scrub *sc, 281 + struct xfs_scrub *sc, 282 282 xfs_agblock_t bno, 283 283 xfs_extlen_t len, 284 284 xfs_nlink_t refcount) ··· 326 326 STATIC void 327 327 xchk_refcountbt_xref( 328 328 struct xfs_scrub *sc, 329 - xfs_agblock_t agbno, 330 - xfs_extlen_t len, 331 - xfs_nlink_t refcount) 329 + xfs_agblock_t agbno, 330 + xfs_extlen_t len, 331 + xfs_nlink_t refcount) 332 332 { 333 333 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 334 334 return; ··· 341 341 /* Scrub a refcountbt record. */ 342 342 STATIC int 343 343 xchk_refcountbt_rec( 344 - struct xchk_btree *bs, 345 - union xfs_btree_rec *rec) 344 + struct xchk_btree *bs, 345 + union xfs_btree_rec *rec) 346 346 { 347 - struct xfs_mount *mp = bs->cur->bc_mp; 348 - xfs_agblock_t *cow_blocks = bs->private; 349 - xfs_agnumber_t agno = bs->cur->bc_private.a.agno; 350 - xfs_agblock_t bno; 351 - xfs_extlen_t len; 352 - xfs_nlink_t refcount; 353 - bool has_cowflag; 354 - int error = 0; 347 + struct xfs_mount *mp = bs->cur->bc_mp; 348 + xfs_agblock_t *cow_blocks = bs->private; 349 + xfs_agnumber_t agno = bs->cur->bc_private.a.agno; 350 + xfs_agblock_t bno; 351 + xfs_extlen_t len; 352 + xfs_nlink_t refcount; 353 + bool has_cowflag; 354 + int error = 0; 355 355 356 356 bno = be32_to_cpu(rec->refc.rc_startblock); 357 357 len = be32_to_cpu(rec->refc.rc_blockcount); ··· 383 383 STATIC void 384 384 xchk_refcount_xref_rmap( 385 385 struct xfs_scrub *sc, 386 - struct xfs_owner_info *oinfo, 387 - xfs_filblks_t cow_blocks) 386 + struct xfs_owner_info *oinfo, 387 + xfs_filblks_t cow_blocks) 388 388 { 389 - xfs_extlen_t refcbt_blocks = 0; 390 - xfs_filblks_t blocks; 391 - int error; 389 + xfs_extlen_t refcbt_blocks = 0; 390 + xfs_filblks_t blocks; 391 + int error; 392 392 393 393 if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) 394 394 return; ··· 419 419 xchk_refcountbt( 420 420 struct xfs_scrub *sc) 421 421 { 422 - struct xfs_owner_info oinfo; 423 - xfs_agblock_t cow_blocks = 0; 424 - int error; 422 + struct xfs_owner_info oinfo; 423 + xfs_agblock_t cow_blocks = 0; 424 + int error; 425 425 426 426 xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_REFC); 427 427 error = xchk_btree(sc, sc->sa.refc_cur, xchk_refcountbt_rec, ··· 437 437 /* xref check that a cow staging extent is marked in the refcountbt. */ 438 438 void 439 439 xchk_xref_is_cow_staging( 440 - struct xfs_scrub *sc, 440 + struct xfs_scrub *sc, 441 441 xfs_agblock_t agbno, 442 442 xfs_extlen_t len) 443 443 { ··· 484 484 void 485 485 xchk_xref_is_not_shared( 486 486 struct xfs_scrub *sc, 487 - xfs_agblock_t agbno, 488 - xfs_extlen_t len) 487 + xfs_agblock_t agbno, 488 + xfs_extlen_t len) 489 489 { 490 - bool shared; 491 - int error; 490 + bool shared; 491 + int error; 492 492 493 493 if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm)) 494 494 return;
+74 -74
fs/xfs/scrub/repair.c
··· 42 42 */ 43 43 int 44 44 xrep_attempt( 45 - struct xfs_inode *ip, 45 + struct xfs_inode *ip, 46 46 struct xfs_scrub *sc, 47 - bool *fixed) 47 + bool *fixed) 48 48 { 49 - int error = 0; 49 + int error = 0; 50 50 51 51 trace_xrep_attempt(ip, sc->sm, error); 52 52 ··· 94 94 */ 95 95 void 96 96 xrep_failure( 97 - struct xfs_mount *mp) 97 + struct xfs_mount *mp) 98 98 { 99 99 xfs_alert_ratelimited(mp, 100 100 "Corruption not fixed during online repair. Unmount and run xfs_repair."); ··· 108 108 xrep_probe( 109 109 struct xfs_scrub *sc) 110 110 { 111 - int error = 0; 111 + int error = 0; 112 112 113 113 if (xchk_should_terminate(sc, &error)) 114 114 return error; ··· 124 124 xrep_roll_ag_trans( 125 125 struct xfs_scrub *sc) 126 126 { 127 - int error; 127 + int error; 128 128 129 129 /* Keep the AG header buffers locked so we can keep going. */ 130 130 xfs_trans_bhold(sc->tp, sc->sa.agi_bp); ··· 163 163 */ 164 164 bool 165 165 xrep_ag_has_space( 166 - struct xfs_perag *pag, 167 - xfs_extlen_t nr_blocks, 168 - enum xfs_ag_resv_type type) 166 + struct xfs_perag *pag, 167 + xfs_extlen_t nr_blocks, 168 + enum xfs_ag_resv_type type) 169 169 { 170 170 return !xfs_ag_resv_critical(pag, XFS_AG_RESV_RMAPBT) && 171 171 !xfs_ag_resv_critical(pag, XFS_AG_RESV_METADATA) && ··· 179 179 */ 180 180 xfs_extlen_t 181 181 xrep_calc_ag_resblks( 182 - struct xfs_scrub *sc) 182 + struct xfs_scrub *sc) 183 183 { 184 184 struct xfs_mount *mp = sc->mp; 185 185 struct xfs_scrub_metadata *sm = sc->sm; ··· 280 280 int 281 281 xrep_alloc_ag_block( 282 282 struct xfs_scrub *sc, 283 - struct xfs_owner_info *oinfo, 284 - xfs_fsblock_t *fsbno, 285 - enum xfs_ag_resv_type resv) 283 + struct xfs_owner_info *oinfo, 284 + xfs_fsblock_t *fsbno, 285 + enum xfs_ag_resv_type resv) 286 286 { 287 - struct xfs_alloc_arg args = {0}; 288 - xfs_agblock_t bno; 289 - int error; 287 + struct xfs_alloc_arg args = {0}; 288 + xfs_agblock_t bno; 289 + int error; 290 290 291 291 switch (resv) { 292 292 case XFS_AG_RESV_AGFL: ··· 330 330 /* Initialize a new AG btree root block with zero entries. */ 331 331 int 332 332 xrep_init_btblock( 333 - struct xfs_scrub *sc, 333 + struct xfs_scrub *sc, 334 334 xfs_fsblock_t fsb, 335 335 struct xfs_buf **bpp, 336 336 xfs_btnum_t btnum, ··· 386 386 int 387 387 xrep_collect_btree_extent( 388 388 struct xfs_scrub *sc, 389 - struct xrep_extent_list *exlist, 390 - xfs_fsblock_t fsbno, 391 - xfs_extlen_t len) 389 + struct xrep_extent_list *exlist, 390 + xfs_fsblock_t fsbno, 391 + xfs_extlen_t len) 392 392 { 393 - struct xrep_extent *rex; 393 + struct xrep_extent *rex; 394 394 395 395 trace_xrep_collect_btree_extent(sc->mp, 396 396 XFS_FSB_TO_AGNO(sc->mp, fsbno), ··· 416 416 void 417 417 xrep_cancel_btree_extents( 418 418 struct xfs_scrub *sc, 419 - struct xrep_extent_list *exlist) 419 + struct xrep_extent_list *exlist) 420 420 { 421 - struct xrep_extent *rex; 422 - struct xrep_extent *n; 421 + struct xrep_extent *rex; 422 + struct xrep_extent *n; 423 423 424 424 for_each_xrep_extent_safe(rex, n, exlist) { 425 425 list_del(&rex->list); ··· 430 430 /* Compare two btree extents. */ 431 431 static int 432 432 xrep_btree_extent_cmp( 433 - void *priv, 434 - struct list_head *a, 435 - struct list_head *b) 433 + void *priv, 434 + struct list_head *a, 435 + struct list_head *b) 436 436 { 437 - struct xrep_extent *ap; 438 - struct xrep_extent *bp; 437 + struct xrep_extent *ap; 438 + struct xrep_extent *bp; 439 439 440 440 ap = container_of(a, struct xrep_extent, list); 441 441 bp = container_of(b, struct xrep_extent, list); ··· 464 464 int 465 465 xrep_subtract_extents( 466 466 struct xfs_scrub *sc, 467 - struct xrep_extent_list *exlist, 468 - struct xrep_extent_list *sublist) 467 + struct xrep_extent_list *exlist, 468 + struct xrep_extent_list *sublist) 469 469 { 470 - struct list_head *lp; 471 - struct xrep_extent *ex; 472 - struct xrep_extent *newex; 473 - struct xrep_extent *subex; 474 - xfs_fsblock_t sub_fsb; 475 - xfs_extlen_t sub_len; 476 - int state; 477 - int error = 0; 470 + struct list_head *lp; 471 + struct xrep_extent *ex; 472 + struct xrep_extent *newex; 473 + struct xrep_extent *subex; 474 + xfs_fsblock_t sub_fsb; 475 + xfs_extlen_t sub_len; 476 + int state; 477 + int error = 0; 478 478 479 479 if (list_empty(&exlist->list) || list_empty(&sublist->list)) 480 480 return 0; ··· 621 621 int 622 622 xrep_invalidate_blocks( 623 623 struct xfs_scrub *sc, 624 - struct xrep_extent_list *exlist) 624 + struct xrep_extent_list *exlist) 625 625 { 626 - struct xrep_extent *rex; 627 - struct xrep_extent *n; 628 - struct xfs_buf *bp; 629 - xfs_fsblock_t fsbno; 630 - xfs_agblock_t i; 626 + struct xrep_extent *rex; 627 + struct xrep_extent *n; 628 + struct xfs_buf *bp; 629 + xfs_fsblock_t fsbno; 630 + xfs_agblock_t i; 631 631 632 632 /* 633 633 * For each block in each extent, see if there's an incore buffer for ··· 659 659 int 660 660 xrep_fix_freelist( 661 661 struct xfs_scrub *sc, 662 - bool can_shrink) 662 + bool can_shrink) 663 663 { 664 - struct xfs_alloc_arg args = {0}; 664 + struct xfs_alloc_arg args = {0}; 665 665 666 666 args.mp = sc->mp; 667 667 args.tp = sc->tp; ··· 679 679 STATIC int 680 680 xrep_put_freelist( 681 681 struct xfs_scrub *sc, 682 - xfs_agblock_t agbno) 682 + xfs_agblock_t agbno) 683 683 { 684 - struct xfs_owner_info oinfo; 685 - int error; 684 + struct xfs_owner_info oinfo; 685 + int error; 686 686 687 687 /* Make sure there's space on the freelist. */ 688 688 error = xrep_fix_freelist(sc, true); ··· 715 715 STATIC int 716 716 xrep_dispose_btree_block( 717 717 struct xfs_scrub *sc, 718 - xfs_fsblock_t fsbno, 719 - struct xfs_owner_info *oinfo, 720 - enum xfs_ag_resv_type resv) 718 + xfs_fsblock_t fsbno, 719 + struct xfs_owner_info *oinfo, 720 + enum xfs_ag_resv_type resv) 721 721 { 722 - struct xfs_btree_cur *cur; 723 - struct xfs_buf *agf_bp = NULL; 724 - xfs_agnumber_t agno; 725 - xfs_agblock_t agbno; 726 - bool has_other_rmap; 727 - int error; 722 + struct xfs_btree_cur *cur; 723 + struct xfs_buf *agf_bp = NULL; 724 + xfs_agnumber_t agno; 725 + xfs_agblock_t agbno; 726 + bool has_other_rmap; 727 + int error; 728 728 729 729 agno = XFS_FSB_TO_AGNO(sc->mp, fsbno); 730 730 agbno = XFS_FSB_TO_AGBNO(sc->mp, fsbno); ··· 789 789 int 790 790 xrep_reap_btree_extents( 791 791 struct xfs_scrub *sc, 792 - struct xrep_extent_list *exlist, 793 - struct xfs_owner_info *oinfo, 794 - enum xfs_ag_resv_type type) 792 + struct xrep_extent_list *exlist, 793 + struct xfs_owner_info *oinfo, 794 + enum xfs_ag_resv_type type) 795 795 { 796 - struct xrep_extent *rex; 797 - struct xrep_extent *n; 798 - int error = 0; 796 + struct xrep_extent *rex; 797 + struct xrep_extent *n; 798 + int error = 0; 799 799 800 800 ASSERT(xfs_sb_version_hasrmapbt(&sc->mp->m_sb)); 801 801 ··· 851 851 */ 852 852 853 853 struct xrep_findroot { 854 - struct xfs_scrub *sc; 854 + struct xfs_scrub *sc; 855 855 struct xfs_buf *agfl_bp; 856 856 struct xfs_agf *agf; 857 857 struct xrep_find_ag_btree *btree_info; ··· 860 860 /* See if our block is in the AGFL. */ 861 861 STATIC int 862 862 xrep_findroot_agfl_walk( 863 - struct xfs_mount *mp, 864 - xfs_agblock_t bno, 865 - void *priv) 863 + struct xfs_mount *mp, 864 + xfs_agblock_t bno, 865 + void *priv) 866 866 { 867 - xfs_agblock_t *agbno = priv; 867 + xfs_agblock_t *agbno = priv; 868 868 869 869 return (*agbno == bno) ? XFS_BTREE_QUERY_RANGE_ABORT : 0; 870 870 } ··· 981 981 /* Find the roots of the per-AG btrees described in btree_info. */ 982 982 int 983 983 xrep_find_ag_btree_roots( 984 - struct xfs_scrub *sc, 984 + struct xfs_scrub *sc, 985 985 struct xfs_buf *agf_bp, 986 986 struct xrep_find_ag_btree *btree_info, 987 987 struct xfs_buf *agfl_bp) ··· 1017 1017 void 1018 1018 xrep_force_quotacheck( 1019 1019 struct xfs_scrub *sc, 1020 - uint dqtype) 1020 + uint dqtype) 1021 1021 { 1022 - uint flag; 1022 + uint flag; 1023 1023 1024 1024 flag = xfs_quota_chkd_flag(dqtype); 1025 1025 if (!(flag & sc->mp->m_qflags)) ··· 1046 1046 xrep_ino_dqattach( 1047 1047 struct xfs_scrub *sc) 1048 1048 { 1049 - int error; 1049 + int error; 1050 1050 1051 1051 error = xfs_qm_dqattach_locked(sc->ip, false); 1052 1052 switch (error) {
+12 -16
fs/xfs/scrub/repair.h
··· 15 15 16 16 /* Repair helpers */ 17 17 18 - int xrep_attempt(struct xfs_inode *ip, struct xfs_scrub *sc, 19 - bool *fixed); 18 + int xrep_attempt(struct xfs_inode *ip, struct xfs_scrub *sc, bool *fixed); 20 19 void xrep_failure(struct xfs_mount *mp); 21 20 int xrep_roll_ag_trans(struct xfs_scrub *sc); 22 21 bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks, 23 22 enum xfs_ag_resv_type type); 24 23 xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc); 25 - int xrep_alloc_ag_block(struct xfs_scrub *sc, 26 - struct xfs_owner_info *oinfo, xfs_fsblock_t *fsbno, 27 - enum xfs_ag_resv_type resv); 24 + int xrep_alloc_ag_block(struct xfs_scrub *sc, struct xfs_owner_info *oinfo, 25 + xfs_fsblock_t *fsbno, enum xfs_ag_resv_type resv); 28 26 int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb, 29 27 struct xfs_buf **bpp, xfs_btnum_t btnum, 30 28 const struct xfs_buf_ops *ops); 31 29 32 30 struct xrep_extent { 33 - struct list_head list; 34 - xfs_fsblock_t fsbno; 35 - xfs_extlen_t len; 31 + struct list_head list; 32 + xfs_fsblock_t fsbno; 33 + xfs_extlen_t len; 36 34 }; 37 35 38 36 struct xrep_extent_list { 39 - struct list_head list; 37 + struct list_head list; 40 38 }; 41 39 42 40 static inline void 43 41 xrep_init_extent_list( 44 - struct xrep_extent_list *exlist) 42 + struct xrep_extent_list *exlist) 45 43 { 46 44 INIT_LIST_HEAD(&exlist->list); 47 45 } ··· 76 78 unsigned int height; 77 79 }; 78 80 79 - int xrep_find_ag_btree_roots(struct xfs_scrub *sc, 80 - struct xfs_buf *agf_bp, 81 - struct xrep_find_ag_btree *btree_info, 82 - struct xfs_buf *agfl_bp); 81 + int xrep_find_ag_btree_roots(struct xfs_scrub *sc, struct xfs_buf *agf_bp, 82 + struct xrep_find_ag_btree *btree_info, struct xfs_buf *agfl_bp); 83 83 void xrep_force_quotacheck(struct xfs_scrub *sc, uint dqtype); 84 84 int xrep_ino_dqattach(struct xfs_scrub *sc); 85 85 ··· 89 93 #else 90 94 91 95 static inline int xrep_attempt( 92 - struct xfs_inode *ip, 96 + struct xfs_inode *ip, 93 97 struct xfs_scrub *sc, 94 - bool *fixed) 98 + bool *fixed) 95 99 { 96 100 return -EOPNOTSUPP; 97 101 }
+39 -39
fs/xfs/scrub/rmap.c
··· 31 31 int 32 32 xchk_setup_ag_rmapbt( 33 33 struct xfs_scrub *sc, 34 - struct xfs_inode *ip) 34 + struct xfs_inode *ip) 35 35 { 36 36 return xchk_setup_ag_btree(sc, ip, false); 37 37 } ··· 42 42 STATIC void 43 43 xchk_rmapbt_xref_refc( 44 44 struct xfs_scrub *sc, 45 - struct xfs_rmap_irec *irec) 45 + struct xfs_rmap_irec *irec) 46 46 { 47 - xfs_agblock_t fbno; 48 - xfs_extlen_t flen; 49 - bool non_inode; 50 - bool is_bmbt; 51 - bool is_attr; 52 - bool is_unwritten; 53 - int error; 47 + xfs_agblock_t fbno; 48 + xfs_extlen_t flen; 49 + bool non_inode; 50 + bool is_bmbt; 51 + bool is_attr; 52 + bool is_unwritten; 53 + int error; 54 54 55 55 if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm)) 56 56 return; ··· 73 73 STATIC void 74 74 xchk_rmapbt_xref( 75 75 struct xfs_scrub *sc, 76 - struct xfs_rmap_irec *irec) 76 + struct xfs_rmap_irec *irec) 77 77 { 78 - xfs_agblock_t agbno = irec->rm_startblock; 79 - xfs_extlen_t len = irec->rm_blockcount; 78 + xfs_agblock_t agbno = irec->rm_startblock; 79 + xfs_extlen_t len = irec->rm_blockcount; 80 80 81 81 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 82 82 return; ··· 96 96 /* Scrub an rmapbt record. */ 97 97 STATIC int 98 98 xchk_rmapbt_rec( 99 - struct xchk_btree *bs, 100 - union xfs_btree_rec *rec) 99 + struct xchk_btree *bs, 100 + union xfs_btree_rec *rec) 101 101 { 102 - struct xfs_mount *mp = bs->cur->bc_mp; 103 - struct xfs_rmap_irec irec; 104 - xfs_agnumber_t agno = bs->cur->bc_private.a.agno; 105 - bool non_inode; 106 - bool is_unwritten; 107 - bool is_bmbt; 108 - bool is_attr; 109 - int error; 102 + struct xfs_mount *mp = bs->cur->bc_mp; 103 + struct xfs_rmap_irec irec; 104 + xfs_agnumber_t agno = bs->cur->bc_private.a.agno; 105 + bool non_inode; 106 + bool is_unwritten; 107 + bool is_bmbt; 108 + bool is_attr; 109 + int error; 110 110 111 111 error = xfs_rmap_btrec_to_irec(rec, &irec); 112 112 if (!xchk_btree_process_error(bs->sc, bs->cur, 0, &error)) ··· 174 174 xchk_rmapbt( 175 175 struct xfs_scrub *sc) 176 176 { 177 - struct xfs_owner_info oinfo; 177 + struct xfs_owner_info oinfo; 178 178 179 179 xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_AG); 180 180 return xchk_btree(sc, sc->sa.rmap_cur, xchk_rmapbt_rec, ··· 185 185 static inline void 186 186 xchk_xref_check_owner( 187 187 struct xfs_scrub *sc, 188 - xfs_agblock_t bno, 189 - xfs_extlen_t len, 190 - struct xfs_owner_info *oinfo, 191 - bool should_have_rmap) 188 + xfs_agblock_t bno, 189 + xfs_extlen_t len, 190 + struct xfs_owner_info *oinfo, 191 + bool should_have_rmap) 192 192 { 193 - bool has_rmap; 194 - int error; 193 + bool has_rmap; 194 + int error; 195 195 196 196 if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) 197 197 return; ··· 208 208 void 209 209 xchk_xref_is_owned_by( 210 210 struct xfs_scrub *sc, 211 - xfs_agblock_t bno, 212 - xfs_extlen_t len, 213 - struct xfs_owner_info *oinfo) 211 + xfs_agblock_t bno, 212 + xfs_extlen_t len, 213 + struct xfs_owner_info *oinfo) 214 214 { 215 215 xchk_xref_check_owner(sc, bno, len, oinfo, true); 216 216 } ··· 219 219 void 220 220 xchk_xref_is_not_owned_by( 221 221 struct xfs_scrub *sc, 222 - xfs_agblock_t bno, 223 - xfs_extlen_t len, 224 - struct xfs_owner_info *oinfo) 222 + xfs_agblock_t bno, 223 + xfs_extlen_t len, 224 + struct xfs_owner_info *oinfo) 225 225 { 226 226 xchk_xref_check_owner(sc, bno, len, oinfo, false); 227 227 } ··· 230 230 void 231 231 xchk_xref_has_no_owner( 232 232 struct xfs_scrub *sc, 233 - xfs_agblock_t bno, 234 - xfs_extlen_t len) 233 + xfs_agblock_t bno, 234 + xfs_extlen_t len) 235 235 { 236 - bool has_rmap; 237 - int error; 236 + bool has_rmap; 237 + int error; 238 238 239 239 if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) 240 240 return;
+19 -19
fs/xfs/scrub/rtbitmap.c
··· 27 27 int 28 28 xchk_setup_rt( 29 29 struct xfs_scrub *sc, 30 - struct xfs_inode *ip) 30 + struct xfs_inode *ip) 31 31 { 32 - int error; 32 + int error; 33 33 34 34 error = xchk_setup_fs(sc, ip); 35 35 if (error) ··· 47 47 /* Scrub a free extent record from the realtime bitmap. */ 48 48 STATIC int 49 49 xchk_rtbitmap_rec( 50 - struct xfs_trans *tp, 51 - struct xfs_rtalloc_rec *rec, 52 - void *priv) 50 + struct xfs_trans *tp, 51 + struct xfs_rtalloc_rec *rec, 52 + void *priv) 53 53 { 54 54 struct xfs_scrub *sc = priv; 55 - xfs_rtblock_t startblock; 56 - xfs_rtblock_t blockcount; 55 + xfs_rtblock_t startblock; 56 + xfs_rtblock_t blockcount; 57 57 58 58 startblock = rec->ar_startext * tp->t_mountp->m_sb.sb_rextsize; 59 59 blockcount = rec->ar_extcount * tp->t_mountp->m_sb.sb_rextsize; ··· 70 70 xchk_rtbitmap( 71 71 struct xfs_scrub *sc) 72 72 { 73 - int error; 73 + int error; 74 74 75 75 /* Invoke the fork scrubber. */ 76 76 error = xchk_metadata_inode_forks(sc); ··· 90 90 xchk_rtsummary( 91 91 struct xfs_scrub *sc) 92 92 { 93 - struct xfs_inode *rsumip = sc->mp->m_rsumip; 94 - struct xfs_inode *old_ip = sc->ip; 95 - uint old_ilock_flags = sc->ilock_flags; 96 - int error = 0; 93 + struct xfs_inode *rsumip = sc->mp->m_rsumip; 94 + struct xfs_inode *old_ip = sc->ip; 95 + uint old_ilock_flags = sc->ilock_flags; 96 + int error = 0; 97 97 98 98 /* 99 99 * We ILOCK'd the rt bitmap ip in the setup routine, now lock the ··· 126 126 void 127 127 xchk_xref_is_used_rt_space( 128 128 struct xfs_scrub *sc, 129 - xfs_rtblock_t fsbno, 130 - xfs_extlen_t len) 129 + xfs_rtblock_t fsbno, 130 + xfs_extlen_t len) 131 131 { 132 - xfs_rtblock_t startext; 133 - xfs_rtblock_t endext; 134 - xfs_rtblock_t extcount; 135 - bool is_free; 136 - int error; 132 + xfs_rtblock_t startext; 133 + xfs_rtblock_t endext; 134 + xfs_rtblock_t extcount; 135 + bool is_free; 136 + int error; 137 137 138 138 if (xchk_skip_xref(sc->sm)) 139 139 return;
+4 -4
fs/xfs/scrub/scrub.c
··· 153 153 xchk_probe( 154 154 struct xfs_scrub *sc) 155 155 { 156 - int error = 0; 156 + int error = 0; 157 157 158 158 if (xchk_should_terminate(sc, &error)) 159 159 return error; ··· 167 167 STATIC int 168 168 xchk_teardown( 169 169 struct xfs_scrub *sc, 170 - struct xfs_inode *ip_in, 171 - int error) 170 + struct xfs_inode *ip_in, 171 + int error) 172 172 { 173 173 xchk_ag_free(sc, &sc->sa); 174 174 if (sc->tp) { ··· 479 479 struct xfs_inode *ip, 480 480 struct xfs_scrub_metadata *sm) 481 481 { 482 - struct xfs_scrub sc; 482 + struct xfs_scrub sc; 483 483 struct xfs_mount *mp = ip->i_mount; 484 484 bool try_harder = false; 485 485 bool already_fixed = false;
+30 -32
fs/xfs/scrub/scrub.h
··· 36 36 37 37 /* Buffer pointers and btree cursors for an entire AG. */ 38 38 struct xchk_ag { 39 - xfs_agnumber_t agno; 40 - struct xfs_perag *pag; 39 + xfs_agnumber_t agno; 40 + struct xfs_perag *pag; 41 41 42 42 /* AG btree roots */ 43 - struct xfs_buf *agf_bp; 44 - struct xfs_buf *agfl_bp; 45 - struct xfs_buf *agi_bp; 43 + struct xfs_buf *agf_bp; 44 + struct xfs_buf *agfl_bp; 45 + struct xfs_buf *agi_bp; 46 46 47 47 /* AG btrees */ 48 - struct xfs_btree_cur *bno_cur; 49 - struct xfs_btree_cur *cnt_cur; 50 - struct xfs_btree_cur *ino_cur; 51 - struct xfs_btree_cur *fino_cur; 52 - struct xfs_btree_cur *rmap_cur; 53 - struct xfs_btree_cur *refc_cur; 48 + struct xfs_btree_cur *bno_cur; 49 + struct xfs_btree_cur *cnt_cur; 50 + struct xfs_btree_cur *ino_cur; 51 + struct xfs_btree_cur *fino_cur; 52 + struct xfs_btree_cur *rmap_cur; 53 + struct xfs_btree_cur *refc_cur; 54 54 }; 55 55 56 56 struct xfs_scrub { ··· 66 66 bool has_quotaofflock; 67 67 68 68 /* State tracking for single-AG operations. */ 69 - struct xchk_ag sa; 69 + struct xchk_ag sa; 70 70 }; 71 71 72 72 /* Metadata scrubbers */ ··· 115 115 #endif 116 116 117 117 /* cross-referencing helpers */ 118 - void xchk_xref_is_used_space(struct xfs_scrub *sc, 119 - xfs_agblock_t agbno, xfs_extlen_t len); 120 - void xchk_xref_is_not_inode_chunk(struct xfs_scrub *sc, 121 - xfs_agblock_t agbno, xfs_extlen_t len); 122 - void xchk_xref_is_inode_chunk(struct xfs_scrub *sc, 123 - xfs_agblock_t agbno, xfs_extlen_t len); 124 - void xchk_xref_is_owned_by(struct xfs_scrub *sc, 125 - xfs_agblock_t agbno, xfs_extlen_t len, 126 - struct xfs_owner_info *oinfo); 127 - void xchk_xref_is_not_owned_by(struct xfs_scrub *sc, 128 - xfs_agblock_t agbno, xfs_extlen_t len, 129 - struct xfs_owner_info *oinfo); 130 - void xchk_xref_has_no_owner(struct xfs_scrub *sc, 131 - xfs_agblock_t agbno, xfs_extlen_t len); 132 - void xchk_xref_is_cow_staging(struct xfs_scrub *sc, 133 - xfs_agblock_t bno, xfs_extlen_t len); 134 - void xchk_xref_is_not_shared(struct xfs_scrub *sc, 135 - xfs_agblock_t bno, xfs_extlen_t len); 118 + void xchk_xref_is_used_space(struct xfs_scrub *sc, xfs_agblock_t agbno, 119 + xfs_extlen_t len); 120 + void xchk_xref_is_not_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno, 121 + xfs_extlen_t len); 122 + void xchk_xref_is_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno, 123 + xfs_extlen_t len); 124 + void xchk_xref_is_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno, 125 + xfs_extlen_t len, struct xfs_owner_info *oinfo); 126 + void xchk_xref_is_not_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno, 127 + xfs_extlen_t len, struct xfs_owner_info *oinfo); 128 + void xchk_xref_has_no_owner(struct xfs_scrub *sc, xfs_agblock_t agbno, 129 + xfs_extlen_t len); 130 + void xchk_xref_is_cow_staging(struct xfs_scrub *sc, xfs_agblock_t bno, 131 + xfs_extlen_t len); 132 + void xchk_xref_is_not_shared(struct xfs_scrub *sc, xfs_agblock_t bno, 133 + xfs_extlen_t len); 136 134 #ifdef CONFIG_XFS_RT 137 - void xchk_xref_is_used_rt_space(struct xfs_scrub *sc, 138 - xfs_rtblock_t rtbno, xfs_extlen_t len); 135 + void xchk_xref_is_used_rt_space(struct xfs_scrub *sc, xfs_rtblock_t rtbno, 136 + xfs_extlen_t len); 139 137 #else 140 138 # define xchk_xref_is_used_rt_space(sc, rtbno, len) do { } while (0) 141 139 #endif
+5 -5
fs/xfs/scrub/symlink.c
··· 27 27 int 28 28 xchk_setup_symlink( 29 29 struct xfs_scrub *sc, 30 - struct xfs_inode *ip) 30 + struct xfs_inode *ip) 31 31 { 32 32 /* Allocate the buffer without the inode lock held. */ 33 33 sc->buf = kmem_zalloc_large(XFS_SYMLINK_MAXLEN + 1, KM_SLEEP); ··· 43 43 xchk_symlink( 44 44 struct xfs_scrub *sc) 45 45 { 46 - struct xfs_inode *ip = sc->ip; 47 - struct xfs_ifork *ifp; 48 - loff_t len; 49 - int error = 0; 46 + struct xfs_inode *ip = sc->ip; 47 + struct xfs_ifork *ifp; 48 + loff_t len; 49 + int error = 0; 50 50 51 51 if (!S_ISLNK(VFS_I(ip)->i_mode)) 52 52 return -ENOENT;
+2 -2
fs/xfs/scrub/trace.c
··· 23 23 /* Figure out which block the btree cursor was pointing to. */ 24 24 static inline xfs_fsblock_t 25 25 xchk_btree_cur_fsbno( 26 - struct xfs_btree_cur *cur, 27 - int level) 26 + struct xfs_btree_cur *cur, 27 + int level) 28 28 { 29 29 if (level < cur->bc_nlevels && cur->bc_bufs[level]) 30 30 return XFS_DADDR_TO_FSB(cur->bc_mp, cur->bc_bufs[level]->b_bn);