[PATCH] sanity check inode size vs inode ratio

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

 



A quick patch to sanity check the inode ratio vs the inode size.  In some
cases Lustre users have tried specifying an inode size of 4096 bytes, while
keeping an inode ratio of one inode per 4096 bytes, causing mke2fs to spin
forever trying to allocate the inode tables.  I'm sure more people will do
this now that large inodes are available in ext4 and documented in e2fsprogs.

Signed-off-by: Andreas Dilger <adilger@xxxxxxxxxxxxx>

======================== e2fsprogs-inode_ratio.patch ========================
--- misc/mke2fs.c	2007-05-01 05:52:35.000000000 -0600
+++ misc/mke2fs.c.sav	2007-05-14 16:53:10.000000000 -0600
@@ -1504,6 +1504,18 @@
 		((__u64) fs_param.s_blocks_count * blocksize)
 			/ inode_ratio;
 
+	if ((long long)fs_param.s_inodes_count *
+	    inode_size ?: EXT2_GOOD_OLD_INODE_SIZE >
+	    (long long)fs_param.s_blocks_count * EXT2_BLOCK_SIZE(&fs_param)) {
+		com_err(program_name, 0, _("inode_size %u * inodes_count %u "
+					  "too bit for filesystem size %lu,\n"
+					  "\tspecify higher inode_ratio (-i) "
+					  "or lower inode count (-N)\n"),
+			inode_size ?: EXT2_GOOD_OLD_INODE_SIZE,
+			fs_param.s_inodes_count, fs_param.s_blocks_count);
+		exit(1);
+	}
+
 	/*
 	 * Calculate number of blocks to reserve
 	 */
======================== e2fsprogs-inode_ratio.patch ========================
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux