summaryrefslogtreecommitdiffstats
path: root/sbin/newfs/newfs.h
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2010-02-10 20:17:46 +0000
committermckusick <mckusick@FreeBSD.org>2010-02-10 20:17:46 +0000
commit52ba27d6b0156c296bb50f3105048256313b14fb (patch)
tree993fe43110b6f9a3a2a4eaf0d4d556cbb87c9972 /sbin/newfs/newfs.h
parentd533f2ac8cbe133d3f794fc6d1408cd9304172f4 (diff)
downloadFreeBSD-src-52ba27d6b0156c296bb50f3105048256313b14fb.zip
FreeBSD-src-52ba27d6b0156c296bb50f3105048256313b14fb.tar.gz
Ensure that newfs will never create a filesystem with more than 2^32
inodes by cutting back on the number of inodes per cylinder group if necessary to stay under the limit. For a default (16K block) file system, this limit begins to take effect for file systems above 32Tb. This fix is in addition to -r203763 which corrected a problem in the kernel that treated large inode numbers as negative rather than unsigned. For a default (16K block) file system, this bug began to show up at a file system size above about 16Tb. Reported by: Scott Burns, John Kilburg, Bruce Evans Followup by: Jeff Roberson PR: 133980 MFC after: 2 weeks
Diffstat (limited to 'sbin/newfs/newfs.h')
-rw-r--r--sbin/newfs/newfs.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/sbin/newfs/newfs.h b/sbin/newfs/newfs.h
index 0d7cb62..9da3226 100644
--- a/sbin/newfs/newfs.h
+++ b/sbin/newfs/newfs.h
@@ -41,6 +41,38 @@
#include <libufs.h>
/*
+ * The following two constants set the default block and fragment sizes.
+ * Both constants must be a power of 2 and meet the following constraints:
+ * MINBSIZE <= DESBLKSIZE <= MAXBSIZE
+ * sectorsize <= DESFRAGSIZE <= DESBLKSIZE
+ * DESBLKSIZE / DESFRAGSIZE <= 8
+ */
+#define DFL_FRAGSIZE 2048
+#define DFL_BLKSIZE 16384
+
+/*
+ * Cylinder groups may have up to MAXBLKSPERCG blocks. The actual
+ * number used depends upon how much information can be stored
+ * in a cylinder group map which must fit in a single file system
+ * block. The default is to use as many as possible blocks per group.
+ */
+#define MAXBLKSPERCG 0x7fffffff /* desired fs_fpg ("infinity") */
+
+/*
+ * MAXBLKPG determines the maximum number of data blocks which are
+ * placed in a single cylinder group. The default is one indirect
+ * block worth of data blocks.
+ */
+#define MAXBLKPG(bsize) ((bsize) / sizeof(ufs2_daddr_t))
+
+/*
+ * Each file system has a number of inodes statically allocated.
+ * We allocate one inode slot per NFPI fragments, expecting this
+ * to be far more than we will ever need.
+ */
+#define NFPI 4
+
+/*
* variables set up by front end.
*/
extern int Eflag; /* Erase previous disk contents */
OpenPOWER on IntegriCloud