]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: standardize the btree maxrecs function parameters
authorDarrick J. Wong <djwong@kernel.org>
Wed, 29 May 2024 04:11:30 +0000 (21:11 -0700)
committerChristoph Hellwig <hch@lst.de>
Sat, 10 Aug 2024 08:44:21 +0000 (10:44 +0200)
Standardize the parameters in xfs_{alloc,bm,ino,rmap,refcount}bt_maxrecs
so that we have consistent calling conventions.  This doesn't affect the
kernel that much, but enables us to clean up userspace a bit.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
14 files changed:
fs/xfs/libxfs/xfs_alloc_btree.c
fs/xfs/libxfs/xfs_alloc_btree.h
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_bmap_btree.c
fs/xfs/libxfs/xfs_bmap_btree.h
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_ialloc_btree.c
fs/xfs/libxfs/xfs_ialloc_btree.h
fs/xfs/libxfs/xfs_inode_fork.c
fs/xfs/libxfs/xfs_refcount_btree.c
fs/xfs/libxfs/xfs_refcount_btree.h
fs/xfs/libxfs/xfs_rmap_btree.c
fs/xfs/libxfs/xfs_rmap_btree.h
fs/xfs/libxfs/xfs_sb.c

index 585e98e87ef9ef93006e85773990593ee9dd0827..aada676eee519cc9875862d2847d5d932d948b63 100644 (file)
@@ -569,11 +569,11 @@ xfs_allocbt_block_maxrecs(
 /*
  * Calculate number of records in an alloc btree block.
  */
-int
+unsigned int
 xfs_allocbt_maxrecs(
        struct xfs_mount        *mp,
-       int                     blocklen,
-       int                     leaf)
+       unsigned int            blocklen,
+       bool                    leaf)
 {
        blocklen -= XFS_ALLOC_BLOCK_LEN(mp);
        return xfs_allocbt_block_maxrecs(blocklen, leaf);
index 155b47f231ab2f8de16f5e0cbf3919b0d4709791..12647f9aaa6d7937dfa0e0f4299e502c112a782c 100644 (file)
@@ -53,7 +53,8 @@ struct xfs_btree_cur *xfs_bnobt_init_cursor(struct xfs_mount *mp,
 struct xfs_btree_cur *xfs_cntbt_init_cursor(struct xfs_mount *mp,
                struct xfs_trans *tp, struct xfs_buf *bp,
                struct xfs_perag *pag);
-extern int xfs_allocbt_maxrecs(struct xfs_mount *, int, int);
+unsigned int xfs_allocbt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
+               bool leaf);
 extern xfs_extlen_t xfs_allocbt_calc_size(struct xfs_mount *mp,
                unsigned long long len);
 
index 6a26ff1689db8976532d53f9b000d8ef36db77b5..9e16163017a5f0ca42a623d695170c8366e80f25 100644 (file)
@@ -585,7 +585,7 @@ xfs_bmap_btree_to_extents(
        ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE);
        ASSERT(be16_to_cpu(rblock->bb_level) == 1);
        ASSERT(be16_to_cpu(rblock->bb_numrecs) == 1);
-       ASSERT(xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0) == 1);
+       ASSERT(xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, false) == 1);
 
        pp = xfs_bmap_broot_ptr_addr(mp, rblock, 1, ifp->if_broot_bytes);
        cbno = be64_to_cpu(*pp);
index bbcf099d8cf396df871f9207fff36b319d29773f..6107b2bc29066acb4f2ff08a82da47f24a6a1886 100644 (file)
@@ -645,11 +645,11 @@ xfs_bmbt_commit_staged_btree(
 /*
  * Calculate number of records in a bmap btree block.
  */
-int
+unsigned int
 xfs_bmbt_maxrecs(
        struct xfs_mount        *mp,
-       int                     blocklen,
-       int                     leaf)
+       unsigned int            blocklen,
+       bool                    leaf)
 {
        blocklen -= xfs_bmbt_block_len(mp);
        return xfs_bmbt_block_maxrecs(blocklen, leaf);
index a187f4b120ea19b868e6e25b1e3a18a3332f888f..df6a60452260ea5799a38ba7cd5cc180ac98b032 100644 (file)
@@ -35,7 +35,8 @@ extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int,
 
 extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level);
 extern int xfs_bmdr_maxrecs(int blocklen, int leaf);
