diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/resize.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index b27c96d01965..6ed4df27da8d 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -79,12 +79,20 @@ static int verify_group_input(struct super_block *sb, | |||
79 | ext4_fsblk_t end = start + input->blocks_count; | 79 | ext4_fsblk_t end = start + input->blocks_count; |
80 | ext4_group_t group = input->group; | 80 | ext4_group_t group = input->group; |
81 | ext4_fsblk_t itend = input->inode_table + sbi->s_itb_per_group; | 81 | ext4_fsblk_t itend = input->inode_table + sbi->s_itb_per_group; |
82 | unsigned overhead = ext4_group_overhead_blocks(sb, group); | 82 | unsigned overhead; |
83 | ext4_fsblk_t metaend = start + overhead; | 83 | ext4_fsblk_t metaend; |
84 | struct buffer_head *bh = NULL; | 84 | struct buffer_head *bh = NULL; |
85 | ext4_grpblk_t free_blocks_count, offset; | 85 | ext4_grpblk_t free_blocks_count, offset; |
86 | int err = -EINVAL; | 86 | int err = -EINVAL; |
87 | 87 | ||
88 | if (group != sbi->s_groups_count) { | ||
89 | ext4_warning(sb, "Cannot add at group %u (only %u groups)", | ||
90 | input->group, sbi->s_groups_count); | ||
91 | return -EINVAL; | ||
92 | } | ||
93 | |||
94 | overhead = ext4_group_overhead_blocks(sb, group); | ||
95 | metaend = start + overhead; | ||
88 | input->free_blocks_count = free_blocks_count = | 96 | input->free_blocks_count = free_blocks_count = |
89 | input->blocks_count - 2 - overhead - sbi->s_itb_per_group; | 97 | input->blocks_count - 2 - overhead - sbi->s_itb_per_group; |
90 | 98 | ||
@@ -96,10 +104,7 @@ static int verify_group_input(struct super_block *sb, | |||
96 | free_blocks_count, input->reserved_blocks); | 104 | free_blocks_count, input->reserved_blocks); |
97 | 105 | ||
98 | ext4_get_group_no_and_offset(sb, start, NULL, &offset); | 106 | ext4_get_group_no_and_offset(sb, start, NULL, &offset); |
99 | if (group != sbi->s_groups_count) | 107 | if (offset != 0) |
100 | ext4_warning(sb, "Cannot add at group %u (only %u groups)", | ||
101 | input->group, sbi->s_groups_count); | ||
102 | else if (offset != 0) | ||
103 | ext4_warning(sb, "Last group not full"); | 108 | ext4_warning(sb, "Last group not full"); |
104 | else if (input->reserved_blocks > input->blocks_count / 5) | 109 | else if (input->reserved_blocks > input->blocks_count / 5) |
105 | ext4_warning(sb, "Reserved blocks too high (%u)", | 110 | ext4_warning(sb, "Reserved blocks too high (%u)", |