]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
resize2fs: refine minimum required blocks for flex_bg file systems
authorTheodore Ts'o <tytso@mit.edu>
Sun, 27 Apr 2014 19:52:48 +0000 (15:52 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 5 May 2014 03:15:49 +0000 (23:15 -0400)
commit45a78b88dba1db5758f68d0d3229d3cb42da6050
treed721113ad69072cd717a03a23395f85ac6854977
parentb4f30fcfe66c76a95689b9a39c229cef2446b385
resize2fs: refine minimum required blocks for flex_bg file systems

The previous commit exposed bugs in the calculation for flex_bg file
systems.  The problem is that since (by default) we keep the metadata
blocks for the flex_bg in the first block group of the flex_bg, and
because we don't want to overwrite metadata blocks used by the
original file system with data blocks make life easier in case the
resize is aborted for some reason, we need to treat all of the
metadata blocks in the existing flex_bg has in use for the purposes of
calculate_minimum_resize_size().

Even though this means we need to reserve more data blocks to avoid
running out of space, the net result of these two commits is a net
savings in how much we can shrink a file system.

Using the following test sequence:

mke2fs -F -t ext4 /tmp/foo.img 2T
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img

Here is the comparison in the resulting file systems between the old
and new resize2fs (units are in 4k blocks):

                resize #1  resize #2   resize #3
old resize2fs    1117186     45679       43536
new resize2fs      48784     37413       37392

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
resize/resize2fs.c
tests/scripts/resize_test