xfs: remove superflous inobt macros
xfs_ialloc_btree.h has a a cuple of macros that only obsfucate the code but don't provide any abstraction benefits. This patches removes those and cleans up the reamaining defintions up a little. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
7153f8ba2b
commit
0d87e656dd
5 changed files with 17 additions and 31 deletions
|
@ -230,7 +230,7 @@ xfs_ialloc_ag_alloc(
|
||||||
args.minalignslop = xfs_ialloc_cluster_alignment(&args) - 1;
|
args.minalignslop = xfs_ialloc_cluster_alignment(&args) - 1;
|
||||||
|
|
||||||
/* Allow space for the inode btree to split. */
|
/* Allow space for the inode btree to split. */
|
||||||
args.minleft = XFS_IN_MAXLEVELS(args.mp) - 1;
|
args.minleft = args.mp->m_in_maxlevels - 1;
|
||||||
if ((error = xfs_alloc_vextent(&args)))
|
if ((error = xfs_alloc_vextent(&args)))
|
||||||
return error;
|
return error;
|
||||||
} else
|
} else
|
||||||
|
@ -270,7 +270,7 @@ xfs_ialloc_ag_alloc(
|
||||||
/*
|
/*
|
||||||
* Allow space for the inode btree to split.
|
* Allow space for the inode btree to split.
|
||||||
*/
|
*/
|
||||||
args.minleft = XFS_IN_MAXLEVELS(args.mp) - 1;
|
args.minleft = args.mp->m_in_maxlevels - 1;
|
||||||
if ((error = xfs_alloc_vextent(&args)))
|
if ((error = xfs_alloc_vextent(&args)))
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -943,7 +943,7 @@ nextag:
|
||||||
ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) %
|
ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) %
|
||||||
XFS_INODES_PER_CHUNK) == 0);
|
XFS_INODES_PER_CHUNK) == 0);
|
||||||
ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino + offset);
|
ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino + offset);
|
||||||
XFS_INOBT_CLR_FREE(&rec, offset);
|
rec.ir_free &= ~XFS_INOBT_MASK(offset);
|
||||||
rec.ir_freecount--;
|
rec.ir_freecount--;
|
||||||
if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount,
|
if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount,
|
||||||
rec.ir_free)))
|
rec.ir_free)))
|
||||||
|
@ -1105,11 +1105,11 @@ xfs_difree(
|
||||||
*/
|
*/
|
||||||
off = agino - rec.ir_startino;
|
off = agino - rec.ir_startino;
|
||||||
ASSERT(off >= 0 && off < XFS_INODES_PER_CHUNK);
|
ASSERT(off >= 0 && off < XFS_INODES_PER_CHUNK);
|
||||||
ASSERT(!XFS_INOBT_IS_FREE(&rec, off));
|
ASSERT(!(rec.ir_free & XFS_INOBT_MASK(off)));
|
||||||
/*
|
/*
|
||||||
* Mark the inode free & increment the count.
|
* Mark the inode free & increment the count.
|
||||||
*/
|
*/
|
||||||
XFS_INOBT_SET_FREE(&rec, off);
|
rec.ir_free |= XFS_INOBT_MASK(off);
|
||||||
rec.ir_freecount++;
|
rec.ir_freecount++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,14 +32,14 @@ struct xfs_mount;
|
||||||
#define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */
|
#define XFS_IBT_MAGIC 0x49414254 /* 'IABT' */
|
||||||
|
|
||||||
typedef __uint64_t xfs_inofree_t;
|
typedef __uint64_t xfs_inofree_t;
|
||||||
#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t))
|
#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t))
|
||||||
#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
|
#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
|
||||||
#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
|
#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
|
||||||
|
#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
|
||||||
|
|
||||||
static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
|
static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
|
||||||
{
|
{
|
||||||
return (((n) >= XFS_INODES_PER_CHUNK ? \
|
return ((n >= XFS_INODES_PER_CHUNK ? 0 : XFS_INOBT_MASK(n)) - 1) << i;
|
||||||
(xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -68,20 +68,6 @@ typedef struct xfs_inobt_key {
|
||||||
/* btree pointer type */
|
/* btree pointer type */
|
||||||
typedef __be32 xfs_inobt_ptr_t;
|
typedef __be32 xfs_inobt_ptr_t;
|
||||||
|
|
||||||
/*
|
|
||||||
* Bit manipulations for ir_free.
|
|
||||||
*/
|
|
||||||
#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
|
|
||||||
#define XFS_INOBT_IS_FREE(rp,i) \
|
|
||||||
(((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
|
|
||||||
#define XFS_INOBT_SET_FREE(rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i))
|
|
||||||
#define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Maximum number of inode btree levels.
|
|
||||||
*/
|
|
||||||
#define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* block numbers in the AG.
|
* block numbers in the AG.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -273,7 +273,7 @@ typedef struct xfs_mount {
|
||||||
uint m_inobt_mnr[2]; /* min inobt btree records */
|
uint m_inobt_mnr[2]; /* min inobt btree records */
|
||||||
uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
|
uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
|
||||||
uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
|
uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
|
||||||
uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
|
uint m_in_maxlevels; /* max inobt btree levels. */
|
||||||
struct xfs_perag *m_perag; /* per-ag accounting info */
|
struct xfs_perag *m_perag; /* per-ag accounting info */
|
||||||
struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */
|
struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */
|
||||||
struct mutex m_growlock; /* growfs mutex */
|
struct mutex m_growlock; /* growfs mutex */
|
||||||
|
|
|
@ -343,7 +343,7 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
|
||||||
(128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))) + \
|
(128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))) + \
|
||||||
(128 * 5) + \
|
(128 * 5) + \
|
||||||
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
||||||
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
|
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
|
||||||
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
|
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
|
||||||
|
|
||||||
#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate)
|
#define XFS_ITRUNCATE_LOG_RES(mp) ((mp)->m_reservations.tr_itruncate)
|
||||||
|
@ -449,9 +449,9 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
|
||||||
(128 * (4 + XFS_DIROP_LOG_COUNT(mp)))), \
|
(128 * (4 + XFS_DIROP_LOG_COUNT(mp)))), \
|
||||||
(2 * (mp)->m_sb.sb_sectsize + \
|
(2 * (mp)->m_sb.sb_sectsize + \
|
||||||
XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
|
XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
|
||||||
XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
|
XFS_FSB_TO_B((mp), (mp)->m_in_maxlevels) + \
|
||||||
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
||||||
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
|
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
|
||||||
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
|
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
|
||||||
|
|
||||||
#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink)
|
#define XFS_SYMLINK_LOG_RES(mp) ((mp)->m_reservations.tr_symlink)
|
||||||
|
@ -481,9 +481,9 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
|
||||||
(128 * (3 + XFS_DIROP_LOG_COUNT(mp)))), \
|
(128 * (3 + XFS_DIROP_LOG_COUNT(mp)))), \
|
||||||
(3 * (mp)->m_sb.sb_sectsize + \
|
(3 * (mp)->m_sb.sb_sectsize + \
|
||||||
XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
|
XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
|
||||||
XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
|
XFS_FSB_TO_B((mp), (mp)->m_in_maxlevels) + \
|
||||||
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
||||||
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
|
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
|
||||||
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
|
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
|
||||||
|
|
||||||
#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create)
|
#define XFS_CREATE_LOG_RES(mp) ((mp)->m_reservations.tr_create)
|
||||||
|
@ -513,7 +513,7 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_t *dp)
|
||||||
MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp)) + \
|
MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp)) + \
|
||||||
(128 * 5) + \
|
(128 * 5) + \
|
||||||
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
XFS_ALLOCFREE_LOG_RES(mp, 1) + \
|
||||||
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
|
(128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
|
||||||
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
|
XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#define XFS_DIRREMOVE_SPACE_RES(mp) \
|
#define XFS_DIRREMOVE_SPACE_RES(mp) \
|
||||||
XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK)
|
XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK)
|
||||||
#define XFS_IALLOC_SPACE_RES(mp) \
|
#define XFS_IALLOC_SPACE_RES(mp) \
|
||||||
(XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp)-1)
|
(XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels - 1)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Space reservation values for various transactions.
|
* Space reservation values for various transactions.
|
||||||
|
|
Loading…
Reference in a new issue