aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_rmap.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-12-12 11:46:23 -0500
committerDarrick J. Wong <darrick.wong@oracle.com>2018-12-12 11:47:16 -0500
commit66e3237e724c6650dca03627b40bb00a812d3f7a (patch)
tree84a31606547b538fb2e8fb4dd5b732f0444c53fb /fs/xfs/libxfs/xfs_rmap.c
parent02b100fb83f9b0f8719deef6c4ed973b4d9ce00c (diff)
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_rmap.c')
-rw-r--r--fs/xfs/libxfs/xfs_rmap.c212
1 files changed, 106 insertions, 106 deletions
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 */
459STATIC int 459STATIC int
460xfs_rmap_unmap( 460xfs_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 */
654int 654int
655xfs_rmap_free( 655xfs_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 */
711STATIC int 711STATIC int
712xfs_rmap_map( 712xfs_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 */
891int 891int
892xfs_rmap_alloc( 892xfs_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 */
930STATIC int 930STATIC int
931xfs_rmap_convert( 931xfs_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 */
1355STATIC int 1355STATIC int
1356xfs_rmap_convert_shared( 1356xfs_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 */
1744STATIC int 1744STATIC int
1745xfs_rmap_unmap_shared( 1745xfs_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 */
1906STATIC int 1906STATIC int
1907xfs_rmap_map_shared( 1907xfs_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 */
2460int 2460int
2461xfs_rmap_record_exists( 2461xfs_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};