diff options
author | Theodore Ts'o <tytso@mit.edu> | 2012-09-05 01:31:50 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-09-05 01:31:50 -0400 |
commit | 28623c2f5b0dca3c3ea34fd6108940661352e276 (patch) | |
tree | ec5bf1df32709f0ebf359ce05b16f8ef608d2e9e /fs/ext4/resize.c | |
parent | 117fff10d7f140e12dd43df20d3f9fda80577460 (diff) |
ext4: grow the s_group_info array as needed
Previously we allocated the s_group_info array with enough space for
any future possible growth of the file system via online resize. This
is unfortunate because it wastes memory, and it doesn't work for the
meta_bg scheme, since there is no limit based on the number of
reserved gdt blocks. So add the code to grow the s_group_info array
as needed.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/resize.c')
-rw-r--r-- | fs/ext4/resize.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 3f5c67bf13a..f288933bf4c 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1507,6 +1507,10 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) if (err) return err; + err = ext4_mb_alloc_groupinfo(sb, input->group + 1); + if (err) + goto out; + flex_gd.count = 1; flex_gd.groups = input; flex_gd.bg_flags = &bg_flags; @@ -1732,6 +1736,10 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) if (err) return err; + err = ext4_mb_alloc_groupinfo(sb, n_group + 1); + if (err) + goto out; + flex_gd = alloc_flex_gd(flexbg_size); if (flex_gd == NULL) { err = -ENOMEM; |