xfs: introduce xfs_ialloc_blks_per_cluster
PATCH 1/5 xfs: introduce xfs_ialloc_blks_per_cluster
From: Jie Liu <[email protected]>
Introduce a common routine xfs_ialloc_blks_per_cluster() to calculate and return the number of blocks per inode cluster.
--- fs/xfs/xfs_ialloc.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/xfs/xfs_ialloc.h +10 -0
@@ -37,6 +37,16 @@ struct xfs_btree_cur;#define XFS_INODE_BIG_CLUSTER_SIZE 8192#define XFS_INODE_CLUSTER_SIZE (mp) (mp)->m_inode_cluster_size +/* Calculate and return the number of blocks per inode cluster */ +static inline int +xfs_ialloc_blks_per_cluster ( +struct xfs_mount *mp) +{ +if (mp->m_sb.sb_blocksize >=XFS_INODE_CLUSTER_SIZE (mp)) +return 1 ; +return XFS_INODE_CLUSTER_SIZE (mp) >> mp->m_sb.sb_blocklog; +} +/* * Make an inode pointer out of the buffer/offset. */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 17 lines · Jeff Liu
From: Jie Liu <[email protected]>
Introduce a common routine
xfs_ialloc_blks_per_cluster()to calculate and return the number of blocks per inode cluster.Signed-off-by Jie Liu <[email protected]>--- fs/xfs/xfs_ialloc.h | 10 ++++++++++ 1 file changed, 10 insertions(+)fs/xfs/xfs_ialloc.h +0
-0@@ -37,6 +37,16 @@ struct xfs_btree_cur;#define XFS_INODE_BIG_CLUSTER_SIZE 8192#define XFS_INODE_CLUSTER_SIZE (mp) (mp)->m_inode_cluster_size
fs/xfs/xfs_ialloc.h struct xfs_btree_cur; · line 48
Quoted 10 lines
fs/xfs/xfs_ialloc.h +9
-0+/* Calculate and return the number of blocks per inode cluster */ +static inline int +xfs_ialloc_blks_per_cluster ( +struct xfs_mount *mp) +{ +if (mp->m_sb.sb_blocksize >=XFS_INODE_CLUSTER_SIZE (mp)) +return 1 ; +return XFS_INODE_CLUSTER_SIZE (mp) >> mp->m_sb.sb_blocklog; +}
I'd avoid using the XFS_INODE_CLUSTER_SIZE() macro - it's just a useless wrapper around mp->m_inode_cluster_size. Hence if you are cleaning this code up, the first thing I'd do is remove the macro.
/* Calculate and return the number of blocks per inode cluster */ static inline int
xfs_ialloc_blks_per_cluster(
struct xfs_mount *mp)
{
if (mp->m_sb.sb_blocksize >= mp->m_inode_cluster_size)
return 1;
return mp->m_inode_cluster_size >> mp->m_sb.sb_blocklog;
}Is much less shouty, and just as easy to read ;)
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 37 lines · Dave Chinner
Quoted 17 lines · Jeff Liu
From: Jie Liu <[email protected]>
Introduce a common routine
xfs_ialloc_blks_per_cluster()to calculate and return the number of blocks per inode cluster.Signed-off-by Jie Liu <[email protected]>--- fs/xfs/xfs_ialloc.h | 10 ++++++++++ 1 file changed, 10 insertions(+)fs/xfs/xfs_ialloc.h +0
-0@@ -37,6 +37,16 @@ struct xfs_btree_cur;#define XFS_INODE_BIG_CLUSTER_SIZE 8192#define XFS_INODE_CLUSTER_SIZE (mp) (mp)->m_inode_cluster_sizefs/xfs/xfs_ialloc.h struct xfs_btree_cur; · line 48
Quoted 10 lines
fs/xfs/xfs_ialloc.h +9
-0+/* Calculate and return the number of blocks per inode cluster */ +static inline int +xfs_ialloc_blks_per_cluster ( +struct xfs_mount *mp) +{ +if (mp->m_sb.sb_blocksize >=XFS_INODE_CLUSTER_SIZE (mp)) +return 1 ; +return XFS_INODE_CLUSTER_SIZE (mp) >> mp->m_sb.sb_blocklog; +}I'd avoid using the
XFS_INODE_CLUSTER_SIZE()macro - it's just a useless wrapper aroundmp->m_inode_cluster_size. Hence if you are cleaning this code up, the first thing I'd do is remove the macro./* Calculate and return the number of blocks per inode cluster */ static inline int
xfs_ialloc_blks_per_cluster(
structxfs_mount*mp)
Quoted 7 lines
{ if (mp->m_sb.sb_blocksize >= mp->m_inode_cluster_size) return 1; return mp->m_inode_cluster_size >> mp->m_sb.sb_blocklog; }Is much less shouty, and just as easy to read ;)
Yup, yup! I also considered to just remove this macros as mp->m_inode_cluster_size is quite understood and actually, we avoid this macros in xfs_inobp_check(). :) But that means I need to remove it from xlog_recover_buffer_pass2() and fix it's comments in this patch as well.
Thanks,
-Jeff
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs