public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] xfs: support larger inode clusters on v5 filesystems
@ 2013-09-09  8:34 Dave Chinner
  0 siblings, 0 replies; only message in thread
From: Dave Chinner @ 2013-09-09  8:34 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

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.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 include/libxfs.h | 2 +-
 mkfs/xfs_mkfs.c  | 6 +++++-
 repair/sb.c      | 7 ++++---
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/libxfs.h b/include/libxfs.h
index 90f9a75..a074e58 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h
@@ -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 */
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 66d8833..36e6215 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -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;
diff --git a/repair/sb.c b/repair/sb.c
index e2f5933..a2231e4 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -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;
 }
 
 /*
-- 
1.8.3.2

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-09  8:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-09  8:34 [PATCH] [RFC] xfs: support larger inode clusters on v5 filesystems Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox