Skip to content

Commit 411a712

Browse files
author
Darrick J. Wong
committed
xfs: standardize the btree maxrecs function parameters
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> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 79124b3 commit 411a712

14 files changed

Lines changed: 40 additions & 33 deletions

fs/xfs/libxfs/xfs_alloc_btree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,11 @@ xfs_allocbt_block_maxrecs(
569569
/*
570570
* Calculate number of records in an alloc btree block.
571571
*/
572-
int
572+
unsigned int
573573
xfs_allocbt_maxrecs(
574574
struct xfs_mount *mp,
575-
int blocklen,
576-
int leaf)
575+
unsigned int blocklen,
576+
bool leaf)
577577
{
578578
blocklen -= XFS_ALLOC_BLOCK_LEN(mp);
579579
return xfs_allocbt_block_maxrecs(blocklen, leaf);

fs/xfs/libxfs/xfs_alloc_btree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ struct xfs_btree_cur *xfs_bnobt_init_cursor(struct xfs_mount *mp,
5353
struct xfs_btree_cur *xfs_cntbt_init_cursor(struct xfs_mount *mp,
5454
struct xfs_trans *tp, struct xfs_buf *bp,
5555
struct xfs_perag *pag);
56-
extern int xfs_allocbt_maxrecs(struct xfs_mount *, int, int);
56+
unsigned int xfs_allocbt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
57+
bool leaf);
5758
extern xfs_extlen_t xfs_allocbt_calc_size(struct xfs_mount *mp,
5859
unsigned long long len);
5960

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ xfs_bmap_btree_to_extents(
584584
ASSERT(ifp->if_format == XFS_DINODE_FMT_BTREE);
585585
ASSERT(be16_to_cpu(rblock->bb_level) == 1);
586586
ASSERT(be16_to_cpu(rblock->bb_numrecs) == 1);
587-
ASSERT(xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0) == 1);
587+
ASSERT(xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, false) == 1);
588588

589589
pp = xfs_bmap_broot_ptr_addr(mp, rblock, 1, ifp->if_broot_bytes);
590590
cbno = be64_to_cpu(*pp);

fs/xfs/libxfs/xfs_bmap_btree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,11 @@ xfs_bmbt_commit_staged_btree(
645645
/*
646646
* Calculate number of records in a bmap btree block.
647647
*/
648-
int
648+
unsigned int
649649
xfs_bmbt_maxrecs(
650650
struct xfs_mount *mp,
651-
int blocklen,
652-
int leaf)
651+
unsigned int blocklen,
652+
bool leaf)
653653
{
654654
blocklen -= xfs_bmbt_block_len(mp);
655655
return xfs_bmbt_block_maxrecs(blocklen, leaf);

fs/xfs/libxfs/xfs_bmap_btree.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int,
3535

3636
extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level);
3737
extern int xfs_bmdr_maxrecs(int blocklen, int leaf);
38-
extern int xfs_bmbt_maxrecs(struct xfs_mount *, int blocklen, int leaf);
38+
unsigned int xfs_bmbt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
39+
bool leaf);
3940

4041
extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
4142
int whichfork, xfs_ino_t new_owner,
@@ -151,7 +152,7 @@ xfs_bmap_broot_ptr_addr(
151152
unsigned int i,
152153
unsigned int sz)
153154
{
154-
return xfs_bmbt_ptr_addr(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, 0));
155+
return xfs_bmbt_ptr_addr(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, false));
155156
}
156157

157158
/*

fs/xfs/libxfs/xfs_ialloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,8 +2948,8 @@ xfs_ialloc_setup_geometry(
29482948

29492949
/* Compute inode btree geometry. */
29502950
igeo->agino_log = sbp->sb_inopblog + sbp->sb_agblklog;
2951-
igeo->inobt_mxr[0] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 1);
2952-
igeo->inobt_mxr[1] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 0);
2951+
igeo->inobt_mxr[0] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, true);
2952+
igeo->inobt_mxr[1] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, false);
29532953
igeo->inobt_mnr[0] = igeo->inobt_mxr[0] / 2;
29542954
igeo->inobt_mnr[1] = igeo->inobt_mxr[1] / 2;
29552955

fs/xfs/libxfs/xfs_ialloc_btree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,11 +572,11 @@ xfs_inobt_block_maxrecs(
572572
/*
573573
* Calculate number of records in an inobt btree block.
574574
*/
575-
int
575+
unsigned int
576576
xfs_inobt_maxrecs(
577577
struct xfs_mount *mp,
578-
int blocklen,
579-
int leaf)
578+
unsigned int blocklen,
579+
bool leaf)
580580
{
581581
blocklen -= XFS_INOBT_BLOCK_LEN(mp);
582582
return xfs_inobt_block_maxrecs(blocklen, leaf);

fs/xfs/libxfs/xfs_ialloc_btree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_perag *pag,
5050
struct xfs_trans *tp, struct xfs_buf *agbp);
5151
struct xfs_btree_cur *xfs_finobt_init_cursor(struct xfs_perag *pag,
5252
struct xfs_trans *tp, struct xfs_buf *agbp);
53-
extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int);
53+
unsigned int xfs_inobt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
54+
bool leaf);
5455

5556
/* ir_holemask to inode allocation bitmap conversion */
5657
uint64_t xfs_inobt_irec_to_allocmask(const struct xfs_inobt_rec_incore *irec);

fs/xfs/libxfs/xfs_inode_fork.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ xfs_iroot_realloc(
422422
* location. The records don't change location because
423423
* they are kept butted up against the btree block header.
424424
*/
425-
cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0);
425+
cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, false);
426426
new_max = cur_max + rec_diff;
427427
new_size = xfs_bmap_broot_space_calc(mp, new_max);
428428
ifp->if_broot = krealloc(ifp->if_broot, new_size,
@@ -444,7 +444,7 @@ xfs_iroot_realloc(
444444
* records, just get rid of the root and clear the status bit.
445445
*/
446446
ASSERT((ifp->if_broot != NULL) && (ifp->if_broot_bytes > 0));
447-
cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0);
447+
cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, false);
448448
new_max = cur_max + rec_diff;
449449
ASSERT(new_max >= 0);
450450
if (new_max > 0)

fs/xfs/libxfs/xfs_refcount_btree.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,10 @@ xfs_refcountbt_block_maxrecs(
417417
/*
418418
* Calculate the number of records in a refcount btree block.
419419
*/
420-
int
420+
unsigned int
421421
xfs_refcountbt_maxrecs(
422-
int blocklen,
422+
struct xfs_mount *mp,
423+
unsigned int blocklen,
423424
bool leaf)
424425
{
425426
blocklen -= XFS_REFCOUNT_BLOCK_LEN;

0 commit comments

Comments
 (0)