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

xfs: const-ify xfs_owner_info arguments

Only certain functions actually change the contents of an
xfs_owner_info; the rest can accept a const struct pointer. This will
enable us to save stack space by hoisting static owner info types to
be const global variables.

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

+266 -261
+34 -34
fs/xfs/libxfs/xfs_alloc.c
··· 1694 1694 */ 1695 1695 STATIC int 1696 1696 xfs_free_ag_extent( 1697 - xfs_trans_t *tp, 1698 - xfs_buf_t *agbp, 1699 - xfs_agnumber_t agno, 1700 - xfs_agblock_t bno, 1701 - xfs_extlen_t len, 1702 - struct xfs_owner_info *oinfo, 1703 - enum xfs_ag_resv_type type) 1697 + struct xfs_trans *tp, 1698 + struct xfs_buf *agbp, 1699 + xfs_agnumber_t agno, 1700 + xfs_agblock_t bno, 1701 + xfs_extlen_t len, 1702 + const struct xfs_owner_info *oinfo, 1703 + enum xfs_ag_resv_type type) 1704 1704 { 1705 - xfs_btree_cur_t *bno_cur; /* cursor for by-block btree */ 1706 - xfs_btree_cur_t *cnt_cur; /* cursor for by-size btree */ 1707 - int error; /* error return value */ 1708 - xfs_agblock_t gtbno; /* start of right neighbor block */ 1709 - xfs_extlen_t gtlen; /* length of right neighbor block */ 1710 - int haveleft; /* have a left neighbor block */ 1711 - int haveright; /* have a right neighbor block */ 1712 - int i; /* temp, result code */ 1713 - xfs_agblock_t ltbno; /* start of left neighbor block */ 1714 - xfs_extlen_t ltlen; /* length of left neighbor block */ 1715 - xfs_mount_t *mp; /* mount point struct for filesystem */ 1716 - xfs_agblock_t nbno; /* new starting block of freespace */ 1717 - xfs_extlen_t nlen; /* new length of freespace */ 1718 - xfs_perag_t *pag; /* per allocation group data */ 1705 + struct xfs_mount *mp; 1706 + struct xfs_perag *pag; 1707 + struct xfs_btree_cur *bno_cur; 1708 + struct xfs_btree_cur *cnt_cur; 1709 + xfs_agblock_t gtbno; /* start of right neighbor */ 1710 + xfs_extlen_t gtlen; /* length of right neighbor */ 1711 + xfs_agblock_t ltbno; /* start of left neighbor */ 1712 + xfs_extlen_t ltlen; /* length of left neighbor */ 1713 + xfs_agblock_t nbno; /* new starting block of freesp */ 1714 + xfs_extlen_t nlen; /* new length of freespace */ 1715 + int haveleft; /* have a left neighbor */ 1716 + int haveright; /* have a right neighbor */ 1717 + int i; 1718 + int error; 1719 1719 1720 1720 bno_cur = cnt_cur = NULL; 1721 1721 mp = tp->t_mountp; ··· 3008 3008 * Just break up the extent address and hand off to xfs_free_ag_extent 3009 3009 * after fixing up the freelist. 3010 3010 */ 3011 - int /* error */ 3011 + int 3012 3012 __xfs_free_extent( 3013 - struct xfs_trans *tp, /* transaction pointer */ 3014 - xfs_fsblock_t bno, /* starting block number of extent */ 3015 - xfs_extlen_t len, /* length of extent */ 3016 - struct xfs_owner_info *oinfo, /* extent owner */ 3017 - enum xfs_ag_resv_type type, /* block reservation type */ 3018 - bool skip_discard) 3013 + struct xfs_trans *tp, 3014 + xfs_fsblock_t bno, 3015 + xfs_extlen_t len, 3016 + const struct xfs_owner_info *oinfo, 3017 + enum xfs_ag_resv_type type, 3018 + bool skip_discard) 3019 3019 { 3020 - struct xfs_mount *mp = tp->t_mountp; 3021 - struct xfs_buf *agbp; 3022 - xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, bno); 3023 - xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, bno); 3024 - int error; 3025 - unsigned int busy_flags = 0; 3020 + struct xfs_mount *mp = tp->t_mountp; 3021 + struct xfs_buf *agbp; 3022 + xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, bno); 3023 + xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, bno); 3024 + int error; 3025 + unsigned int busy_flags = 0; 3026 3026 3027 3027 ASSERT(len != 0); 3028 3028 ASSERT(type != XFS_AG_RESV_AGFL);
+2 -2
fs/xfs/libxfs/xfs_alloc.h
··· 182 182 struct xfs_trans *tp, /* transaction pointer */ 183 183 xfs_fsblock_t bno, /* starting block number of extent */ 184 184 xfs_extlen_t len, /* length of extent */ 185 - struct xfs_owner_info *oinfo, /* extent owner */ 185 + const struct xfs_owner_info *oinfo, /* extent owner */ 186 186 enum xfs_ag_resv_type type, /* block reservation type */ 187 187 bool skip_discard); 188 188 ··· 191 191 struct xfs_trans *tp, 192 192 xfs_fsblock_t bno, 193 193 xfs_extlen_t len, 194 - struct xfs_owner_info *oinfo, 194 + const struct xfs_owner_info *oinfo, 195 195 enum xfs_ag_resv_type type) 196 196 { 197 197 return __xfs_free_extent(tp, bno, len, oinfo, type, false);
+1 -1
fs/xfs/libxfs/xfs_bmap.c
··· 536 536 struct xfs_trans *tp, 537 537 xfs_fsblock_t bno, 538 538 xfs_filblks_t len, 539 - struct xfs_owner_info *oinfo, 539 + const struct xfs_owner_info *oinfo, 540 540 bool skip_discard) 541 541 { 542 542 struct xfs_extent_free_item *new; /* new element */
+2 -2
fs/xfs/libxfs/xfs_bmap.h
··· 186 186 int xfs_bmap_set_attrforkoff(struct xfs_inode *ip, int size, int *version); 187 187 void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork); 188 188 void __xfs_bmap_add_free(struct xfs_trans *tp, xfs_fsblock_t bno, 189 - xfs_filblks_t len, struct xfs_owner_info *oinfo, 189 + xfs_filblks_t len, const struct xfs_owner_info *oinfo, 190 190 bool skip_discard); 191 191 void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork); 192 192 int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip, ··· 234 234 struct xfs_trans *tp, 235 235 xfs_fsblock_t bno, 236 236 xfs_filblks_t len, 237 - struct xfs_owner_info *oinfo) 237 + const struct xfs_owner_info *oinfo) 238 238 { 239 239 __xfs_bmap_add_free(tp, bno, len, oinfo, false); 240 240 }
+106 -106
fs/xfs/libxfs/xfs_rmap.c
··· 458 458 */ 459 459 STATIC int 460 460 xfs_rmap_unmap( 461 - struct xfs_btree_cur *cur, 462 - xfs_agblock_t bno, 463 - xfs_extlen_t len, 464 - bool unwritten, 465 - struct xfs_owner_info *oinfo) 461 + struct xfs_btree_cur *cur, 462 + xfs_agblock_t bno, 463 + xfs_extlen_t len, 464 + bool unwritten, 465 + const struct xfs_owner_info *oinfo) 466 466 { 467 - struct xfs_mount *mp = cur->bc_mp; 468 - struct xfs_rmap_irec ltrec; 469 - uint64_t ltoff; 470 - int error = 0; 471 - int i; 472 - uint64_t owner; 473 - uint64_t offset; 474 - unsigned int flags; 475 - bool ignore_off; 467 + struct xfs_mount *mp = cur->bc_mp; 468 + struct xfs_rmap_irec ltrec; 469 + uint64_t ltoff; 470 + int error = 0; 471 + int i; 472 + uint64_t owner; 473 + uint64_t offset; 474 + unsigned int flags; 475 + bool ignore_off; 476 476 477 477 xfs_owner_info_unpack(oinfo, &owner, &offset, &flags); 478 478 ignore_off = XFS_RMAP_NON_INODE_OWNER(owner) || ··· 653 653 */ 654 654 int 655 655 xfs_rmap_free( 656 - struct xfs_trans *tp, 657 - struct xfs_buf *agbp, 658 - xfs_agnumber_t agno, 659 - xfs_agblock_t bno, 660 - xfs_extlen_t len, 661 - struct xfs_owner_info *oinfo) 656 + struct xfs_trans *tp, 657 + struct xfs_buf *agbp, 658 + xfs_agnumber_t agno, 659 + xfs_agblock_t bno, 660 + xfs_extlen_t len, 661 + const struct xfs_owner_info *oinfo) 662 662 { 663 - struct xfs_mount *mp = tp->t_mountp; 664 - struct xfs_btree_cur *cur; 665 - int error; 663 + struct xfs_mount *mp = tp->t_mountp; 664 + struct xfs_btree_cur *cur; 665 + int error; 666 666 667 667 if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) 668 668 return 0; ··· 710 710 */ 711 711 STATIC int 712 712 xfs_rmap_map( 713 - struct xfs_btree_cur *cur, 714 - xfs_agblock_t bno, 715 - xfs_extlen_t len, 716 - bool unwritten, 717 - struct xfs_owner_info *oinfo) 713 + struct xfs_btree_cur *cur, 714 + xfs_agblock_t bno, 715 + xfs_extlen_t len, 716 + bool unwritten, 717 + const struct xfs_owner_info *oinfo) 718 718 { 719 - struct xfs_mount *mp = cur->bc_mp; 720 - struct xfs_rmap_irec ltrec; 721 - struct xfs_rmap_irec gtrec; 722 - int have_gt; 723 - int have_lt; 724 - int error = 0; 725 - int i; 726 - uint64_t owner; 727 - uint64_t offset; 728 - unsigned int flags = 0; 729 - bool ignore_off; 719 + struct xfs_mount *mp = cur->bc_mp; 720 + struct xfs_rmap_irec ltrec; 721 + struct xfs_rmap_irec gtrec; 722 + int have_gt; 723 + int have_lt; 724 + int error = 0; 725 + int i; 726 + uint64_t owner; 727 + uint64_t offset; 728 + unsigned int flags = 0; 729 + bool ignore_off; 730 730 731 731 xfs_owner_info_unpack(oinfo, &owner, &offset, &flags); 732 732 ASSERT(owner != 0); ··· 890 890 */ 891 891 int 892 892 xfs_rmap_alloc( 893 - struct xfs_trans *tp, 894 - struct xfs_buf *agbp, 895 - xfs_agnumber_t agno, 896 - xfs_agblock_t bno, 897 - xfs_extlen_t len, 898 - struct xfs_owner_info *oinfo) 893 + struct xfs_trans *tp, 894 + struct xfs_buf *agbp, 895 + xfs_agnumber_t agno, 896 + xfs_agblock_t bno, 897 + xfs_extlen_t len, 898 + const struct xfs_owner_info *oinfo) 899 899 { 900 - struct xfs_mount *mp = tp->t_mountp; 901 - struct xfs_btree_cur *cur; 902 - int error; 900 + struct xfs_mount *mp = tp->t_mountp; 901 + struct xfs_btree_cur *cur; 902 + int error; 903 903 904 904 if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) 905 905 return 0; ··· 929 929 */ 930 930 STATIC int 931 931 xfs_rmap_convert( 932 - struct xfs_btree_cur *cur, 933 - xfs_agblock_t bno, 934 - xfs_extlen_t len, 935 - bool unwritten, 936 - struct xfs_owner_info *oinfo) 932 + struct xfs_btree_cur *cur, 933 + xfs_agblock_t bno, 934 + xfs_extlen_t len, 935 + bool unwritten, 936 + const struct xfs_owner_info *oinfo) 937 937 { 938 - struct xfs_mount *mp = cur->bc_mp; 939 - struct xfs_rmap_irec r[4]; /* neighbor extent entries */ 940 - /* left is 0, right is 1, prev is 2 */ 941 - /* new is 3 */ 938 + struct xfs_mount *mp = cur->bc_mp; 939 + struct xfs_rmap_irec r[4]; /* neighbor extent entries */ 940 + /* left is 0, right is 1, */ 941 + /* prev is 2, new is 3 */ 942 942 uint64_t owner; 943 943 uint64_t offset; 944 944 uint64_t new_endoff; ··· 1354 1354 */ 1355 1355 STATIC int 1356 1356 xfs_rmap_convert_shared( 1357 - struct xfs_btree_cur *cur, 1358 - xfs_agblock_t bno, 1359 - xfs_extlen_t len, 1360 - bool unwritten, 1361 - struct xfs_owner_info *oinfo) 1357 + struct xfs_btree_cur *cur, 1358 + xfs_agblock_t bno, 1359 + xfs_extlen_t len, 1360 + bool unwritten, 1361 + const struct xfs_owner_info *oinfo) 1362 1362 { 1363 - struct xfs_mount *mp = cur->bc_mp; 1364 - struct xfs_rmap_irec r[4]; /* neighbor extent entries */ 1365 - /* left is 0, right is 1, prev is 2 */ 1366 - /* new is 3 */ 1363 + struct xfs_mount *mp = cur->bc_mp; 1364 + struct xfs_rmap_irec r[4]; /* neighbor extent entries */ 1365 + /* left is 0, right is 1, */ 1366 + /* prev is 2, new is 3 */ 1367 1367 uint64_t owner; 1368 1368 uint64_t offset; 1369 1369 uint64_t new_endoff; ··· 1743 1743 */ 1744 1744 STATIC int 1745 1745 xfs_rmap_unmap_shared( 1746 - struct xfs_btree_cur *cur, 1747 - xfs_agblock_t bno, 1748 - xfs_extlen_t len, 1749 - bool unwritten, 1750 - struct xfs_owner_info *oinfo) 1746 + struct xfs_btree_cur *cur, 1747 + xfs_agblock_t bno, 1748 + xfs_extlen_t len, 1749 + bool unwritten, 1750 + const struct xfs_owner_info *oinfo) 1751 1751 { 1752 - struct xfs_mount *mp = cur->bc_mp; 1753 - struct xfs_rmap_irec ltrec; 1754 - uint64_t ltoff; 1755 - int error = 0; 1756 - int i; 1757 - uint64_t owner; 1758 - uint64_t offset; 1759 - unsigned int flags; 1752 + struct xfs_mount *mp = cur->bc_mp; 1753 + struct xfs_rmap_irec ltrec; 1754 + uint64_t ltoff; 1755 + int error = 0; 1756 + int i; 1757 + uint64_t owner; 1758 + uint64_t offset; 1759 + unsigned int flags; 1760 1760 1761 1761 xfs_owner_info_unpack(oinfo, &owner, &offset, &flags); 1762 1762 if (unwritten) ··· 1905 1905 */ 1906 1906 STATIC int 1907 1907 xfs_rmap_map_shared( 1908 - struct xfs_btree_cur *cur, 1909 - xfs_agblock_t bno, 1910 - xfs_extlen_t len, 1911 - bool unwritten, 1912 - struct xfs_owner_info *oinfo) 1908 + struct xfs_btree_cur *cur, 1909 + xfs_agblock_t bno, 1910 + xfs_extlen_t len, 1911 + bool unwritten, 1912 + const struct xfs_owner_info *oinfo) 1913 1913 { 1914 - struct xfs_mount *mp = cur->bc_mp; 1915 - struct xfs_rmap_irec ltrec; 1916 - struct xfs_rmap_irec gtrec; 1917 - int have_gt; 1918 - int have_lt; 1919 - int error = 0; 1920 - int i; 1921 - uint64_t owner; 1922 - uint64_t offset; 1923 - unsigned int flags = 0; 1914 + struct xfs_mount *mp = cur->bc_mp; 1915 + struct xfs_rmap_irec ltrec; 1916 + struct xfs_rmap_irec gtrec; 1917 + int have_gt; 1918 + int have_lt; 1919 + int error = 0; 1920 + int i; 1921 + uint64_t owner; 1922 + uint64_t offset; 1923 + unsigned int flags = 0; 1924 1924 1925 1925 xfs_owner_info_unpack(oinfo, &owner, &offset, &flags); 1926 1926 if (unwritten) ··· 2459 2459 */ 2460 2460 int 2461 2461 xfs_rmap_record_exists( 2462 - struct xfs_btree_cur *cur, 2463 - xfs_agblock_t bno, 2464 - xfs_extlen_t len, 2465 - struct xfs_owner_info *oinfo, 2466 - bool *has_rmap) 2462 + struct xfs_btree_cur *cur, 2463 + xfs_agblock_t bno, 2464 + xfs_extlen_t len, 2465 + const struct xfs_owner_info *oinfo, 2466 + bool *has_rmap) 2467 2467 { 2468 - uint64_t owner; 2469 - uint64_t offset; 2470 - unsigned int flags; 2471 - int has_record; 2472 - struct xfs_rmap_irec irec; 2473 - int error; 2468 + uint64_t owner; 2469 + uint64_t offset; 2470 + unsigned int flags; 2471 + int has_record; 2472 + struct xfs_rmap_irec irec; 2473 + int error; 2474 2474 2475 2475 xfs_owner_info_unpack(oinfo, &owner, &offset, &flags); 2476 2476 ASSERT(XFS_RMAP_NON_INODE_OWNER(owner) || ··· 2530 2530 struct xfs_btree_cur *cur, 2531 2531 xfs_agblock_t bno, 2532 2532 xfs_extlen_t len, 2533 - struct xfs_owner_info *oinfo, 2533 + const struct xfs_owner_info *oinfo, 2534 2534 bool *has_rmap) 2535 2535 { 2536 2536 struct xfs_rmap_irec low = {0};
+10 -10
fs/xfs/libxfs/xfs_rmap.h
··· 52 52 53 53 static inline bool 54 54 xfs_rmap_should_skip_owner_update( 55 - struct xfs_owner_info *oi) 55 + const struct xfs_owner_info *oi) 56 56 { 57 57 return oi->oi_owner == XFS_RMAP_OWN_NULL; 58 58 } ··· 103 103 104 104 static inline void 105 105 xfs_owner_info_unpack( 106 - struct xfs_owner_info *oinfo, 107 - uint64_t *owner, 108 - uint64_t *offset, 109 - unsigned int *flags) 106 + const struct xfs_owner_info *oinfo, 107 + uint64_t *owner, 108 + uint64_t *offset, 109 + unsigned int *flags) 110 110 { 111 - unsigned int r = 0; 111 + unsigned int r = 0; 112 112 113 113 *owner = oinfo->oi_owner; 114 114 *offset = oinfo->oi_offset; ··· 137 137 138 138 int xfs_rmap_alloc(struct xfs_trans *tp, struct xfs_buf *agbp, 139 139 xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len, 140 - struct xfs_owner_info *oinfo); 140 + const struct xfs_owner_info *oinfo); 141 141 int xfs_rmap_free(struct xfs_trans *tp, struct xfs_buf *agbp, 142 142 xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len, 143 - struct xfs_owner_info *oinfo); 143 + const struct xfs_owner_info *oinfo); 144 144 145 145 int xfs_rmap_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno, 146 146 xfs_extlen_t len, uint64_t owner, uint64_t offset, ··· 218 218 int xfs_rmap_has_record(struct xfs_btree_cur *cur, xfs_agblock_t bno, 219 219 xfs_extlen_t len, bool *exists); 220 220 int xfs_rmap_record_exists(struct xfs_btree_cur *cur, xfs_agblock_t bno, 221 - xfs_extlen_t len, struct xfs_owner_info *oinfo, 221 + xfs_extlen_t len, const struct xfs_owner_info *oinfo, 222 222 bool *has_rmap); 223 223 int xfs_rmap_has_other_keys(struct xfs_btree_cur *cur, xfs_agblock_t bno, 224 - xfs_extlen_t len, struct xfs_owner_info *oinfo, 224 + xfs_extlen_t len, const struct xfs_owner_info *oinfo, 225 225 bool *has_rmap); 226 226 int xfs_rmap_map_raw(struct xfs_btree_cur *cur, struct xfs_rmap_irec *rmap); 227 227
+23 -22
fs/xfs/scrub/btree.c
··· 583 583 */ 584 584 int 585 585 xchk_btree( 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) 586 + struct xfs_scrub *sc, 587 + struct xfs_btree_cur *cur, 588 + xchk_btree_rec_fn scrub_fn, 589 + const 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 = { 593 + .cur = cur, 594 + .scrub_rec = scrub_fn, 595 + .oinfo = oinfo, 596 + .firstrec = true, 597 + .private = private, 598 + .sc = sc, 599 + }; 600 + union xfs_btree_ptr ptr; 601 + union xfs_btree_ptr *pp; 602 + union xfs_btree_rec *recp; 603 + struct xfs_btree_block *block; 604 + int level; 605 + struct xfs_buf *bp; 606 + struct check_owner *co; 607 + struct check_owner *n; 608 + int i; 609 + int error = 0; 603 610 604 611 /* Initialize scrub state */ 605 - bs.cur = cur; 606 - bs.scrub_rec = scrub_fn; 607 - bs.oinfo = oinfo; 608 - bs.firstrec = true; 609 - bs.private = private; 610 - bs.sc = sc; 611 612 for (i = 0; i < XFS_BTREE_MAXLEVELS; i++) 612 613 bs.firstkey[i] = true; 613 614 INIT_LIST_HEAD(&bs.to_check);
+11 -11
fs/xfs/scrub/btree.h
··· 31 31 32 32 struct xchk_btree { 33 33 /* caller-provided scrub state */ 34 - 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; 34 + struct xfs_scrub *sc; 35 + struct xfs_btree_cur *cur; 36 + xchk_btree_rec_fn scrub_rec; 37 + const struct xfs_owner_info *oinfo; 38 + void *private; 39 39 40 40 /* 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; 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; 46 46 }; 47 47 int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 48 - xchk_btree_rec_fn scrub_fn, struct xfs_owner_info *oinfo, 48 + xchk_btree_rec_fn scrub_fn, const struct xfs_owner_info *oinfo, 49 49 void *private); 50 50 51 51 #endif /* __XFS_SCRUB_BTREE_H__ */
+7 -7
fs/xfs/scrub/common.c
··· 313 313 */ 314 314 315 315 struct xchk_rmap_ownedby_info { 316 - struct xfs_owner_info *oinfo; 317 - xfs_filblks_t *blocks; 316 + const struct xfs_owner_info *oinfo; 317 + xfs_filblks_t *blocks; 318 318 }; 319 319 320 320 STATIC int ··· 347 347 xchk_count_rmap_ownedby_ag( 348 348 struct xfs_scrub *sc, 349 349 struct xfs_btree_cur *cur, 350 - struct xfs_owner_info *oinfo, 350 + const struct xfs_owner_info *oinfo, 351 351 xfs_filblks_t *blocks) 352 352 { 353 - struct xchk_rmap_ownedby_info sroi; 353 + struct xchk_rmap_ownedby_info sroi = { 354 + .oinfo = oinfo, 355 + .blocks = blocks, 356 + }; 354 357 355 - sroi.oinfo = oinfo; 356 358 *blocks = 0; 357 - sroi.blocks = blocks; 358 - 359 359 return xfs_rmap_query_all(cur, xchk_count_rmap_ownedby_irec, 360 360 &sroi); 361 361 }
+1 -1
fs/xfs/scrub/common.h
··· 116 116 void xchk_ag_btcur_free(struct xchk_ag *sa); 117 117 int xchk_ag_btcur_init(struct xfs_scrub *sc, struct xchk_ag *sa); 118 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); 119 + const struct xfs_owner_info *oinfo, xfs_filblks_t *blocks); 120 120 121 121 int xchk_setup_ag_btree(struct xfs_scrub *sc, struct xfs_inode *ip, 122 122 bool force_log);
+6 -5
fs/xfs/scrub/refcount.c
··· 383 383 STATIC void 384 384 xchk_refcount_xref_rmap( 385 385 struct xfs_scrub *sc, 386 - struct xfs_owner_info *oinfo, 387 386 xfs_filblks_t cow_blocks) 388 387 { 388 + struct xfs_owner_info oinfo; 389 389 xfs_extlen_t refcbt_blocks = 0; 390 390 xfs_filblks_t blocks; 391 391 int error; ··· 394 394 return; 395 395 396 396 /* Check that we saw as many refcbt blocks as the rmap knows about. */ 397 + xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_REFC); 397 398 error = xfs_btree_count_blocks(sc->sa.refc_cur, &refcbt_blocks); 398 399 if (!xchk_btree_process_error(sc, sc->sa.refc_cur, 0, &error)) 399 400 return; 400 - error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, oinfo, 401 + error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, &oinfo, 401 402 &blocks); 402 403 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) 403 404 return; ··· 406 405 xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0); 407 406 408 407 /* Check that we saw as many cow blocks as the rmap knows about. */ 409 - xfs_rmap_ag_owner(oinfo, XFS_RMAP_OWN_COW); 410 - error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, oinfo, 408 + xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_COW); 409 + error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, &oinfo, 411 410 &blocks); 412 411 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) 413 412 return; ··· 430 429 if (error) 431 430 return error; 432 431 433 - xchk_refcount_xref_rmap(sc, &oinfo, cow_blocks); 432 + xchk_refcount_xref_rmap(sc, cow_blocks); 434 433 435 434 return 0; 436 435 }
+25 -25
fs/xfs/scrub/repair.c
··· 299 299 /* Allocate a block in an AG. */ 300 300 int 301 301 xrep_alloc_ag_block( 302 - struct xfs_scrub *sc, 303 - struct xfs_owner_info *oinfo, 304 - xfs_fsblock_t *fsbno, 305 - enum xfs_ag_resv_type resv) 302 + struct xfs_scrub *sc, 303 + const struct xfs_owner_info *oinfo, 304 + xfs_fsblock_t *fsbno, 305 + enum xfs_ag_resv_type resv) 306 306 { 307 - struct xfs_alloc_arg args = {0}; 308 - xfs_agblock_t bno; 309 - int error; 307 + struct xfs_alloc_arg args = {0}; 308 + xfs_agblock_t bno; 309 + int error; 310 310 311 311 switch (resv) { 312 312 case XFS_AG_RESV_AGFL: ··· 538 538 /* Dispose of a single block. */ 539 539 STATIC int 540 540 xrep_reap_block( 541 - struct xfs_scrub *sc, 542 - xfs_fsblock_t fsbno, 543 - struct xfs_owner_info *oinfo, 544 - enum xfs_ag_resv_type resv) 541 + struct xfs_scrub *sc, 542 + xfs_fsblock_t fsbno, 543 + const struct xfs_owner_info *oinfo, 544 + enum xfs_ag_resv_type resv) 545 545 { 546 - struct xfs_btree_cur *cur; 547 - struct xfs_buf *agf_bp = NULL; 548 - xfs_agnumber_t agno; 549 - xfs_agblock_t agbno; 550 - bool has_other_rmap; 551 - int error; 546 + struct xfs_btree_cur *cur; 547 + struct xfs_buf *agf_bp = NULL; 548 + xfs_agnumber_t agno; 549 + xfs_agblock_t agbno; 550 + bool has_other_rmap; 551 + int error; 552 552 553 553 agno = XFS_FSB_TO_AGNO(sc->mp, fsbno); 554 554 agbno = XFS_FSB_TO_AGBNO(sc->mp, fsbno); ··· 612 612 /* Dispose of every block of every extent in the bitmap. */ 613 613 int 614 614 xrep_reap_extents( 615 - struct xfs_scrub *sc, 616 - struct xfs_bitmap *bitmap, 617 - struct xfs_owner_info *oinfo, 618 - enum xfs_ag_resv_type type) 615 + struct xfs_scrub *sc, 616 + struct xfs_bitmap *bitmap, 617 + const struct xfs_owner_info *oinfo, 618 + enum xfs_ag_resv_type type) 619 619 { 620 - struct xfs_bitmap_range *bmr; 621 - struct xfs_bitmap_range *n; 622 - xfs_fsblock_t fsbno; 623 - int error = 0; 620 + struct xfs_bitmap_range *bmr; 621 + struct xfs_bitmap_range *n; 622 + xfs_fsblock_t fsbno; 623 + int error = 0; 624 624 625 625 ASSERT(xfs_sb_version_hasrmapbt(&sc->mp->m_sb)); 626 626
+4 -3
fs/xfs/scrub/repair.h
··· 21 21 bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks, 22 22 enum xfs_ag_resv_type type); 23 23 xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc); 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); 24 + int xrep_alloc_ag_block(struct xfs_scrub *sc, 25 + const struct xfs_owner_info *oinfo, xfs_fsblock_t *fsbno, 26 + enum xfs_ag_resv_type resv); 26 27 int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb, 27 28 struct xfs_buf **bpp, xfs_btnum_t btnum, 28 29 const struct xfs_buf_ops *ops); ··· 33 32 int xrep_fix_freelist(struct xfs_scrub *sc, bool can_shrink); 34 33 int xrep_invalidate_blocks(struct xfs_scrub *sc, struct xfs_bitmap *btlist); 35 34 int xrep_reap_extents(struct xfs_scrub *sc, struct xfs_bitmap *exlist, 36 - struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type); 35 + const struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type); 37 36 38 37 struct xrep_find_ag_btree { 39 38 /* in: rmap owner of the btree we're looking for */
+15 -15
fs/xfs/scrub/rmap.c
··· 184 184 /* xref check that the extent is owned by a given owner */ 185 185 static inline void 186 186 xchk_xref_check_owner( 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) 187 + struct xfs_scrub *sc, 188 + xfs_agblock_t bno, 189 + xfs_extlen_t len, 190 + const 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; ··· 207 207 /* xref check that the extent is owned by a given owner */ 208 208 void 209 209 xchk_xref_is_owned_by( 210 - struct xfs_scrub *sc, 211 - xfs_agblock_t bno, 212 - xfs_extlen_t len, 213 - struct xfs_owner_info *oinfo) 210 + struct xfs_scrub *sc, 211 + xfs_agblock_t bno, 212 + xfs_extlen_t len, 213 + const struct xfs_owner_info *oinfo) 214 214 { 215 215 xchk_xref_check_owner(sc, bno, len, oinfo, true); 216 216 } ··· 218 218 /* xref check that the extent is not owned by a given owner */ 219 219 void 220 220 xchk_xref_is_not_owned_by( 221 - struct xfs_scrub *sc, 222 - xfs_agblock_t bno, 223 - xfs_extlen_t len, 224 - struct xfs_owner_info *oinfo) 221 + struct xfs_scrub *sc, 222 + xfs_agblock_t bno, 223 + xfs_extlen_t len, 224 + const struct xfs_owner_info *oinfo) 225 225 { 226 226 xchk_xref_check_owner(sc, bno, len, oinfo, false); 227 227 }
+2 -2
fs/xfs/scrub/scrub.h
··· 122 122 void xchk_xref_is_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno, 123 123 xfs_extlen_t len); 124 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); 125 + xfs_extlen_t len, const struct xfs_owner_info *oinfo); 126 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); 127 + xfs_extlen_t len, const struct xfs_owner_info *oinfo); 128 128 void xchk_xref_has_no_owner(struct xfs_scrub *sc, xfs_agblock_t agbno, 129 129 xfs_extlen_t len); 130 130 void xchk_xref_is_cow_staging(struct xfs_scrub *sc, xfs_agblock_t bno,
+2 -2
fs/xfs/xfs_trace.h
··· 2405 2405 DECLARE_EVENT_CLASS(xfs_rmap_class, 2406 2406 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2407 2407 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, 2408 - struct xfs_owner_info *oinfo), 2408 + const struct xfs_owner_info *oinfo), 2409 2409 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo), 2410 2410 TP_STRUCT__entry( 2411 2411 __field(dev_t, dev) ··· 2440 2440 DEFINE_EVENT(xfs_rmap_class, name, \ 2441 2441 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2442 2442 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \ 2443 - struct xfs_owner_info *oinfo), \ 2443 + const struct xfs_owner_info *oinfo), \ 2444 2444 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo)) 2445 2445 2446 2446 /* simple AG-based error/%ip tracepoint class */
+2 -1
fs/xfs/xfs_trans.h
··· 228 228 uint); 229 229 int xfs_trans_free_extent(struct xfs_trans *, 230 230 struct xfs_efd_log_item *, xfs_fsblock_t, 231 - xfs_extlen_t, struct xfs_owner_info *, 231 + xfs_extlen_t, 232 + const struct xfs_owner_info *, 232 233 bool); 233 234 int xfs_trans_commit(struct xfs_trans *); 234 235 int xfs_trans_roll(struct xfs_trans **);
+13 -12
fs/xfs/xfs_trans_extfree.c
··· 53 53 */ 54 54 int 55 55 xfs_trans_free_extent( 56 - struct xfs_trans *tp, 57 - struct xfs_efd_log_item *efdp, 58 - xfs_fsblock_t start_block, 59 - xfs_extlen_t ext_len, 60 - struct xfs_owner_info *oinfo, 61 - bool skip_discard) 56 + struct xfs_trans *tp, 57 + struct xfs_efd_log_item *efdp, 58 + xfs_fsblock_t start_block, 59 + xfs_extlen_t ext_len, 60 + const struct xfs_owner_info *oinfo, 61 + bool skip_discard) 62 62 { 63 - struct xfs_mount *mp = tp->t_mountp; 64 - uint next_extent; 65 - xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, start_block); 66 - xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, start_block); 67 - struct xfs_extent *extp; 68 - int error; 63 + struct xfs_mount *mp = tp->t_mountp; 64 + struct xfs_extent *extp; 65 + uint next_extent; 66 + xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, start_block); 67 + xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, 68 + start_block); 69 + int error; 69 70 70 71 trace_xfs_bmap_free_deferred(tp->t_mountp, agno, 0, agbno, ext_len); 71 72