mirror of https://github.com/vitalif/e2fsprogs
resize2fs: Reserve some extra space for -P/-M for ext4 filesystems
Some extra blocks may be needed to expand some extent allocation trees while we are shrinking the filesystem. We don't know exactly how much, so we use a hueristic. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
79a9ab1454
commit
793a04a071
|
@ -1954,5 +1954,13 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs)
|
|||
blks_needed = (groups-1) * EXT2_BLOCKS_PER_GROUP(fs->super);
|
||||
blks_needed += overhead;
|
||||
|
||||
/*
|
||||
* We need to reserve a few extra blocks if extents are
|
||||
* enabled, in case we need to grow the extent tree. The more
|
||||
* we shrink the file system, the more space we need.
|
||||
*/
|
||||
if (fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS)
|
||||
blks_needed += (fs->super->s_blocks_count - blks_needed)/500;
|
||||
|
||||
return blks_needed;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue