Meta: Tweak default disk size calculation to not be as gratuitous

Instead of first doubling the required size for the determined inode
count and then _also_ tripling the sum of that and the determined disk
size, let's be a bit more reasonable and just double the sum of inode
count * size and disk size.

This results in a 1.4GB _disk_image, instead of the 2GB from before
(for < 800MB worth of files).
This commit is contained in:
Linus Groh 2022-05-07 18:03:00 +02:00
parent 3d5645f07d
commit b9f1c44dbb
Notes: sideshowbarker 2024-07-19 01:59:31 +09:00

View file

@ -71,7 +71,9 @@ inode_usage() {
INODE_SIZE=128
INODE_COUNT=$(($(inode_usage "$SERENITY_SOURCE_DIR/Base") + $(inode_usage Root)))
DISK_SIZE_BYTES=$((($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root) + INODE_COUNT) * 1024))
INODE_COUNT=$((INODE_COUNT + 2000)) # Some additional inodes for toolchain files, could probably also be calculated
DISK_SIZE_BYTES=$((($(disk_usage "$SERENITY_SOURCE_DIR/Base") + $(disk_usage Root)) * 1024))
DISK_SIZE_BYTES=$((DISK_SIZE_BYTES + (INODE_COUNT * INODE_SIZE)))
if [ -z "$SERENITY_DISK_SIZE_BYTES" ]; then
# Try to use heuristics to guess a good disk size and inode count.
@ -80,7 +82,7 @@ if [ -z "$SERENITY_DISK_SIZE_BYTES" ]; then
# * Indirect/doubly indirect/triply indirect blocks,
# * Inodes and block bitmaps for each block group,
# * Plenty of extra free space and free inodes.
DISK_SIZE_BYTES=$(((DISK_SIZE_BYTES + (INODE_COUNT * INODE_SIZE * 2)) * 3))
DISK_SIZE_BYTES=$((DISK_SIZE_BYTES * 2))
INODE_COUNT=$((INODE_COUNT * 7))
else
if [ "$DISK_SIZE_BYTES" -gt "$SERENITY_DISK_SIZE_BYTES" ]; then