diff options
Diffstat (limited to 'fs/ext3/resize.c')
-rw-r--r-- | fs/ext3/resize.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 82c678e92682..dfd811895d8f 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -116,7 +116,7 @@ static int verify_group_input(struct super_block *sb, | |||
116 | } | 116 | } |
117 | 117 | ||
118 | static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, | 118 | static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, |
119 | unsigned long blk) | 119 | ext3_fsblk_t blk) |
120 | { | 120 | { |
121 | struct buffer_head *bh; | 121 | struct buffer_head *bh; |
122 | int err; | 122 | int err; |
@@ -167,14 +167,13 @@ static int setup_new_group_blocks(struct super_block *sb, | |||
167 | struct ext3_new_group_data *input) | 167 | struct ext3_new_group_data *input) |
168 | { | 168 | { |
169 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 169 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
170 | unsigned long start = input->group * sbi->s_blocks_per_group + | 170 | ext3_fsblk_t start = ext3_group_first_block_no(sb, input->group); |
171 | le32_to_cpu(sbi->s_es->s_first_data_block); | ||
172 | int reserved_gdb = ext3_bg_has_super(sb, input->group) ? | 171 | int reserved_gdb = ext3_bg_has_super(sb, input->group) ? |
173 | le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0; | 172 | le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0; |
174 | unsigned long gdblocks = ext3_bg_num_gdb(sb, input->group); | 173 | unsigned long gdblocks = ext3_bg_num_gdb(sb, input->group); |
175 | struct buffer_head *bh; | 174 | struct buffer_head *bh; |
176 | handle_t *handle; | 175 | handle_t *handle; |
177 | unsigned long block; | 176 | ext3_fsblk_t block; |
178 | ext3_grpblk_t bit; | 177 | ext3_grpblk_t bit; |
179 | int i; | 178 | int i; |
180 | int err = 0, err2; | 179 | int err = 0, err2; |
@@ -332,7 +331,7 @@ static unsigned ext3_list_backups(struct super_block *sb, unsigned *three, | |||
332 | static int verify_reserved_gdb(struct super_block *sb, | 331 | static int verify_reserved_gdb(struct super_block *sb, |
333 | struct buffer_head *primary) | 332 | struct buffer_head *primary) |
334 | { | 333 | { |
335 | const unsigned long blk = primary->b_blocknr; | 334 | const ext3_fsblk_t blk = primary->b_blocknr; |
336 | const unsigned long end = EXT3_SB(sb)->s_groups_count; | 335 | const unsigned long end = EXT3_SB(sb)->s_groups_count; |
337 | unsigned three = 1; | 336 | unsigned three = 1; |
338 | unsigned five = 5; | 337 | unsigned five = 5; |
@@ -344,7 +343,8 @@ static int verify_reserved_gdb(struct super_block *sb, | |||
344 | while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { | 343 | while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { |
345 | if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ | 344 | if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ |
346 | ext3_warning(sb, __FUNCTION__, | 345 | ext3_warning(sb, __FUNCTION__, |
347 | "reserved GDT %lu missing grp %d (%lu)", | 346 | "reserved GDT "E3FSBLK |
347 | " missing grp %d ("E3FSBLK")", | ||
348 | blk, grp, | 348 | blk, grp, |
349 | grp * EXT3_BLOCKS_PER_GROUP(sb) + blk); | 349 | grp * EXT3_BLOCKS_PER_GROUP(sb) + blk); |
350 | return -EINVAL; | 350 | return -EINVAL; |
@@ -376,7 +376,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
376 | struct super_block *sb = inode->i_sb; | 376 | struct super_block *sb = inode->i_sb; |
377 | struct ext3_super_block *es = EXT3_SB(sb)->s_es; | 377 | struct ext3_super_block *es = EXT3_SB(sb)->s_es; |
378 | unsigned long gdb_num = input->group / EXT3_DESC_PER_BLOCK(sb); | 378 | unsigned long gdb_num = input->group / EXT3_DESC_PER_BLOCK(sb); |
379 | unsigned long gdblock = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num; | 379 | ext3_fsblk_t gdblock = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num; |
380 | struct buffer_head **o_group_desc, **n_group_desc; | 380 | struct buffer_head **o_group_desc, **n_group_desc; |
381 | struct buffer_head *dind; | 381 | struct buffer_head *dind; |
382 | int gdbackups; | 382 | int gdbackups; |
@@ -421,7 +421,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
421 | data = (__u32 *)dind->b_data; | 421 | data = (__u32 *)dind->b_data; |
422 | if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { | 422 | if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { |
423 | ext3_warning(sb, __FUNCTION__, | 423 | ext3_warning(sb, __FUNCTION__, |
424 | "new group %u GDT block %lu not reserved", | 424 | "new group %u GDT block "E3FSBLK" not reserved", |
425 | input->group, gdblock); | 425 | input->group, gdblock); |
426 | err = -EINVAL; | 426 | err = -EINVAL; |
427 | goto exit_dind; | 427 | goto exit_dind; |
@@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
519 | struct buffer_head **primary; | 519 | struct buffer_head **primary; |
520 | struct buffer_head *dind; | 520 | struct buffer_head *dind; |
521 | struct ext3_iloc iloc; | 521 | struct ext3_iloc iloc; |
522 | unsigned long blk; | 522 | ext3_fsblk_t blk; |
523 | __u32 *data, *end; | 523 | __u32 *data, *end; |
524 | int gdbackups = 0; | 524 | int gdbackups = 0; |
525 | int res, i; | 525 | int res, i; |
@@ -544,7 +544,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
544 | for (res = 0; res < reserved_gdb; res++, blk++) { | 544 | for (res = 0; res < reserved_gdb; res++, blk++) { |
545 | if (le32_to_cpu(*data) != blk) { | 545 | if (le32_to_cpu(*data) != blk) { |
546 | ext3_warning(sb, __FUNCTION__, | 546 | ext3_warning(sb, __FUNCTION__, |
547 | "reserved block %lu not at offset %ld", | 547 | "reserved block "E3FSBLK |
548 | " not at offset %ld", | ||
548 | blk, (long)(data - (__u32 *)dind->b_data)); | 549 | blk, (long)(data - (__u32 *)dind->b_data)); |
549 | err = -EINVAL; | 550 | err = -EINVAL; |
550 | goto exit_bh; | 551 | goto exit_bh; |
@@ -906,9 +907,9 @@ exit_put: | |||
906 | * GDT blocks are reserved to grow to the desired size. | 907 | * GDT blocks are reserved to grow to the desired size. |
907 | */ | 908 | */ |
908 | int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | 909 | int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, |
909 | unsigned long n_blocks_count) | 910 | ext3_fsblk_t n_blocks_count) |
910 | { | 911 | { |
911 | unsigned long o_blocks_count; | 912 | ext3_fsblk_t o_blocks_count; |
912 | unsigned long o_groups_count; | 913 | unsigned long o_groups_count; |
913 | ext3_grpblk_t last; | 914 | ext3_grpblk_t last; |
914 | ext3_grpblk_t add; | 915 | ext3_grpblk_t add; |
@@ -924,7 +925,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
924 | o_groups_count = EXT3_SB(sb)->s_groups_count; | 925 | o_groups_count = EXT3_SB(sb)->s_groups_count; |
925 | 926 | ||
926 | if (test_opt(sb, DEBUG)) | 927 | if (test_opt(sb, DEBUG)) |
927 | printk(KERN_DEBUG "EXT3-fs: extending last group from %lu to %lu blocks\n", | 928 | printk(KERN_DEBUG "EXT3-fs: extending last group from "E3FSBLK" uto "E3FSBLK" blocks\n", |
928 | o_blocks_count, n_blocks_count); | 929 | o_blocks_count, n_blocks_count); |
929 | 930 | ||
930 | if (n_blocks_count == 0 || n_blocks_count == o_blocks_count) | 931 | if (n_blocks_count == 0 || n_blocks_count == o_blocks_count) |
@@ -963,7 +964,8 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
963 | 964 | ||
964 | if (o_blocks_count + add < n_blocks_count) | 965 | if (o_blocks_count + add < n_blocks_count) |
965 | ext3_warning(sb, __FUNCTION__, | 966 | ext3_warning(sb, __FUNCTION__, |
966 | "will only finish group (%lu blocks, %u new)", | 967 | "will only finish group ("E3FSBLK |
968 | " blocks, %u new)", | ||
967 | o_blocks_count + add, add); | 969 | o_blocks_count + add, add); |
968 | 970 | ||
969 | /* See if the device is actually as big as what was requested */ | 971 | /* See if the device is actually as big as what was requested */ |
@@ -1006,10 +1008,10 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, | |||
1006 | ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); | 1008 | ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); |
1007 | sb->s_dirt = 1; | 1009 | sb->s_dirt = 1; |
1008 | unlock_super(sb); | 1010 | unlock_super(sb); |
1009 | ext3_debug("freeing blocks %lu through %lu\n", o_blocks_count, | 1011 | ext3_debug("freeing blocks %lu through "E3FSBLK"\n", o_blocks_count, |
1010 | o_blocks_count + add); | 1012 | o_blocks_count + add); |
1011 | ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks); | 1013 | ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks); |
1012 | ext3_debug("freed blocks %lu through %lu\n", o_blocks_count, | 1014 | ext3_debug("freed blocks "E3FSBLK" through "E3FSBLK"\n", o_blocks_count, |
1013 | o_blocks_count + add); | 1015 | o_blocks_count + add); |
1014 | if ((err = ext3_journal_stop(handle))) | 1016 | if ((err = ext3_journal_stop(handle))) |
1015 | goto exit_put; | 1017 | goto exit_put; |