Skip to contentSkip to conversation

xfs: use xfs_ialloc_blks_per_cluster in xfs_ifree_cluster

PATCH Superseded Jeff Liu 2 participants 3 messages Dec 11, 2013 – Dec 12, 2013 XFS filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jeff Liu

author
#0 lore raw

PATCH 4/5 xfs: use xfs_ialloc_blks_per_cluster in xfs_ifree_cluster

From: Jie Liu <[email protected]>

Use xfs_ialloc_blks_per_cluster() in xfs_ifree_cluster()

---
 fs/xfs/xfs_inode.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
fs/xfs/xfs_inode.c +3 -10
index 001aa89..7e75b8e 100644
@@ -2152,16 +2152,9 @@ xfs_ifree_cluster(
 	struct xfs_perag	*pag;
 
 	pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, inum));
-	if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) {
-		blks_per_cluster = 1;
-		ninodes = mp->m_sb.sb_inopblock;
-		nbufs = XFS_IALLOC_BLOCKS(mp);
-	} else {
-		blks_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) /
-					mp->m_sb.sb_blocksize;
-		ninodes = blks_per_cluster * mp->m_sb.sb_inopblock;
-		nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster;
-	}
+	blks_per_cluster = xfs_ialloc_blks_per_cluster(mp);
+	ninodes = blks_per_cluster << mp->m_sb.sb_inopblog;
+	nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster;
 
 	for (j = 0; j < nbufs; j++, inum += ninodes) {
 		blkno = XFS_AGB_TO_DADDR(mp, XFS_INO_TO_AGNO(mp, inum),
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 4/5
#1 lore raw
Quoted 20 lines · Jeff Liu

From: Jie Liu <[email protected]>

Use xfs_ialloc_blks_per_cluster() in xfs_ifree_cluster()

---
 fs/xfs/xfs_inode.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
fs/xfs/xfs_inode.c +0 -3
index 001aa89..7e75b8e 100644
@@ -2152,16 +2152,9 @@ xfs_ifree_cluster(
 	struct xfs_perag	*pag;
 
 	pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, inum));
-	if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) {
-		blks_per_cluster = 1;
-		ninodes = mp->m_sb.sb_inopblock;

fs/xfs/xfs_inode.c xfs_ifree_cluster( · line 2157

Quoted 10 lines
fs/xfs/xfs_inode.c +3 -7
-		nbufs = XFS_IALLOC_BLOCKS(mp);
-	} else {
-		blks_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) /
-					mp->m_sb.sb_blocksize;
-		ninodes = blks_per_cluster * mp->m_sb.sb_inopblock;
-		nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster;
-	}
+	blks_per_cluster = xfs_ialloc_blks_per_cluster(mp);
+	ninodes = blks_per_cluster << mp->m_sb.sb_inopblog;
+	nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster;

I'd get rid of the XFS_IALLOC_BLOCKS() macros there and just use mp->m_ialloc_blks directly. Otherwise looks good.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#2 lore raw
Quoted 26 lines · Dave Chinner
Quoted 25 lines · Jeff Liu

From: Jie Liu <[email protected]>

Use xfs_ialloc_blks_per_cluster() in xfs_ifree_cluster()

---
 fs/xfs/xfs_inode.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
fs/xfs/xfs_inode.c +0 -8
index 001aa89..7e75b8e 100644
@@ -2152,16 +2152,9 @@ xfs_ifree_cluster(
 	struct xfs_perag	*pag;
 
 	pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, inum));
-	if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) {
-		blks_per_cluster = 1;
-		ninodes = mp->m_sb.sb_inopblock;
-		nbufs = XFS_IALLOC_BLOCKS(mp);
-	} else {
-		blks_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) /
-					mp->m_sb.sb_blocksize;
-		ninodes = blks_per_cluster * mp->m_sb.sb_inopblock;
Quoted 8 lines

fs/xfs/xfs_inode.c xfs_ifree_cluster( · line 2157

Quoted 5 lines
fs/xfs/xfs_inode.c +3 -2
-		nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster;
-	}
+	blks_per_cluster = xfs_ialloc_blks_per_cluster(mp);
+	ninodes = blks_per_cluster << mp->m_sb.sb_inopblog;
+	nbufs = XFS_IALLOC_BLOCKS(mp) / blks_per_cluster;

I'd get rid of the XFS_IALLOC_BLOCKS() macros there and just use mp->m_ialloc_blks directly. Otherwise looks good.

Agree, for the same reason as XFS_INODE_CLUSTER_SIZE() macros, I will kill it. Oh, it looks we can get rid of XFS_IALLOC_INODES() marcos as well...

Thanks,
-Jeff

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs