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 3f5c67bf13a2..f288933bf4c0 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) | |||
1507 | if (err) | 1507 | if (err) |
1508 | return err; | 1508 | return err; |
1509 | 1509 | ||
1510 | err = ext4_mb_alloc_groupinfo(sb, input->group + 1); | ||
1511 | if (err) | ||
1512 | goto out; | ||
1513 | |||
1510 | flex_gd.count = 1; | 1514 | flex_gd.count = 1; |
1511 | flex_gd.groups = input; | 1515 | flex_gd.groups = input; |
1512 | flex_gd.bg_flags = &bg_flags; | 1516 | flex_gd.bg_flags = &bg_flags; |
@@ -1732,6 +1736,10 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) | |||
1732 | if (err) | 1736 | if (err) |
1733 | return err; | 1737 | return err; |
1734 | 1738 | ||
1739 | err = ext4_mb_alloc_groupinfo(sb, n_group + 1); | ||
1740 | if (err) | ||
1741 | goto out; | ||
1742 | |||
1735 | flex_gd = alloc_flex_gd(flexbg_size); | 1743 | flex_gd = alloc_flex_gd(flexbg_size); |
1736 | if (flex_gd == NULL) { | 1744 | if (flex_gd == NULL) { |
1737 | err = -ENOMEM; | 1745 | err = -ENOMEM; |