[PATCH 26/28] repair: handle sparse inode alignment

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

 



Sparse inode support requires inode alignment to match inode chunk size.
xfs_repair currently expects inode alignment to match the default
cluster size or a scaled factor thereof.

Update sb_validate_ino_align() to consider the superblock valid if
sparse inode support is enabled and alignment matches the chunk size.

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
---
 repair/sb.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/repair/sb.c b/repair/sb.c
index 03be5e8..a291b3e 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -170,12 +170,13 @@ find_secondary_sb(xfs_sb_t *rsb)
 }
 
 /*
- * Calculate what inode alignment field ought to be
- * based on internal superblock info and determine if it is valid.
+ * Calculate what the inode alignment field ought to be based on internal
+ * superblock info and determine if it is valid.
  *
- * For v5 superblocks, the inode alignment will either match that of the
- * standard XFS_INODE_BIG_CLUSTER_SIZE, or it will be scaled based on the inode
- * size. Either value is valid in this case.
+ * For standard v5 superblocks, the inode alignment must either match
+ * XFS_INODE_BIG_CLUSTER_SIZE or a multiple based on the inode size. For v5
+ * superblocks with sparse inode chunks enabled, inode alignment must match the
+ * inode chunk size.
  *
  * Return true if the alignment is valid, false otherwise.
  */
@@ -201,6 +202,20 @@ sb_validate_ino_align(struct xfs_sb *sb)
 	if (align == sb->sb_inoalignmt)
 		return true;
 
+	/*
+	 * Sparse inodes requires inoalignmt to match full inode chunk size and
+	 * spino_align to match the scaled alignment (as calculated above).
+	 */
+	if (xfs_sb_version_hassparseinodes(sb)) {
+		if (align != sb->sb_spino_align)
+			return false;
+
+		align = (sb->sb_inodesize * XFS_INODES_PER_CHUNK)
+			>> sb->sb_blocklog;
+		if (align == sb->sb_inoalignmt)
+			return true;
+	}
+
 	return false;
 }
 
-- 
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