-extern int xfs_bmbt_maxrecs(struct xfs_mount *, int blocklen, int leaf);
+unsigned int xfs_bmbt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
+               bool leaf);
 
 extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
                                 int whichfork, xfs_ino_t new_owner,
@@ -151,7 +152,7 @@ xfs_bmap_broot_ptr_addr(
        unsigned int            i,
        unsigned int            sz)
 {
-       return xfs_bmbt_ptr_addr(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, 0));
+       return xfs_bmbt_ptr_addr(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, false));
 }
 
 /*
index 79321aed6dc20b80639c885d0f804412e8fab9a9..34344e7e509e59e79a09dfefc7539f50a97d2cc4 100644 (file)
@@ -2970,8 +2970,8 @@ xfs_ialloc_setup_geometry(
 
        /* Compute inode btree geometry. */
        igeo->agino_log = sbp->sb_inopblog + sbp->sb_agblklog;
-       igeo->inobt_mxr[0] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 1);
-       igeo->inobt_mxr[1] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 0);
+       igeo->inobt_mxr[0] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, true);
+       igeo->inobt_mxr[1] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, false);
        igeo->inobt_mnr[0] = igeo->inobt_mxr[0] / 2;
        igeo->inobt_mnr[1] = igeo->inobt_mxr[1] / 2;
 
index 496e2f72a85b9869186c4f92a39339283c70292a..9d7ade224f32b8d9d982b702719cd30f73f26d9b 100644 (file)
@@ -572,11 +572,11 @@ xfs_inobt_block_maxrecs(
 /*
  * Calculate number of records in an inobt btree block.
  */
-int
+unsigned int
 xfs_inobt_maxrecs(
        struct xfs_mount        *mp,
-       int                     blocklen,
-       int                     leaf)
+       unsigned int            blocklen,
+       bool                    leaf)
 {
        blocklen -= XFS_INOBT_BLOCK_LEN(mp);
        return xfs_inobt_block_maxrecs(blocklen, leaf);
index 6472ec1ecbb45839d23993ca9d13c9089e33e541..300edf5bc00949fe3d2e6ace63958c3ea88767fd 100644 (file)
@@ -50,7 +50,8 @@ struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_perag *pag,
                struct xfs_trans *tp, struct xfs_buf *agbp);
 struct xfs_btree_cur *xfs_finobt_init_cursor(struct xfs_perag *pag,
                struct xfs_trans *tp, struct xfs_buf *agbp);
-extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int);
+unsigned int xfs_inobt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
+               bool leaf);
 
 /* ir_holemask to inode allocation bitmap conversion */
 uint64_t xfs_inobt_irec_to_allocmask(const struct xfs_inobt_rec_incore *irec);
index 854a9d10e1ed3e579077ebb7d026c2d2556f0a25..59399fbc74453ec06a4176c99af8ddffbbf275cb 100644 (file)
@@ -480,7 +480,7 @@ xfs_iroot_realloc(
        }
 
        /* Compute the new and old record count and space requirements. */
-       cur_max = xfs_bmbt_maxrecs(mp, old_size, 0);
+       cur_max = xfs_bmbt_maxrecs(mp, old_size, false);
        new_max = cur_max + rec_diff;
        ASSERT(new_max >= 0);
        new_size = xfs_bmap_broot_space_calc(mp, new_max);
index cb3b1d42ae9a88720174e98e28849a73a25f8355..795928d1a66d8885a733227e37e05f7361b0cdf1 100644 (file)
@@ -417,9 +417,10 @@ xfs_refcountbt_block_maxrecs(
 /*
  * Calculate the number of records in a refcount btree block.
  */
-int
+unsigned int
 xfs_refcountbt_maxrecs(
-       int                     blocklen,
+       struct xfs_mount        *mp,
+       unsigned int            blocklen,
        bool                    leaf)
 {
        blocklen -= XFS_REFCOUNT_BLOCK_LEN;
index 1e0ab25f6c68087882a7448959f9cb3f3bd8288e..beb93bef6a8141d3b842580fddf72f1f82046e83 100644 (file)
@@ -48,7 +48,8 @@ struct xbtree_afakeroot;
 extern struct xfs_btree_cur *xfs_refcountbt_init_cursor(struct xfs_mount *mp,
                struct xfs_trans *tp, struct xfs_buf *agbp,
                struct xfs_perag *pag);
-extern int xfs_refcountbt_maxrecs(int blocklen, bool leaf);
+unsigned int xfs_refcountbt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
+               bool leaf);
 extern void xfs_refcountbt_compute_maxlevels(struct xfs_mount *mp);
 
 extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp,
index 56fd6c4bd8b41dc2ca5d017605bda1b82f93c268..ac2f1f499b76f6977942c9dd3ee88ca3056ef9a5 100644 (file)
@@ -731,10 +731,11 @@ xfs_rmapbt_block_maxrecs(
 /*
  * Calculate number of records in an rmap btree block.
  */
-int
+unsigned int
 xfs_rmapbt_maxrecs(
-       int                     blocklen,
-       int                     leaf)
+       struct xfs_mount        *mp,
+       unsigned int            blocklen,
+       bool                    leaf)
 {
        blocklen -= XFS_RMAP_BLOCK_LEN;
        return xfs_rmapbt_block_maxrecs(blocklen, leaf);
index eb90d89e8086668047656d3009ea6bda74581437..119b1567cd0ee824e4b02403138868cfbe2fed5d 100644 (file)
@@ -47,7 +47,8 @@ struct xfs_btree_cur *xfs_rmapbt_init_cursor(struct xfs_mount *mp,
                                struct xfs_perag *pag);
 void xfs_rmapbt_commit_staged_btree(struct xfs_btree_cur *cur,
                struct xfs_trans *tp, struct xfs_buf *agbp);
-int xfs_rmapbt_maxrecs(int blocklen, int leaf);
+unsigned int xfs_rmapbt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
+               bool leaf);
 extern void xfs_rmapbt_compute_maxlevels(struct xfs_mount *mp);
 
 extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp,
index f07ec99824e4993e86b0cc65c5710bf4eeeb214c..ffe13ad098c51333fa4fb2fc5385ad17dbae4976 100644 (file)
@@ -1132,23 +1132,23 @@ xfs_sb_mount_common(
        mp->m_rtx_per_rbmblock = mp->m_blockwsize << XFS_NBWORDLOG;
        xfs_mount_sb_set_rextsize(mp, sbp);
 
-       mp->m_alloc_mxr[0] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, 1);
-       mp->m_alloc_mxr[1] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, 0);
+       mp->m_alloc_mxr[0] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, true);
+       mp->m_alloc_mxr[1] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, false);
        mp->m_alloc_mnr[0] = mp->m_alloc_mxr[0] / 2;
        mp->m_alloc_mnr[1] = mp->m_alloc_mxr[1] / 2;
 
-       mp->m_bmap_dmxr[0] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, 1);
-       mp->m_bmap_dmxr[1] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, 0);
+       mp->m_bmap_dmxr[0] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, true);
+       mp->m_bmap_dmxr[1] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, false);
        mp->m_bmap_dmnr[0] = mp->m_bmap_dmxr[0] / 2;
        mp->m_bmap_dmnr[1] = mp->m_bmap_dmxr[1] / 2;
 
-       mp->m_rmap_mxr[0] = xfs_rmapbt_maxrecs(sbp->sb_blocksize, 1);
-       mp->m_rmap_mxr[1] = xfs_rmapbt_maxrecs(sbp->sb_blocksize, 0);
+       mp->m_rmap_mxr[0] = xfs_rmapbt_maxrecs(mp, sbp->sb_blocksize, true);
+       mp->m_rmap_mxr[1] = xfs_rmapbt_maxrecs(mp, sbp->sb_blocksize, false);
        mp->m_rmap_mnr[0] = mp->m_rmap_mxr[0] / 2;
        mp->m_rmap_mnr[1] = mp->m_rmap_mxr[1] / 2;
 
-       mp->m_refc_mxr[0] = xfs_refcountbt_maxrecs(sbp->sb_blocksize, true);
-       mp->m_refc_mxr[1] = xfs_refcountbt_maxrecs(sbp->sb_blocksize, false);
+       mp->m_refc_mxr[0] = xfs_refcountbt_maxrecs(mp, sbp->sb_blocksize, true);
+       mp->m_refc_mxr[1] = xfs_refcountbt_maxrecs(mp, sbp->sb_blocksize, false);
        mp->m_refc_mnr[0] = mp->m_refc_mxr[0] / 2;
        mp->m_refc_mnr[1] = mp->m_refc_mxr[1] / 2;