[PATCH 10/12] xfs_db: use precomputed inode geometry values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Use the precomputed inode geometry values instead of open-coding them.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 db/inode.c      |    8 +++-----
 repair/dinode.c |    2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)


diff --git a/db/inode.c b/db/inode.c
index 73dd118d..d8d69ffb 100644
--- a/db/inode.c
+++ b/db/inode.c
@@ -657,16 +657,14 @@ set_cur_inode(
 	    igeo->inoalign_mask) {
 		xfs_agblock_t	chunk_agbno;
 		xfs_agblock_t	offset_agbno;
-		int		blks_per_cluster;
 
-		blks_per_cluster = igeo->inode_cluster_size >>
-							mp->m_sb.sb_blocklog;
 		offset_agbno = agbno & igeo->inoalign_mask;
 		chunk_agbno = agbno - offset_agbno;
 		cluster_agbno = chunk_agbno +
-			((offset_agbno / blks_per_cluster) * blks_per_cluster);
+			((offset_agbno / M_IGEO(mp)->blocks_per_cluster) *
+			 M_IGEO(mp)->blocks_per_cluster);
 		offset += ((agbno - cluster_agbno) * mp->m_sb.sb_inopblock);
-		numblks = XFS_FSB_TO_BB(mp, blks_per_cluster);
+		numblks = XFS_FSB_TO_BB(mp, M_IGEO(mp)->blocks_per_cluster);
 	} else
 		cluster_agbno = agbno;
 
diff --git a/repair/dinode.c b/repair/dinode.c
index 56992dd2..f5e88cc3 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -768,7 +768,7 @@ get_agino_buf(
 	 * we must find the buffer for its cluster, add the appropriate
 	 * offset, and return that.
 	 */
-	cluster_size = max(igeo->inode_cluster_size, mp->m_sb.sb_blocksize);
+	cluster_size = igeo->inode_cluster_size;
 	ino_per_cluster = cluster_size / mp->m_sb.sb_inodesize;
 	cluster_agino = agino & ~(ino_per_cluster - 1);
 	cluster_blks = XFS_FSB_TO_DADDR(mp, max(1,




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux