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