summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJin Qian <jinqian@google.com>2017-04-04 21:54:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-04-04 21:54:28 +0000
commit1cf3416564814839b12aa354495b85fc631b3bf5 (patch)
tree54e9534cd33557edb8a45012d7bb125ea8050aa4
parentf92a38e36b87f89f1d51f49c7c2020be0a0f753e (diff)
parent4761c45f02b2998182d7e7145846fc1c95cb2f90 (diff)
downloadextras-1cf3416564814839b12aa354495b85fc631b3bf5.tar.gz
Merge "ext4_utils: add default mke2fs.conf" into oc-dev
-rw-r--r--ext4_utils/mke2fs.conf180
-rwxr-xr-xext4_utils/mkuserimg_mke2fs.sh5
2 files changed, 181 insertions, 4 deletions
diff --git a/ext4_utils/mke2fs.conf b/ext4_utils/mke2fs.conf
new file mode 100644
index 00000000..3d18c00e
--- /dev/null
+++ b/ext4_utils/mke2fs.conf
@@ -0,0 +1,180 @@
+# mkfs defaults.
+#
+# In conjunction with these defaults mkfs needs to be issued with the
+# following arguments:
+#
+# mkfs -m 1 -i 20480 -t <fs> <device>
+#
+# -m reserved-blocks-percentage
+#
+# Specify the percentage of the filesystem blocks reserved for the
+# super-user. This avoids fragmentation, and allows root-owned daemons,
+# such as syslogd(8), to continue to function correctly after non-privileged
+# processes are prevented from writing to the filesystem. The default
+# percentage is 5%.
+#
+# Conclusion: Set to 1%
+#
+#
+# -i bytes-per-inode
+# Specify the bytes/inode ratio. mke2fs creates an inode for every
+# bytes-per-inode bytes of space on the disk. The larger the bytes-per-inode
+# ratio, the fewer inodes will be created. This value generally shouldn't
+# be smaller than the blocksize of the filesystem, since in that case
+# more inodes would be made than can ever be used. Be warned that it
+# is not possible to expand the number of inodes on a filesystem after it
+# is created, so be careful deciding the correct value for this parameter.
+#
+# Conclusion: Set to 20480
+
+
+#
+# mke2fs.conf defaults
+#
+
+[defaults]
+ blocksize = 4096
+
+ # All inodes in production are 128 bytes. This conserves memory and
+ # maintains compatibility between ext2 and ext4
+ inode_size = 128
+ # Default inode_ratio (-i) in production is 20480
+ inode_ratio = 20480
+ # Default reserved_ratio (-m) in production is 1%
+ reserved_ratio = 1.0
+ lazy_itable_init = false
+
+[fs_types]
+ # Features for ext2 & ext4
+ #
+ # ext_attrs - Extended Attributes. This is the ability to associate
+ # metadata not interpreted by the file system with
+ # a file. This is not stored in the inode when the
+ # inodes are 128 bytes. So we would have to store them in
+ # another allocated block.
+ #
+ # Conclusion: DISABLE We don't need these attributes
+ # today and they will only create a performance hit.
+ # So we disable them. Note: If we ever do enable this
+ # feature make sure the kernel config is enabled also.
+ #
+ # resize_inode - Reserve space so the block group descriptor
+ # table may grow in the future. Useful for
+ # online resizing using resize2fs. By default
+ # mke2fs will attempt to reserve enough space so
+ # that the filesystem may grow to 1024 times its
+ # initial size. This can be changed using the
+ # resize extended option.
+ # Conclusion: DISABLE This is a waste of space
+ # for production.
+ #
+ # dir_index - Enabling the HTree (invented by Dan Phillips) to make
+ # directory lookups faster.
+ #
+ # Conclusion: EXT2 DISABLED (no testing yet)
+ # EXT4 ENABLED (by default)
+ #
+ # large_file/huge_file - Larger than 2TB support
+ # Conclusion: EXT2 DISABLED No need in prod for files this big.
+ # Conclusion: EXT4 ENABLED Since we get this for free
+ #
+ # filetype - FileType. Records the type of file (Regular, directory,
+ # character, block, fifo, socket, link) in the directory
+ # structure.
+ # Conclusion: EXT2 ENABLED, EXT4 PENDING
+ #
+ # sparse_super - Reduces the number of redundant super blocks.
+ # Conclusion: ENABLE
+
+ ext2 = {
+ features = ext_attr,^resize_inode,^dir_index,^large_file,filetype,sparse_super
+ hash_alg = tea
+ }
+
+ # Features for ext4 only
+ # has_journal - Enable the ext4 journal. Since we don't have enough
+ # testing and are not sure if we need it yet. We are
+ # not enabling the journal.
+ # Conclusion: EXT4 DISABLED
+ #
+ # extents - Using extents instead of indirect blocks to manage metadata.
+ # Conclusion: EXT4 ENABLED This is a big performance win.
+ #
+ # flex_bg - This feature relaxes check restrictions on where each
+ # block groups meta data is located within the storage
+ # media. This allows for the allocation of bitmaps or
+ # inode tables outside the block group boundaries in cases
+ # where bad blocks forces us to look for new blocks which
+ # the owning block group can not satisfy. This will also
+ # allow for new meta-data allocation schemes to improve
+ # performance and scalability.
+ # Conclusion: ENABLE It allows us to make performance
+ # gaining modifications for ext4.
+ #
+ # uninit_bg - Unitialized Block Groups. In pass1 of e2fsck, every
+ # inode table in the filesystem is scanned and checked,
+ # regardless of whether it is in use. This is this the
+ # most time consuming part of the filesystem check.
+ # The uninitialized block group feature can greatly reduce
+ # e2fsck time by eliminating checking of uninitialized inodes.
+ #
+ # With this feature, there is a a high water mark of
+ # used inodes for each block group. Block and inode bitmaps
+ # can be uninitialized on disk via a flag in the group
+ # descriptor to avoid reading or scanning them at e2fsck time.
+ # A checksum of each group descriptor is used to ensure that
+ # corruption in the group descriptor's bit flags does not
+ # cause incorrect operation.
+ #
+ # Conclusion: ENABLE While the speed up is dependent on
+ # fs age it may be variable but we should not drop the fsck
+ # perf on the floor.
+ #
+ # dir_nlink - Allows for more than 64000 files in a directory.
+ # Conclusion: ENABLED This is on by default for ext4.
+ # This is useful too.
+
+ ext4 = {
+ features = ext_attr,^resize_inode,^has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,sparse_super
+ hash_alg = half_md4
+ }
+ hugefiles = {
+ features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
+ hash_alg = half_md4
+ reserved_ratio = 0.0
+ num_backup_sb = 0
+ packed_meta_blocks = 1
+ make_hugefiles = 1
+ inode_ratio = 4194304
+ hugefiles_dir = /storage_d/pre-block
+ hugefiles_name = data-
+ hugefiles_digits = 5
+ hugefiles_size = 1028M
+ hugefiles_slack = 2G
+ num_hugefiles = 0
+ zero_hugefiles = false
+ flex_bg_size = 262144
+ }
+ hugefile = {
+ features = extent,huge_file,bigalloc,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
+ cluster_size = 32768
+ hash_alg = half_md4
+ reserved_ratio = 0.0
+ num_backup_sb = 0
+ packed_meta_blocks = 1
+ make_hugefiles = 1
+ inode_ratio = 4194304
+ hugefiles_dir = /storage_d
+ hugefiles_name = huge-data
+ hugefiles_digits = 0
+ hugefiles_size = 0
+ hugefiles_align = 256M
+ hugefiles_align_disk = true
+ num_hugefiles = 1
+ zero_hugefiles = false
+ }
+ small = {
+ blocksize = 1024
+ inode_size = 128
+ inode_ratio = 4096
+ }
diff --git a/ext4_utils/mkuserimg_mke2fs.sh b/ext4_utils/mkuserimg_mke2fs.sh
index 7d5d2e35..64b1fe3f 100755
--- a/ext4_utils/mkuserimg_mke2fs.sh
+++ b/ext4_utils/mkuserimg_mke2fs.sh
@@ -42,9 +42,6 @@ MOUNT_POINT=$4
SIZE=$5
shift; shift; shift; shift; shift
-# selinux requires ext_attr.
-MKE2FS_OPTS+="-O ext_attr "
-
if [ "$1" = "-j" ]; then
if [ "$2" = "0" ]; then
MKE2FS_OPTS+="-O ^has_journal"
@@ -146,7 +143,7 @@ cat /dev/null >$OUTPUT_FILE
MAKE_EXT4FS_CMD="mke2fs $MKE2FS_OPTS -t $EXT_VARIANT -b $BLOCKSIZE $OUTPUT_FILE $SIZE"
echo $MAKE_EXT4FS_CMD
-$MAKE_EXT4FS_CMD
+MKE2FS_CONFIG=./system/extras/ext4_utils/mke2fs.conf $MAKE_EXT4FS_CMD
if [ $? -ne 0 ]; then
exit 4
fi