diff options
Diffstat (limited to 'fs/ext4/resize.c')
-rw-r--r-- | fs/ext4/resize.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 5b2828d21180..c60bfed5f5e7 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -36,7 +36,7 @@ static int verify_group_input(struct super_block *sb, | |||
36 | le16_to_cpu(es->s_reserved_gdt_blocks)) : 0; | 36 | le16_to_cpu(es->s_reserved_gdt_blocks)) : 0; |
37 | ext4_fsblk_t metaend = start + overhead; | 37 | ext4_fsblk_t metaend = start + overhead; |
38 | struct buffer_head *bh = NULL; | 38 | struct buffer_head *bh = NULL; |
39 | ext4_grpblk_t free_blocks_count; | 39 | ext4_grpblk_t free_blocks_count, offset; |
40 | int err = -EINVAL; | 40 | int err = -EINVAL; |
41 | 41 | ||
42 | input->free_blocks_count = free_blocks_count = | 42 | input->free_blocks_count = free_blocks_count = |
@@ -49,13 +49,13 @@ static int verify_group_input(struct super_block *sb, | |||
49 | "no-super", input->group, input->blocks_count, | 49 | "no-super", input->group, input->blocks_count, |
50 | free_blocks_count, input->reserved_blocks); | 50 | free_blocks_count, input->reserved_blocks); |
51 | 51 | ||
52 | ext4_get_group_no_and_offset(sb, start, NULL, &offset); | ||
52 | if (group != sbi->s_groups_count) | 53 | if (group != sbi->s_groups_count) |
53 | ext4_warning(sb, __FUNCTION__, | 54 | ext4_warning(sb, __FUNCTION__, |
54 | "Cannot add at group %u (only %lu groups)", | 55 | "Cannot add at group %u (only %lu groups)", |
55 | input->group, sbi->s_groups_count); | 56 | input->group, sbi->s_groups_count); |
56 | else if ((start - le32_to_cpu(es->s_first_data_block)) % | 57 | else if (offset != 0) |
57 | EXT4_BLOCKS_PER_GROUP(sb)) | 58 | ext4_warning(sb, __FUNCTION__, "Last group not full"); |
58 | ext4_warning(sb, __FUNCTION__, "Last group not full"); | ||
59 | else if (input->reserved_blocks > input->blocks_count / 5) | 59 | else if (input->reserved_blocks > input->blocks_count / 5) |
60 | ext4_warning(sb, __FUNCTION__, "Reserved blocks too high (%u)", | 60 | ext4_warning(sb, __FUNCTION__, "Reserved blocks too high (%u)", |
61 | input->reserved_blocks); | 61 | input->reserved_blocks); |
@@ -945,7 +945,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
945 | 945 | ||
946 | if (n_blocks_count > (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { | 946 | if (n_blocks_count > (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { |
947 | printk(KERN_ERR "EXT4-fs: filesystem on %s:" | 947 | printk(KERN_ERR "EXT4-fs: filesystem on %s:" |
948 | " too large to resize to %lu blocks safely\n", | 948 | " too large to resize to "E3FSBLK" blocks safely\n", |
949 | sb->s_id, n_blocks_count); | 949 | sb->s_id, n_blocks_count); |
950 | if (sizeof(sector_t) < 8) | 950 | if (sizeof(sector_t) < 8) |
951 | ext4_warning(sb, __FUNCTION__, | 951 | ext4_warning(sb, __FUNCTION__, |
@@ -960,8 +960,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
960 | } | 960 | } |
961 | 961 | ||
962 | /* Handle the remaining blocks in the last group only. */ | 962 | /* Handle the remaining blocks in the last group only. */ |
963 | last = (o_blocks_count - le32_to_cpu(es->s_first_data_block)) % | 963 | ext4_get_group_no_and_offset(sb, o_blocks_count, NULL, &last); |
964 | EXT4_BLOCKS_PER_GROUP(sb); | ||
965 | 964 | ||
966 | if (last == 0) { | 965 | if (last == 0) { |
967 | ext4_warning(sb, __FUNCTION__, | 966 | ext4_warning(sb, __FUNCTION__, |