diff options
Diffstat (limited to 'fs/ext4/resize.c')
| -rw-r--r-- | fs/ext4/resize.c | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index f000fbe2cd93..0a9265164265 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
| @@ -73,7 +73,7 @@ static int verify_group_input(struct super_block *sb, | |||
| 73 | "Inode bitmap not in group (block %llu)", | 73 | "Inode bitmap not in group (block %llu)", |
| 74 | (unsigned long long)input->inode_bitmap); | 74 | (unsigned long long)input->inode_bitmap); |
| 75 | else if (outside(input->inode_table, start, end) || | 75 | else if (outside(input->inode_table, start, end) || |
| 76 | outside(itend - 1, start, end)) | 76 | outside(itend - 1, start, end)) |
| 77 | ext4_warning(sb, __func__, | 77 | ext4_warning(sb, __func__, |
| 78 | "Inode table not in group (blocks %llu-%llu)", | 78 | "Inode table not in group (blocks %llu-%llu)", |
| 79 | (unsigned long long)input->inode_table, itend - 1); | 79 | (unsigned long long)input->inode_table, itend - 1); |
| @@ -104,7 +104,7 @@ static int verify_group_input(struct super_block *sb, | |||
| 104 | (unsigned long long)input->inode_bitmap, | 104 | (unsigned long long)input->inode_bitmap, |
| 105 | start, metaend - 1); | 105 | start, metaend - 1); |
| 106 | else if (inside(input->inode_table, start, metaend) || | 106 | else if (inside(input->inode_table, start, metaend) || |
| 107 | inside(itend - 1, start, metaend)) | 107 | inside(itend - 1, start, metaend)) |
| 108 | ext4_warning(sb, __func__, | 108 | ext4_warning(sb, __func__, |
| 109 | "Inode table (%llu-%llu) overlaps" | 109 | "Inode table (%llu-%llu) overlaps" |
| 110 | "GDT table (%llu-%llu)", | 110 | "GDT table (%llu-%llu)", |
| @@ -158,9 +158,9 @@ static int extend_or_restart_transaction(handle_t *handle, int thresh, | |||
| 158 | if (err) { | 158 | if (err) { |
| 159 | if ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA))) | 159 | if ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA))) |
| 160 | return err; | 160 | return err; |
| 161 | if ((err = ext4_journal_get_write_access(handle, bh))) | 161 | if ((err = ext4_journal_get_write_access(handle, bh))) |
| 162 | return err; | 162 | return err; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | return 0; | 165 | return 0; |
| 166 | } | 166 | } |
| @@ -416,11 +416,11 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
| 416 | "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n", | 416 | "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n", |
| 417 | gdb_num); | 417 | gdb_num); |
| 418 | 418 | ||
| 419 | /* | 419 | /* |
| 420 | * If we are not using the primary superblock/GDT copy don't resize, | 420 | * If we are not using the primary superblock/GDT copy don't resize, |
| 421 | * because the user tools have no way of handling this. Probably a | 421 | * because the user tools have no way of handling this. Probably a |
| 422 | * bad time to do it anyways. | 422 | * bad time to do it anyways. |
| 423 | */ | 423 | */ |
| 424 | if (EXT4_SB(sb)->s_sbh->b_blocknr != | 424 | if (EXT4_SB(sb)->s_sbh->b_blocknr != |
| 425 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { | 425 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { |
| 426 | ext4_warning(sb, __func__, | 426 | ext4_warning(sb, __func__, |
| @@ -507,14 +507,14 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
| 507 | return 0; | 507 | return 0; |
| 508 | 508 | ||
| 509 | exit_inode: | 509 | exit_inode: |
| 510 | //ext4_journal_release_buffer(handle, iloc.bh); | 510 | /* ext4_journal_release_buffer(handle, iloc.bh); */ |
| 511 | brelse(iloc.bh); | 511 | brelse(iloc.bh); |
| 512 | exit_dindj: | 512 | exit_dindj: |
| 513 | //ext4_journal_release_buffer(handle, dind); | 513 | /* ext4_journal_release_buffer(handle, dind); */ |
| 514 | exit_primary: | 514 | exit_primary: |
| 515 | //ext4_journal_release_buffer(handle, *primary); | 515 | /* ext4_journal_release_buffer(handle, *primary); */ |
| 516 | exit_sbh: | 516 | exit_sbh: |
| 517 | //ext4_journal_release_buffer(handle, *primary); | 517 | /* ext4_journal_release_buffer(handle, *primary); */ |
| 518 | exit_dind: | 518 | exit_dind: |
| 519 | brelse(dind); | 519 | brelse(dind); |
| 520 | exit_bh: | 520 | exit_bh: |
| @@ -818,12 +818,12 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) | |||
| 818 | if ((err = ext4_journal_get_write_access(handle, sbi->s_sbh))) | 818 | if ((err = ext4_journal_get_write_access(handle, sbi->s_sbh))) |
| 819 | goto exit_journal; | 819 | goto exit_journal; |
| 820 | 820 | ||
| 821 | /* | 821 | /* |
| 822 | * We will only either add reserved group blocks to a backup group | 822 | * We will only either add reserved group blocks to a backup group |
| 823 | * or remove reserved blocks for the first group in a new group block. | 823 | * or remove reserved blocks for the first group in a new group block. |
| 824 | * Doing both would be mean more complex code, and sane people don't | 824 | * Doing both would be mean more complex code, and sane people don't |
| 825 | * use non-sparse filesystems anymore. This is already checked above. | 825 | * use non-sparse filesystems anymore. This is already checked above. |
| 826 | */ | 826 | */ |
| 827 | if (gdb_off) { | 827 | if (gdb_off) { |
| 828 | primary = sbi->s_group_desc[gdb_num]; | 828 | primary = sbi->s_group_desc[gdb_num]; |
| 829 | if ((err = ext4_journal_get_write_access(handle, primary))) | 829 | if ((err = ext4_journal_get_write_access(handle, primary))) |
| @@ -835,24 +835,24 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) | |||
| 835 | } else if ((err = add_new_gdb(handle, inode, input, &primary))) | 835 | } else if ((err = add_new_gdb(handle, inode, input, &primary))) |
| 836 | goto exit_journal; | 836 | goto exit_journal; |
| 837 | 837 | ||
| 838 | /* | 838 | /* |
| 839 | * OK, now we've set up the new group. Time to make it active. | 839 | * OK, now we've set up the new group. Time to make it active. |
| 840 | * | 840 | * |
| 841 | * Current kernels don't lock all allocations via lock_super(), | 841 | * Current kernels don't lock all allocations via lock_super(), |
| 842 | * so we have to be safe wrt. concurrent accesses the group | 842 | * so we have to be safe wrt. concurrent accesses the group |
| 843 | * data. So we need to be careful to set all of the relevant | 843 | * data. So we need to be careful to set all of the relevant |
| 844 | * group descriptor data etc. *before* we enable the group. | 844 | * group descriptor data etc. *before* we enable the group. |
| 845 | * | 845 | * |
| 846 | * The key field here is sbi->s_groups_count: as long as | 846 | * The key field here is sbi->s_groups_count: as long as |
| 847 | * that retains its old value, nobody is going to access the new | 847 | * that retains its old value, nobody is going to access the new |
| 848 | * group. | 848 | * group. |
| 849 | * | 849 | * |
| 850 | * So first we update all the descriptor metadata for the new | 850 | * So first we update all the descriptor metadata for the new |
| 851 | * group; then we update the total disk blocks count; then we | 851 | * group; then we update the total disk blocks count; then we |
| 852 | * update the groups count to enable the group; then finally we | 852 | * update the groups count to enable the group; then finally we |
| 853 | * update the free space counts so that the system can start | 853 | * update the free space counts so that the system can start |
| 854 | * using the new disk blocks. | 854 | * using the new disk blocks. |
| 855 | */ | 855 | */ |
| 856 | 856 | ||
| 857 | /* Update group descriptor block for new group */ | 857 | /* Update group descriptor block for new group */ |
| 858 | gdp = (struct ext4_group_desc *)((char *)primary->b_data + | 858 | gdp = (struct ext4_group_desc *)((char *)primary->b_data + |
| @@ -946,7 +946,8 @@ exit_put: | |||
| 946 | return err; | 946 | return err; |
| 947 | } /* ext4_group_add */ | 947 | } /* ext4_group_add */ |
| 948 | 948 | ||
| 949 | /* Extend the filesystem to the new number of blocks specified. This entry | 949 | /* |
| 950 | * Extend the filesystem to the new number of blocks specified. This entry | ||
| 950 | * point is only used to extend the current filesystem to the end of the last | 951 | * point is only used to extend the current filesystem to the end of the last |
| 951 | * existing group. It can be accessed via ioctl, or by "remount,resize=<size>" | 952 | * existing group. It can be accessed via ioctl, or by "remount,resize=<size>" |
| 952 | * for emergencies (because it has no dependencies on reserved blocks). | 953 | * for emergencies (because it has no dependencies on reserved blocks). |
| @@ -1024,7 +1025,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
| 1024 | o_blocks_count + add, add); | 1025 | o_blocks_count + add, add); |
| 1025 | 1026 | ||
| 1026 | /* See if the device is actually as big as what was requested */ | 1027 | /* See if the device is actually as big as what was requested */ |
| 1027 | bh = sb_bread(sb, o_blocks_count + add -1); | 1028 | bh = sb_bread(sb, o_blocks_count + add - 1); |
| 1028 | if (!bh) { | 1029 | if (!bh) { |
| 1029 | ext4_warning(sb, __func__, | 1030 | ext4_warning(sb, __func__, |
| 1030 | "can't read last block, resize aborted"); | 1031 | "can't read last block, resize aborted"); |
