xfs
[Top] [All Lists]

[PATCH] [RFC] xfs: support larger inode clusters on v5 filesystems

To: xfs@xxxxxxxxxxx
Subject: [PATCH] [RFC] xfs: support larger inode clusters on v5 filesystems
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 9 Sep 2013 18:34:57 +1000
Delivered-to: xfs@xxxxxxxxxxx
From: Dave Chinner <dchinner@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] [RFC] xfs: support larger inode clusters on v5 filesystems, Dave Chinner <=