aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/resize.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3/resize.c')
-rw-r--r--fs/ext3/resize.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 7a9dac1d3653..28cfd0b40527 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -48,60 +48,60 @@ static int verify_group_input(struct super_block *sb,
48 free_blocks_count, input->reserved_blocks); 48 free_blocks_count, input->reserved_blocks);
49 49
50 if (group != sbi->s_groups_count) 50 if (group != sbi->s_groups_count)
51 ext3_warning(sb, __FUNCTION__, 51 ext3_warning(sb, __func__,
52 "Cannot add at group %u (only %lu groups)", 52 "Cannot add at group %u (only %lu groups)",
53 input->group, sbi->s_groups_count); 53 input->group, sbi->s_groups_count);
54 else if ((start - le32_to_cpu(es->s_first_data_block)) % 54 else if ((start - le32_to_cpu(es->s_first_data_block)) %
55 EXT3_BLOCKS_PER_GROUP(sb)) 55 EXT3_BLOCKS_PER_GROUP(sb))
56 ext3_warning(sb, __FUNCTION__, "Last group not full"); 56 ext3_warning(sb, __func__, "Last group not full");
57 else if (input->reserved_blocks > input->blocks_count / 5) 57 else if (input->reserved_blocks > input->blocks_count / 5)
58 ext3_warning(sb, __FUNCTION__, "Reserved blocks too high (%u)", 58 ext3_warning(sb, __func__, "Reserved blocks too high (%u)",
59 input->reserved_blocks); 59 input->reserved_blocks);
60 else if (free_blocks_count < 0) 60 else if (free_blocks_count < 0)
61 ext3_warning(sb, __FUNCTION__, "Bad blocks count %u", 61 ext3_warning(sb, __func__, "Bad blocks count %u",
62 input->blocks_count); 62 input->blocks_count);
63 else if (!(bh = sb_bread(sb, end - 1))) 63 else if (!(bh = sb_bread(sb, end - 1)))
64 ext3_warning(sb, __FUNCTION__, 64 ext3_warning(sb, __func__,
65 "Cannot read last block ("E3FSBLK")", 65 "Cannot read last block ("E3FSBLK")",
66 end - 1); 66 end - 1);
67 else if (outside(input->block_bitmap, start, end)) 67 else if (outside(input->block_bitmap, start, end))
68 ext3_warning(sb, __FUNCTION__, 68 ext3_warning(sb, __func__,
69 "Block bitmap not in group (block %u)", 69 "Block bitmap not in group (block %u)",
70 input->block_bitmap); 70 input->block_bitmap);
71 else if (outside(input->inode_bitmap, start, end)) 71 else if (outside(input->inode_bitmap, start, end))
72 ext3_warning(sb, __FUNCTION__, 72 ext3_warning(sb, __func__,
73 "Inode bitmap not in group (block %u)", 73 "Inode bitmap not in group (block %u)",
74 input->inode_bitmap); 74 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 ext3_warning(sb, __FUNCTION__, 77 ext3_warning(sb, __func__,
78 "Inode table not in group (blocks %u-"E3FSBLK")", 78 "Inode table not in group (blocks %u-"E3FSBLK")",
79 input->inode_table, itend - 1); 79 input->inode_table, itend - 1);
80 else if (input->inode_bitmap == input->block_bitmap) 80 else if (input->inode_bitmap == input->block_bitmap)
81 ext3_warning(sb, __FUNCTION__, 81 ext3_warning(sb, __func__,
82 "Block bitmap same as inode bitmap (%u)", 82 "Block bitmap same as inode bitmap (%u)",
83 input->block_bitmap); 83 input->block_bitmap);
84 else if (inside(input->block_bitmap, input->inode_table, itend)) 84 else if (inside(input->block_bitmap, input->inode_table, itend))
85 ext3_warning(sb, __FUNCTION__, 85 ext3_warning(sb, __func__,
86 "Block bitmap (%u) in inode table (%u-"E3FSBLK")", 86 "Block bitmap (%u) in inode table (%u-"E3FSBLK")",
87 input->block_bitmap, input->inode_table, itend-1); 87 input->block_bitmap, input->inode_table, itend-1);
88 else if (inside(input->inode_bitmap, input->inode_table, itend)) 88 else if (inside(input->inode_bitmap, input->inode_table, itend))
89 ext3_warning(sb, __FUNCTION__, 89 ext3_warning(sb, __func__,
90 "Inode bitmap (%u) in inode table (%u-"E3FSBLK")", 90 "Inode bitmap (%u) in inode table (%u-"E3FSBLK")",
91 input->inode_bitmap, input->inode_table, itend-1); 91 input->inode_bitmap, input->inode_table, itend-1);
92 else if (inside(input->block_bitmap, start, metaend)) 92 else if (inside(input->block_bitmap, start, metaend))
93 ext3_warning(sb, __FUNCTION__, 93 ext3_warning(sb, __func__,
94 "Block bitmap (%u) in GDT table" 94 "Block bitmap (%u) in GDT table"
95 " ("E3FSBLK"-"E3FSBLK")", 95 " ("E3FSBLK"-"E3FSBLK")",
96 input->block_bitmap, start, metaend - 1); 96 input->block_bitmap, start, metaend - 1);
97 else if (inside(input->inode_bitmap, start, metaend)) 97 else if (inside(input->inode_bitmap, start, metaend))
98 ext3_warning(sb, __FUNCTION__, 98 ext3_warning(sb, __func__,
99 "Inode bitmap (%u) in GDT table" 99 "Inode bitmap (%u) in GDT table"
100 " ("E3FSBLK"-"E3FSBLK")", 100 " ("E3FSBLK"-"E3FSBLK")",
101 input->inode_bitmap, start, metaend - 1); 101 input->inode_bitmap, start, metaend - 1);
102 else if (inside(input->inode_table, start, metaend) || 102 else if (inside(input->inode_table, start, metaend) ||
103 inside(itend - 1, start, metaend)) 103 inside(itend - 1, start, metaend))
104 ext3_warning(sb, __FUNCTION__, 104 ext3_warning(sb, __func__,
105 "Inode table (%u-"E3FSBLK") overlaps" 105 "Inode table (%u-"E3FSBLK") overlaps"
106 "GDT table ("E3FSBLK"-"E3FSBLK")", 106 "GDT table ("E3FSBLK"-"E3FSBLK")",
107 input->inode_table, itend - 1, start, metaend - 1); 107 input->inode_table, itend - 1, start, metaend - 1);
@@ -386,7 +386,7 @@ static int verify_reserved_gdb(struct super_block *sb,
386 386
387 while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { 387 while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) {
388 if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ 388 if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){
389 ext3_warning(sb, __FUNCTION__, 389 ext3_warning(sb, __func__,
390 "reserved GDT "E3FSBLK 390 "reserved GDT "E3FSBLK
391 " missing grp %d ("E3FSBLK")", 391 " missing grp %d ("E3FSBLK")",
392 blk, grp, 392 blk, grp,
@@ -440,7 +440,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
440 */ 440 */
441 if (EXT3_SB(sb)->s_sbh->b_blocknr != 441 if (EXT3_SB(sb)->s_sbh->b_blocknr !=
442 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) { 442 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) {
443 ext3_warning(sb, __FUNCTION__, 443 ext3_warning(sb, __func__,
444 "won't resize using backup superblock at %llu", 444 "won't resize using backup superblock at %llu",
445 (unsigned long long)EXT3_SB(sb)->s_sbh->b_blocknr); 445 (unsigned long long)EXT3_SB(sb)->s_sbh->b_blocknr);
446 return -EPERM; 446 return -EPERM;
@@ -464,7 +464,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
464 464
465 data = (__le32 *)dind->b_data; 465 data = (__le32 *)dind->b_data;
466 if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { 466 if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) {
467 ext3_warning(sb, __FUNCTION__, 467 ext3_warning(sb, __func__,
468 "new group %u GDT block "E3FSBLK" not reserved", 468 "new group %u GDT block "E3FSBLK" not reserved",
469 input->group, gdblock); 469 input->group, gdblock);
470 err = -EINVAL; 470 err = -EINVAL;
@@ -488,7 +488,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
488 GFP_NOFS); 488 GFP_NOFS);
489 if (!n_group_desc) { 489 if (!n_group_desc) {
490 err = -ENOMEM; 490 err = -ENOMEM;
491 ext3_warning (sb, __FUNCTION__, 491 ext3_warning (sb, __func__,
492 "not enough memory for %lu groups", gdb_num + 1); 492 "not enough memory for %lu groups", gdb_num + 1);
493 goto exit_inode; 493 goto exit_inode;
494 } 494 }
@@ -586,7 +586,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
586 /* Get each reserved primary GDT block and verify it holds backups */ 586 /* Get each reserved primary GDT block and verify it holds backups */
587 for (res = 0; res < reserved_gdb; res++, blk++) { 587 for (res = 0; res < reserved_gdb; res++, blk++) {
588 if (le32_to_cpu(*data) != blk) { 588 if (le32_to_cpu(*data) != blk) {
589 ext3_warning(sb, __FUNCTION__, 589 ext3_warning(sb, __func__,
590 "reserved block "E3FSBLK 590 "reserved block "E3FSBLK
591 " not at offset %ld", 591 " not at offset %ld",
592 blk, 592 blk,
@@ -730,7 +730,7 @@ static void update_backups(struct super_block *sb,
730 */ 730 */
731exit_err: 731exit_err:
732 if (err) { 732 if (err) {
733 ext3_warning(sb, __FUNCTION__, 733 ext3_warning(sb, __func__,
734 "can't update backup for group %d (err %d), " 734 "can't update backup for group %d (err %d), "
735 "forcing fsck on next reboot", group, err); 735 "forcing fsck on next reboot", group, err);
736 sbi->s_mount_state &= ~EXT3_VALID_FS; 736 sbi->s_mount_state &= ~EXT3_VALID_FS;
@@ -770,33 +770,33 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
770 770
771 if (gdb_off == 0 && !EXT3_HAS_RO_COMPAT_FEATURE(sb, 771 if (gdb_off == 0 && !EXT3_HAS_RO_COMPAT_FEATURE(sb,
772 EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER)) { 772 EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
773 ext3_warning(sb, __FUNCTION__, 773 ext3_warning(sb, __func__,
774 "Can't resize non-sparse filesystem further"); 774 "Can't resize non-sparse filesystem further");
775 return -EPERM; 775 return -EPERM;
776 } 776 }
777 777
778 if (le32_to_cpu(es->s_blocks_count) + input->blocks_count < 778 if (le32_to_cpu(es->s_blocks_count) + input->blocks_count <
779 le32_to_cpu(es->s_blocks_count)) { 779 le32_to_cpu(es->s_blocks_count)) {
780 ext3_warning(sb, __FUNCTION__, "blocks_count overflow\n"); 780 ext3_warning(sb, __func__, "blocks_count overflow\n");
781 return -EINVAL; 781 return -EINVAL;
782 } 782 }
783 783
784 if (le32_to_cpu(es->s_inodes_count) + EXT3_INODES_PER_GROUP(sb) < 784 if (le32_to_cpu(es->s_inodes_count) + EXT3_INODES_PER_GROUP(sb) <
785 le32_to_cpu(es->s_inodes_count)) { 785 le32_to_cpu(es->s_inodes_count)) {
786 ext3_warning(sb, __FUNCTION__, "inodes_count overflow\n"); 786 ext3_warning(sb, __func__, "inodes_count overflow\n");
787 return -EINVAL; 787 return -EINVAL;
788 } 788 }
789 789
790 if (reserved_gdb || gdb_off == 0) { 790 if (reserved_gdb || gdb_off == 0) {
791 if (!EXT3_HAS_COMPAT_FEATURE(sb, 791 if (!EXT3_HAS_COMPAT_FEATURE(sb,
792 EXT3_FEATURE_COMPAT_RESIZE_INODE)){ 792 EXT3_FEATURE_COMPAT_RESIZE_INODE)){
793 ext3_warning(sb, __FUNCTION__, 793 ext3_warning(sb, __func__,
794 "No reserved GDT blocks, can't resize"); 794 "No reserved GDT blocks, can't resize");
795 return -EPERM; 795 return -EPERM;
796 } 796 }
797 inode = ext3_iget(sb, EXT3_RESIZE_INO); 797 inode = ext3_iget(sb, EXT3_RESIZE_INO);
798 if (IS_ERR(inode)) { 798 if (IS_ERR(inode)) {
799 ext3_warning(sb, __FUNCTION__, 799 ext3_warning(sb, __func__,
800 "Error opening resize inode"); 800 "Error opening resize inode");
801 return PTR_ERR(inode); 801 return PTR_ERR(inode);
802 } 802 }
@@ -825,7 +825,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
825 825
826 lock_super(sb); 826 lock_super(sb);
827 if (input->group != sbi->s_groups_count) { 827 if (input->group != sbi->s_groups_count) {
828 ext3_warning(sb, __FUNCTION__, 828 ext3_warning(sb, __func__,
829 "multiple resizers run on filesystem!"); 829 "multiple resizers run on filesystem!");
830 err = -EBUSY; 830 err = -EBUSY;
831 goto exit_journal; 831 goto exit_journal;
@@ -988,13 +988,13 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
988 " too large to resize to %lu blocks safely\n", 988 " too large to resize to %lu blocks safely\n",
989 sb->s_id, n_blocks_count); 989 sb->s_id, n_blocks_count);
990 if (sizeof(sector_t) < 8) 990 if (sizeof(sector_t) < 8)
991 ext3_warning(sb, __FUNCTION__, 991 ext3_warning(sb, __func__,
992 "CONFIG_LBD not enabled\n"); 992 "CONFIG_LBD not enabled\n");
993 return -EINVAL; 993 return -EINVAL;
994 } 994 }
995 995
996 if (n_blocks_count < o_blocks_count) { 996 if (n_blocks_count < o_blocks_count) {
997 ext3_warning(sb, __FUNCTION__, 997 ext3_warning(sb, __func__,
998 "can't shrink FS - resize aborted"); 998 "can't shrink FS - resize aborted");
999 return -EBUSY; 999 return -EBUSY;
1000 } 1000 }
@@ -1004,7 +1004,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1004 EXT3_BLOCKS_PER_GROUP(sb); 1004 EXT3_BLOCKS_PER_GROUP(sb);
1005 1005
1006 if (last == 0) { 1006 if (last == 0) {
1007 ext3_warning(sb, __FUNCTION__, 1007 ext3_warning(sb, __func__,
1008 "need to use ext2online to resize further"); 1008 "need to use ext2online to resize further");
1009 return -EPERM; 1009 return -EPERM;
1010 } 1010 }
@@ -1012,7 +1012,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1012 add = EXT3_BLOCKS_PER_GROUP(sb) - last; 1012 add = EXT3_BLOCKS_PER_GROUP(sb) - last;
1013 1013
1014 if (o_blocks_count + add < o_blocks_count) { 1014 if (o_blocks_count + add < o_blocks_count) {
1015 ext3_warning(sb, __FUNCTION__, "blocks_count overflow"); 1015 ext3_warning(sb, __func__, "blocks_count overflow");
1016 return -EINVAL; 1016 return -EINVAL;
1017 } 1017 }
1018 1018
@@ -1020,7 +1020,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1020 add = n_blocks_count - o_blocks_count; 1020 add = n_blocks_count - o_blocks_count;
1021 1021
1022 if (o_blocks_count + add < n_blocks_count) 1022 if (o_blocks_count + add < n_blocks_count)
1023 ext3_warning(sb, __FUNCTION__, 1023 ext3_warning(sb, __func__,
1024 "will only finish group ("E3FSBLK 1024 "will only finish group ("E3FSBLK
1025 " blocks, %u new)", 1025 " blocks, %u new)",
1026 o_blocks_count + add, add); 1026 o_blocks_count + add, add);
@@ -1028,7 +1028,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1028 /* See if the device is actually as big as what was requested */ 1028 /* See if the device is actually as big as what was requested */
1029 bh = sb_bread(sb, o_blocks_count + add -1); 1029 bh = sb_bread(sb, o_blocks_count + add -1);
1030 if (!bh) { 1030 if (!bh) {
1031 ext3_warning(sb, __FUNCTION__, 1031 ext3_warning(sb, __func__,
1032 "can't read last block, resize aborted"); 1032 "can't read last block, resize aborted");
1033 return -ENOSPC; 1033 return -ENOSPC;
1034 } 1034 }
@@ -1040,13 +1040,13 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1040 handle = ext3_journal_start_sb(sb, 3); 1040 handle = ext3_journal_start_sb(sb, 3);
1041 if (IS_ERR(handle)) { 1041 if (IS_ERR(handle)) {
1042 err = PTR_ERR(handle); 1042 err = PTR_ERR(handle);
1043 ext3_warning(sb, __FUNCTION__, "error %d on journal start",err); 1043 ext3_warning(sb, __func__, "error %d on journal start",err);
1044 goto exit_put; 1044 goto exit_put;
1045 } 1045 }
1046 1046
1047 lock_super(sb); 1047 lock_super(sb);
1048 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) { 1048 if (o_blocks_count != le32_to_cpu(es->s_blocks_count)) {
1049 ext3_warning(sb, __FUNCTION__, 1049 ext3_warning(sb, __func__,
1050 "multiple resizers run on filesystem!"); 1050 "multiple resizers run on filesystem!");
1051 unlock_super(sb); 1051 unlock_super(sb);
1052 ext3_journal_stop(handle); 1052 ext3_journal_stop(handle);
@@ -1056,7 +1056,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1056 1056
1057 if ((err = ext3_journal_get_write_access(handle, 1057 if ((err = ext3_journal_get_write_access(handle,
1058 EXT3_SB(sb)->s_sbh))) { 1058 EXT3_SB(sb)->s_sbh))) {
1059 ext3_warning(sb, __FUNCTION__, 1059 ext3_warning(sb, __func__,
1060 "error %d on journal write access", err); 1060 "error %d on journal write access", err);
1061 unlock_super(sb); 1061 unlock_super(sb);
1062 ext3_journal_stop(handle); 1062 ext3_journal_stop(handle);