提交 0f49efd8 编写于 作者: J Jie Liu 提交者: Dave Chinner

xfs: get rid of XFS_INODE_CLUSTER_SIZE macros

Get rid of XFS_INODE_CLUSTER_SIZE() macros, use mp->m_inode_cluster_size
directly.
Signed-off-by: NJie Liu <jeff.liu@oracle.com>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 71783438
...@@ -52,7 +52,7 @@ xfs_ialloc_cluster_alignment( ...@@ -52,7 +52,7 @@ xfs_ialloc_cluster_alignment(
{ {
if (xfs_sb_version_hasalign(&args->mp->m_sb) && if (xfs_sb_version_hasalign(&args->mp->m_sb) &&
args->mp->m_sb.sb_inoalignmt >= args->mp->m_sb.sb_inoalignmt >=
XFS_B_TO_FSBT(args->mp, XFS_INODE_CLUSTER_SIZE(args->mp))) XFS_B_TO_FSBT(args->mp, args->mp->m_inode_cluster_size))
return args->mp->m_sb.sb_inoalignmt; return args->mp->m_sb.sb_inoalignmt;
return 1; return 1;
} }
...@@ -181,12 +181,12 @@ xfs_ialloc_inode_init( ...@@ -181,12 +181,12 @@ xfs_ialloc_inode_init(
* For small block sizes, manipulate the inodes in buffers * For small block sizes, manipulate the inodes in buffers
* which are multiples of the blocks size. * which are multiples of the blocks size.
*/ */
if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) { if (mp->m_sb.sb_blocksize >= mp->m_inode_cluster_size) {
blks_per_cluster = 1; blks_per_cluster = 1;
nbufs = length; nbufs = length;
ninodes = mp->m_sb.sb_inopblock; ninodes = mp->m_sb.sb_inopblock;
} else { } else {
blks_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) / blks_per_cluster = mp->m_inode_cluster_size /
mp->m_sb.sb_blocksize; mp->m_sb.sb_blocksize;
nbufs = length / blks_per_cluster; nbufs = length / blks_per_cluster;
ninodes = blks_per_cluster * mp->m_sb.sb_inopblock; ninodes = blks_per_cluster * mp->m_sb.sb_inopblock;
...@@ -1384,7 +1384,7 @@ xfs_imap( ...@@ -1384,7 +1384,7 @@ xfs_imap(
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
blks_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_blocklog; blks_per_cluster = mp->m_inode_cluster_size >> mp->m_sb.sb_blocklog;
/* /*
* For bulkstat and handle lookups, we have an untrusted inode number * For bulkstat and handle lookups, we have an untrusted inode number
...@@ -1405,7 +1405,7 @@ xfs_imap( ...@@ -1405,7 +1405,7 @@ xfs_imap(
* If the inode cluster size is the same as the blocksize or * If the inode cluster size is the same as the blocksize or
* smaller we get to the buffer by simple arithmetics. * smaller we get to the buffer by simple arithmetics.
*/ */
if (XFS_INODE_CLUSTER_SIZE(mp) <= mp->m_sb.sb_blocksize) { if (mp->m_inode_cluster_size <= mp->m_sb.sb_blocksize) {
offset = XFS_INO_TO_OFFSET(mp, ino); offset = XFS_INO_TO_OFFSET(mp, ino);
ASSERT(offset < mp->m_sb.sb_inopblock); ASSERT(offset < mp->m_sb.sb_inopblock);
......
...@@ -30,11 +30,8 @@ struct xfs_btree_cur; ...@@ -30,11 +30,8 @@ struct xfs_btree_cur;
*/ */
#define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks #define XFS_IALLOC_BLOCKS(mp) (mp)->m_ialloc_blks
/* /* Move inodes in clusters of this size */
* Move inodes in clusters of this size.
*/
#define XFS_INODE_BIG_CLUSTER_SIZE 8192 #define XFS_INODE_BIG_CLUSTER_SIZE 8192
#define XFS_INODE_CLUSTER_SIZE(mp) (mp)->m_inode_cluster_size
/* /*
* Make an inode pointer out of the buffer/offset. * Make an inode pointer out of the buffer/offset.
......
...@@ -2152,13 +2152,13 @@ xfs_ifree_cluster( ...@@ -2152,13 +2152,13 @@ xfs_ifree_cluster(
struct xfs_perag *pag; struct xfs_perag *pag;
pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, inum)); pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, inum));
if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) { if (mp->m_sb.sb_blocksize >= mp->m_inode_cluster_size) {
blks_per_cluster = 1; blks_per_cluster = 1;
ninodes = mp->m_sb.sb_inopblock; ninodes = mp->m_sb.sb_inopblock;
nbufs = XFS_IALLOC_BLOCKS(mp); nbufs = XFS_IALLOC_BLOCKS(mp);
} else { } else {
blks_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) / blks_per_cluster = mp->m_inode_cluster_size /
mp->m_sb.sb_blocksize; mp->m_sb.sb_blocksize;
ninodes = blks_per_cluster * mp->m_sb.sb_inopblock; ninodes = blks_per_cluster * mp->m_sb.sb_inopblock;
nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster; nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster;
} }
...@@ -2906,13 +2906,13 @@ xfs_iflush_cluster( ...@@ -2906,13 +2906,13 @@ xfs_iflush_cluster(
pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
inodes_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog; inodes_per_cluster = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog;
ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *); ilist_size = inodes_per_cluster * sizeof(xfs_inode_t *);
ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS); ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS);
if (!ilist) if (!ilist)
goto out_put; goto out_put;
mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1); mask = ~(((mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog)) - 1);
first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask; first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask;
rcu_read_lock(); rcu_read_lock();
/* really need a gang lookup range call here */ /* really need a gang lookup range call here */
......
...@@ -243,9 +243,9 @@ xfs_bulkstat( ...@@ -243,9 +243,9 @@ xfs_bulkstat(
*done = 0; *done = 0;
fmterror = 0; fmterror = 0;
ubufp = ubuffer; ubufp = ubuffer;
nicluster = mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp) ? nicluster = mp->m_sb.sb_blocksize >= mp->m_inode_cluster_size ?
mp->m_sb.sb_inopblock : mp->m_sb.sb_inopblock :
(XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog); (mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog);
nimask = ~(nicluster - 1); nimask = ~(nicluster - 1);
nbcluster = nicluster >> mp->m_sb.sb_inopblog; nbcluster = nicluster >> mp->m_sb.sb_inopblog;
irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4); irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
......
...@@ -2523,19 +2523,19 @@ xlog_recover_buffer_pass2( ...@@ -2523,19 +2523,19 @@ xlog_recover_buffer_pass2(
* *
* Also make sure that only inode buffers with good sizes stay in * Also make sure that only inode buffers with good sizes stay in
* the buffer cache. The kernel moves inodes in buffers of 1 block * the buffer cache. The kernel moves inodes in buffers of 1 block
* or XFS_INODE_CLUSTER_SIZE bytes, whichever is bigger. The inode * or mp->m_inode_cluster_size bytes, whichever is bigger. The inode
* buffers in the log can be a different size if the log was generated * buffers in the log can be a different size if the log was generated
* by an older kernel using unclustered inode buffers or a newer kernel * by an older kernel using unclustered inode buffers or a newer kernel
* running with a different inode cluster size. Regardless, if the * running with a different inode cluster size. Regardless, if the
* the inode buffer size isn't MAX(blocksize, XFS_INODE_CLUSTER_SIZE) * the inode buffer size isn't MAX(blocksize, mp->m_inode_cluster_size)
* for *our* value of XFS_INODE_CLUSTER_SIZE, then we need to keep * for *our* value of mp->m_inode_cluster_size, then we need to keep
* the buffer out of the buffer cache so that the buffer won't * the buffer out of the buffer cache so that the buffer won't
* overlap with future reads of those inodes. * overlap with future reads of those inodes.
*/ */
if (XFS_DINODE_MAGIC == if (XFS_DINODE_MAGIC ==
be16_to_cpu(*((__be16 *)xfs_buf_offset(bp, 0))) && be16_to_cpu(*((__be16 *)xfs_buf_offset(bp, 0))) &&
(BBTOB(bp->b_io_length) != MAX(log->l_mp->m_sb.sb_blocksize, (BBTOB(bp->b_io_length) != MAX(log->l_mp->m_sb.sb_blocksize,
(__uint32_t)XFS_INODE_CLUSTER_SIZE(log->l_mp)))) { (__uint32_t)log->l_mp->m_inode_cluster_size))) {
xfs_buf_stale(bp); xfs_buf_stale(bp);
error = xfs_bwrite(bp); error = xfs_bwrite(bp);
} else { } else {
......
...@@ -385,7 +385,7 @@ xfs_calc_ifree_reservation( ...@@ -385,7 +385,7 @@ xfs_calc_ifree_reservation(
xfs_calc_inode_res(mp, 1) + xfs_calc_inode_res(mp, 1) +
xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) + xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, 1)) + xfs_calc_buf_res(1, XFS_FSB_TO_B(mp, 1)) +
max_t(uint, XFS_FSB_TO_B(mp, 1), XFS_INODE_CLUSTER_SIZE(mp)) + max_t(uint, XFS_FSB_TO_B(mp, 1), mp->m_inode_cluster_size) +
xfs_calc_buf_res(1, 0) + xfs_calc_buf_res(1, 0) +
xfs_calc_buf_res(2 + XFS_IALLOC_BLOCKS(mp) + xfs_calc_buf_res(2 + XFS_IALLOC_BLOCKS(mp) +
mp->m_in_maxlevels, 0) + mp->m_in_maxlevels, 0) +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册