[PATCH 17/28] repair: use ir_count for filesystems with sparse inode support

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

 



Repair currently assumes each inobt record covers 64 inodes and uses
this value to validate inode counts in the AGI headers and superblock.
This is not always the case with sparse inode support.

Update scan_inobt() to check for sparse inode support and use the new
ir_count field for inode accounting. ir_count contains the total number
of inodes tracked by the record.

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
---
 repair/scan.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/repair/scan.c b/repair/scan.c
index 9daa488..8677e41 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -1227,7 +1227,16 @@ _("inode btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
 
 			if (magic == XFS_IBT_MAGIC ||
 			    magic == XFS_IBT_CRC_MAGIC) {
-				agcnts->agicount += XFS_INODES_PER_CHUNK;
+				int icount = XFS_INODES_PER_CHUNK;
+
+				/*
+				 * ir_count holds the inode count for all
+				 * records on fs' with sparse inode support
+				 */
+				if (xfs_sb_version_hassparseinodes(&mp->m_sb))
+					icount = rp[i].ir_u.sp.ir_count;
+
+				agcnts->agicount += icount;
 				agcnts->agifreecount += freecount;
 				agcnts->ifreecount += freecount;
 
-- 
1.9.3

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux