Skip to contentSkip to conversation

xfs: support larger inode clusters on v5 filesystems

RFC PATCH New Dave Chinner 1 participant 1 message Sep 9, 2013

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 xfs: support larger inode clusters on v5 filesystems

From: Dave Chinner <[email protected]>

To allow the kernel to use larger inode clusters than the standard 8192 bytes, we need to set the inode alignment fields appropriately so that the kernel is consistent in it's inode to buffer mappings. We set the alignment to allow a constant 32 inodes per cluster, instead of a fixed 8k cluster size.

---
 include/libxfs.h | 2 +-
 mkfs/xfs_mkfs.c  | 6 +++++-
 repair/sb.c      | 7 ++++---
 3 files changed, 10 insertions(+), 5 deletions(-)
include/libxfs.h +1 -1
index 90f9a75..a074e58 100644
@@ -180,7 +180,7 @@ typedef struct xfs_mount {
 	__uint8_t		m_sectbb_log;	/* sectorlog - BBSHIFT */
 	__uint8_t		m_agno_log;	/* log #ag's */
 	__uint8_t		m_agino_log;	/* #bits for agino in inum */
-	__uint16_t		m_inode_cluster_size;/* min inode buf size */
+	uint			m_inode_cluster_size;/* min inode buf size */
 	uint			m_blockmask;	/* sb_blocksize-1 */
 	uint			m_blockwsize;	/* sb_blocksize in words */
 	uint			m_blockwmask;	/* blockwsize-1 */
mkfs/xfs_mkfs.c +5 -1
index 66d8833..36e6215 100644
@@ -2545,7 +2545,11 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
 	} else
 		sbp->sb_logsunit = 0;
 	if (iaflag) {
-		sbp->sb_inoalignmt = XFS_INODE_BIG_CLUSTER_SIZE >> blocklog;
+		int	cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
+		if (crcs_enabled)
+			cluster_size *= isize / XFS_DINODE_MIN_SIZE;
+		sbp->sb_inoalignmt = cluster_size >> blocklog;
+		printf("inoalignmt = %d (%d)\n", sbp->sb_inoalignmt, cluster_size);
 		iaflag = sbp->sb_inoalignmt != 0;
 	} else
 		sbp->sb_inoalignmt = 0;
repair/sb.c +4 -3
index e2f5933..a2231e4 100644
@@ -175,11 +175,12 @@ find_secondary_sb(xfs_sb_t *rsb)
 static int
 calc_ino_align(xfs_sb_t *sb)
 {
-	xfs_extlen_t align;
+	xfs_extlen_t align = XFS_INODE_BIG_CLUSTER_SIZE;
 
-	align = XFS_INODE_BIG_CLUSTER_SIZE >> sb->sb_blocklog;
+	if (xfs_sb_version_hascrc(sb))
+		align *= sb->sb_inodesize / XFS_DINODE_MIN_SIZE;
 
-	return(align);
+	return align >> sb->sb_blocklog;
 }
 
 /*
Signature · 6 lines
1.8.3.2

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