Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 331573
b: refs/heads/master
c: 03c1c29
h: refs/heads/master
i:
  331571: e063a8e
v: v3
  • Loading branch information
Yongqiang Yang authored and Theodore Ts'o committed Sep 5, 2012
1 parent 97d861b commit 9308685
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a2f8460e816f4786939a0cefbda35af6bd1a1c5
refs/heads/master: 03c1c29053f678234dbd51bf3d65f3b7529021de
12 changes: 9 additions & 3 deletions trunk/fs/ext4/resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ static void free_flex_gd(struct ext4_new_flex_group_data *flex_gd)
* be a partial of a flex group.
*
* @sb: super block of fs to which the groups belongs
*
* Returns 0 on a successful allocation of the metadata blocks in the
* block group.
*/
static void ext4_alloc_group_tables(struct super_block *sb,
static int ext4_alloc_group_tables(struct super_block *sb,
struct ext4_new_flex_group_data *flex_gd,
int flexbg_size)
{
Expand All @@ -226,6 +229,8 @@ static void ext4_alloc_group_tables(struct super_block *sb,
(last_group & ~(flexbg_size - 1))));
next_group:
group = group_data[0].group;
if (src_group >= group_data[0].group + flex_gd->count)
return -ENOSPC;
start_blk = ext4_group_first_block_no(sb, src_group);
last_blk = start_blk + group_data[src_group - group].blocks_count;

Expand All @@ -235,7 +240,6 @@ static void ext4_alloc_group_tables(struct super_block *sb,

start_blk += overhead;

BUG_ON(src_group >= group_data[0].group + flex_gd->count);
/* We collect contiguous blocks as much as possible. */
src_group++;
for (; src_group <= last_group; src_group++)
Expand Down Expand Up @@ -300,6 +304,7 @@ static void ext4_alloc_group_tables(struct super_block *sb,
group_data[i].free_blocks_count);
}
}
return 0;
}

static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
Expand Down Expand Up @@ -1729,7 +1734,8 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count)
*/
while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count,
flexbg_size)) {
ext4_alloc_group_tables(sb, flex_gd, flexbg_size);
if (ext4_alloc_group_tables(sb, flex_gd, flexbg_size) != 0)
break;
err = ext4_flex_group_add(sb, resize_inode, flex_gd);
if (unlikely(err))
break;
Expand Down

0 comments on commit 9308685

Please sign in to comment.