diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-09-07 17:02:35 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-09-07 17:02:35 -0400 |
commit | dc615a21c3c43cd9071926df2633d5b23e2e726b (patch) | |
tree | 2dec30720078a57ca347bc1214aabea4476f7107 /resize | |
parent | a9e55a1191cf08fd219466009613ed1a04bbaac0 (diff) | |
parent | 51e64594919c986f87267b895504322a38ec4fac (diff) | |
download | e2fsprogs-dc615a21c3c43cd9071926df2633d5b23e2e726b.tar.gz |
Merge branch 'maint' into next
Diffstat (limited to 'resize')
-rw-r--r-- | resize/main.c | 2 | ||||
-rw-r--r-- | resize/resize2fs.c | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/resize/main.c b/resize/main.c index c6cbb5e8..220c192e 100644 --- a/resize/main.c +++ b/resize/main.c @@ -375,7 +375,7 @@ int main (int argc, char ** argv) exit(1); } if (force_min_size) - new_size = calculate_minimum_resize_size(fs); + new_size = min_size; else if (new_size_str) { new_size = parse_num_blocks(new_size_str, fs->super->s_log_block_size); diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 4344a749..1a5d9100 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -1900,6 +1900,8 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs) blk_t inode_count, blks_needed, groups, data_blocks; blk_t grp, data_needed, last_start; int overhead = 0, num_of_superblocks = 0; + int extra_groups = 0; + int flexbg_size = 1 << fs->super->s_log_groups_per_flex; /* * first figure out how many group descriptors we need to @@ -1934,11 +1936,9 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs) * of inode tables of slack space so the resize * operation can be guaranteed to finish. */ - int flexbg_size = 1 << fs->super->s_log_groups_per_flex; - int extra_groups; - extra_groups = flexbg_size - (groups & (flexbg_size - 1)); data_needed += META_OVERHEAD(fs) * extra_groups; + extra_groups = groups % flexbg_size; } /* @@ -2002,6 +2002,20 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs) } groups += extra_grps; + extra_groups += extra_grps; + if (fs->super->s_feature_incompat + & EXT4_FEATURE_INCOMPAT_FLEX_BG + && extra_groups > flexbg_size) { + /* + * For ext4 we need to allow for up to a flex_bg worth + * of inode tables of slack space so the resize + * operation can be guaranteed to finish. + */ + extra_groups = flexbg_size - + (groups & (flexbg_size - 1)); + data_needed += META_OVERHEAD(fs) * extra_groups; + extra_groups = groups % flexbg_size; + } } /* now for the fun voodoo */ |