Merge "Allow specification of filesystem journal size"

This commit is contained in:
Zuul 2019-05-07 10:14:00 +00:00 committed by Gerrit Code Review
commit 8bf37a064e
3 changed files with 21 additions and 2 deletions

View File

@ -70,6 +70,7 @@ function show_options () {
echo " Making this value unnecessarily large will consume extra disk space " echo " Making this value unnecessarily large will consume extra disk space "
echo " on the root partition with extra file system inodes." echo " on the root partition with extra file system inodes."
echo " --min-tmpfs size -- minimum size in GB needed in tmpfs to build the image" echo " --min-tmpfs size -- minimum size in GB needed in tmpfs to build the image"
echo " --mkfs-journal-size -- filesystem journal size in MB to pass to mkfs."
echo " --mkfs-options -- option flags to be passed directly to mkfs." echo " --mkfs-options -- option flags to be passed directly to mkfs."
echo " Options should be passed as a single string value." echo " Options should be passed as a single string value."
echo " --no-tmpfs -- do not use tmpfs to speed image build" echo " --no-tmpfs -- do not use tmpfs to speed image build"
@ -149,6 +150,7 @@ while true ; do
--image-size) export DIB_IMAGE_SIZE=$2; shift 2;; --image-size) export DIB_IMAGE_SIZE=$2; shift 2;;
--image-cache) export DIB_IMAGE_CACHE=$2; shift 2;; --image-cache) export DIB_IMAGE_CACHE=$2; shift 2;;
--max-online-resize) export MAX_ONLINE_RESIZE=$2; shift 2;; --max-online-resize) export MAX_ONLINE_RESIZE=$2; shift 2;;
--mkfs-journal-size) export DIB_JOURNAL_SIZE=$2; shift 2;;
--mkfs-options) MKFS_OPTS=$2; shift 2;; --mkfs-options) MKFS_OPTS=$2; shift 2;;
--min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;; --min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;;
--no-tmpfs) shift; export DIB_NO_TMPFS=1;; --no-tmpfs) shift; export DIB_NO_TMPFS=1;;
@ -417,15 +419,21 @@ fi
rm -f ${du_output} rm -f ${du_output}
if [ -n "$DIB_JOURNAL_SIZE" ]; then
journal_size="$DIB_JOURNAL_SIZE"
else
journal_size=64
fi
if [ "$DIB_ROOT_FSTYPE" = "ext4" ] ; then if [ "$DIB_ROOT_FSTYPE" = "ext4" ] ; then
# Very conservative to handle images being resized a lot # Very conservative to handle images being resized a lot
# We set journal size to 64M so our journal is large enough when we # We set journal size to 64M so our journal is large enough when we
# perform an FS resize. # perform an FS resize.
MKFS_OPTS="-i 4096 -J size=64 $MKFS_OPTS" MKFS_OPTS="-i 4096 -J size=$journal_size $MKFS_OPTS"
# Grow the image size to account for the journal, only if the user # Grow the image size to account for the journal, only if the user
# has not asked for a specific size. # has not asked for a specific size.
if [ -z "$DIB_IMAGE_SIZE" ]; then if [ -z "$DIB_IMAGE_SIZE" ]; then
du_size=$(( $du_size + 65536 )) du_size=$(( $du_size + ($journal_size * 1024) ))
fi fi
fi fi

View File

@ -660,6 +660,13 @@ configuration:
default can be overridden by passing ``'-i 16384'`` as a default can be overridden by passing ``'-i 16384'`` as a
``--mkfs-options`` argument. ``--mkfs-options`` argument.
``--mkfs-journal-size``
Only valid for ``FS_TYPE==ext4``. This value set the filesystem
journal size in MB; overriding the default of 64MiB. Note the
image size will be grown to fit the journal, unless
``DIB_IMAGE_SIZE`` is explicitly set. Can also set
``DIB_JOURNAL_SIZE``.
``--max-online-resize`` ``--max-online-resize``
Only valid for ``FS_TYPE==ext4``; this value sets the maximum Only valid for ``FS_TYPE==ext4``; this value sets the maximum
filesystem blocks when resizing. Can also set filesystem blocks when resizing. Can also set

View File

@ -0,0 +1,4 @@
---
features:
- The ``--mkfs-journal-size`` option is added to override the default
journal size for basic ext4 root partitions.