diff options
Diffstat (limited to 'fs/ext4/resize.c')
-rw-r--r-- | fs/ext4/resize.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 728e3efa84b5..3e0f5d06f3ee 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -50,63 +50,63 @@ static int verify_group_input(struct super_block *sb, | |||
50 | 50 | ||
51 | ext4_get_group_no_and_offset(sb, start, NULL, &offset); | 51 | ext4_get_group_no_and_offset(sb, start, NULL, &offset); |
52 | if (group != sbi->s_groups_count) | 52 | if (group != sbi->s_groups_count) |
53 | ext4_warning(sb, __FUNCTION__, | 53 | ext4_warning(sb, __func__, |
54 | "Cannot add at group %u (only %lu groups)", | 54 | "Cannot add at group %u (only %lu groups)", |
55 | input->group, sbi->s_groups_count); | 55 | input->group, sbi->s_groups_count); |
56 | else if (offset != 0) | 56 | else if (offset != 0) |
57 | ext4_warning(sb, __FUNCTION__, "Last group not full"); | 57 | ext4_warning(sb, __func__, "Last group not full"); |
58 | else if (input->reserved_blocks > input->blocks_count / 5) | 58 | else if (input->reserved_blocks > input->blocks_count / 5) |
59 | ext4_warning(sb, __FUNCTION__, "Reserved blocks too high (%u)", | 59 | ext4_warning(sb, __func__, "Reserved blocks too high (%u)", |
60 | input->reserved_blocks); | 60 | input->reserved_blocks); |
61 | else if (free_blocks_count < 0) | 61 | else if (free_blocks_count < 0) |
62 | ext4_warning(sb, __FUNCTION__, "Bad blocks count %u", | 62 | ext4_warning(sb, __func__, "Bad blocks count %u", |
63 | input->blocks_count); | 63 | input->blocks_count); |
64 | else if (!(bh = sb_bread(sb, end - 1))) | 64 | else if (!(bh = sb_bread(sb, end - 1))) |
65 | ext4_warning(sb, __FUNCTION__, | 65 | ext4_warning(sb, __func__, |
66 | "Cannot read last block (%llu)", | 66 | "Cannot read last block (%llu)", |
67 | end - 1); | 67 | end - 1); |
68 | else if (outside(input->block_bitmap, start, end)) | 68 | else if (outside(input->block_bitmap, start, end)) |
69 | ext4_warning(sb, __FUNCTION__, | 69 | ext4_warning(sb, __func__, |
70 | "Block bitmap not in group (block %llu)", | 70 | "Block bitmap not in group (block %llu)", |
71 | (unsigned long long)input->block_bitmap); | 71 | (unsigned long long)input->block_bitmap); |
72 | else if (outside(input->inode_bitmap, start, end)) | 72 | else if (outside(input->inode_bitmap, start, end)) |
73 | ext4_warning(sb, __FUNCTION__, | 73 | ext4_warning(sb, __func__, |
74 | "Inode bitmap not in group (block %llu)", | 74 | "Inode bitmap not in group (block %llu)", |
75 | (unsigned long long)input->inode_bitmap); | 75 | (unsigned long long)input->inode_bitmap); |
76 | else if (outside(input->inode_table, start, end) || | 76 | else if (outside(input->inode_table, start, end) || |
77 | outside(itend - 1, start, end)) | 77 | outside(itend - 1, start, end)) |
78 | ext4_warning(sb, __FUNCTION__, | 78 | ext4_warning(sb, __func__, |
79 | "Inode table not in group (blocks %llu-%llu)", | 79 | "Inode table not in group (blocks %llu-%llu)", |
80 | (unsigned long long)input->inode_table, itend - 1); | 80 | (unsigned long long)input->inode_table, itend - 1); |
81 | else if (input->inode_bitmap == input->block_bitmap) | 81 | else if (input->inode_bitmap == input->block_bitmap) |
82 | ext4_warning(sb, __FUNCTION__, | 82 | ext4_warning(sb, __func__, |
83 | "Block bitmap same as inode bitmap (%llu)", | 83 | "Block bitmap same as inode bitmap (%llu)", |
84 | (unsigned long long)input->block_bitmap); | 84 | (unsigned long long)input->block_bitmap); |
85 | else if (inside(input->block_bitmap, input->inode_table, itend)) | 85 | else if (inside(input->block_bitmap, input->inode_table, itend)) |
86 | ext4_warning(sb, __FUNCTION__, | 86 | ext4_warning(sb, __func__, |
87 | "Block bitmap (%llu) in inode table (%llu-%llu)", | 87 | "Block bitmap (%llu) in inode table (%llu-%llu)", |
88 | (unsigned long long)input->block_bitmap, | 88 | (unsigned long long)input->block_bitmap, |
89 | (unsigned long long)input->inode_table, itend - 1); | 89 | (unsigned long long)input->inode_table, itend - 1); |
90 | else if (inside(input->inode_bitmap, input->inode_table, itend)) | 90 | else if (inside(input->inode_bitmap, input->inode_table, itend)) |
91 | ext4_warning(sb, __FUNCTION__, | 91 | ext4_warning(sb, __func__, |
92 | "Inode bitmap (%llu) in inode table (%llu-%llu)", | 92 | "Inode bitmap (%llu) in inode table (%llu-%llu)", |
93 | (unsigned long long)input->inode_bitmap, | 93 | (unsigned long long)input->inode_bitmap, |
94 | (unsigned long long)input->inode_table, itend - 1); | 94 | (unsigned long long)input->inode_table, itend - 1); |
95 | else if (inside(input->block_bitmap, start, metaend)) | 95 | else if (inside(input->block_bitmap, start, metaend)) |
96 | ext4_warning(sb, __FUNCTION__, | 96 | ext4_warning(sb, __func__, |
97 | "Block bitmap (%llu) in GDT table" | 97 | "Block bitmap (%llu) in GDT table" |
98 | " (%llu-%llu)", | 98 | " (%llu-%llu)", |
99 | (unsigned long long)input->block_bitmap, | 99 | (unsigned long long)input->block_bitmap, |
100 | start, metaend - 1); | 100 | start, metaend - 1); |
101 | else if (inside(input->inode_bitmap, start, metaend)) | 101 | else if (inside(input->inode_bitmap, start, metaend)) |
102 | ext4_warning(sb, __FUNCTION__, | 102 | ext4_warning(sb, __func__, |
103 | "Inode bitmap (%llu) in GDT table" | 103 | "Inode bitmap (%llu) in GDT table" |
104 | " (%llu-%llu)", | 104 | " (%llu-%llu)", |
105 | (unsigned long long)input->inode_bitmap, | 105 | (unsigned long long)input->inode_bitmap, |
106 | start, metaend - 1); | 106 | start, metaend - 1); |
107 | else if (inside(input->inode_table, start, metaend) || | 107 | else if (inside(input->inode_table, start, metaend) || |
108 | inside(itend - 1, start, metaend)) | 108 | inside(itend - 1, start, metaend)) |
109 | ext4_warning(sb, __FUNCTION__, | 109 | ext4_warning(sb, __func__, |
110 | "Inode table (%llu-%llu) overlaps" | 110 | "Inode table (%llu-%llu) overlaps" |
111 | "GDT table (%llu-%llu)", | 111 | "GDT table (%llu-%llu)", |
112 | (unsigned long long)input->inode_table, | 112 | (unsigned long long)input->inode_table, |
@@ -368,7 +368,7 @@ static int verify_reserved_gdb(struct super_block *sb, | |||
368 | while ((grp = ext4_list_backups(sb, &three, &five, &seven)) < end) { | 368 | while ((grp = ext4_list_backups(sb, &three, &five, &seven)) < end) { |
369 | if (le32_to_cpu(*p++) != | 369 | if (le32_to_cpu(*p++) != |
370 | grp * EXT4_BLOCKS_PER_GROUP(sb) + blk){ | 370 | grp * EXT4_BLOCKS_PER_GROUP(sb) + blk){ |
371 | ext4_warning(sb, __FUNCTION__, | 371 | ext4_warning(sb, __func__, |
372 | "reserved GDT %llu" | 372 | "reserved GDT %llu" |
373 | " missing grp %d (%llu)", | 373 | " missing grp %d (%llu)", |
374 | blk, grp, | 374 | blk, grp, |
@@ -424,7 +424,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
424 | */ | 424 | */ |
425 | if (EXT4_SB(sb)->s_sbh->b_blocknr != | 425 | if (EXT4_SB(sb)->s_sbh->b_blocknr != |
426 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { | 426 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { |
427 | ext4_warning(sb, __FUNCTION__, | 427 | ext4_warning(sb, __func__, |
428 | "won't resize using backup superblock at %llu", | 428 | "won't resize using backup superblock at %llu", |
429 | (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr); | 429 | (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr); |
430 | return -EPERM; | 430 | return -EPERM; |
@@ -448,7 +448,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
448 | 448 | ||
449 | data = (__le32 *)dind->b_data; | 449 | data = (__le32 *)dind->b_data; |
450 | if (le32_to_cpu(data[gdb_num % EXT4_ADDR_PER_BLOCK(sb)]) != gdblock) { | 450 | if (le32_to_cpu(data[gdb_num % EXT4_ADDR_PER_BLOCK(sb)]) != gdblock) { |
451 | ext4_warning(sb, __FUNCTION__, | 451 | ext4_warning(sb, __func__, |
452 | "new group %u GDT block %llu not reserved", | 452 | "new group %u GDT block %llu not reserved", |
453 | input->group, gdblock); | 453 | input->group, gdblock); |
454 | err = -EINVAL; | 454 | err = -EINVAL; |
@@ -472,7 +472,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, | |||
472 | GFP_KERNEL); | 472 | GFP_KERNEL); |
473 | if (!n_group_desc) { | 473 | if (!n_group_desc) { |
474 | err = -ENOMEM; | 474 | err = -ENOMEM; |
475 | ext4_warning (sb, __FUNCTION__, | 475 | ext4_warning(sb, __func__, |
476 | "not enough memory for %lu groups", gdb_num + 1); | 476 | "not enough memory for %lu groups", gdb_num + 1); |
477 | goto exit_inode; | 477 | goto exit_inode; |
478 | } | 478 | } |
@@ -570,7 +570,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
570 | /* Get each reserved primary GDT block and verify it holds backups */ | 570 | /* Get each reserved primary GDT block and verify it holds backups */ |
571 | for (res = 0; res < reserved_gdb; res++, blk++) { | 571 | for (res = 0; res < reserved_gdb; res++, blk++) { |
572 | if (le32_to_cpu(*data) != blk) { | 572 | if (le32_to_cpu(*data) != blk) { |
573 | ext4_warning(sb, __FUNCTION__, | 573 | ext4_warning(sb, __func__, |
574 | "reserved block %llu" | 574 | "reserved block %llu" |
575 | " not at offset %ld", | 575 | " not at offset %ld", |
576 | blk, | 576 | blk, |
@@ -714,7 +714,7 @@ static void update_backups(struct super_block *sb, | |||
714 | */ | 714 | */ |
715 | exit_err: | 715 | exit_err: |
716 | if (err) { | 716 | if (err) { |
717 | ext4_warning(sb, __FUNCTION__, | 717 | ext4_warning(sb, __func__, |
718 | "can't update backup for group %lu (err %d), " | 718 | "can't update backup for group %lu (err %d), " |
719 | "forcing fsck on next reboot", group, err); | 719 | "forcing fsck on next reboot", group, err); |
720 | sbi->s_mount_state &= ~EXT4_VALID_FS; | 720 | sbi->s_mount_state &= ~EXT4_VALID_FS; |
@@ -754,33 +754,33 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) | |||
754 | 754 | ||
755 | if (gdb_off == 0 && !EXT4_HAS_RO_COMPAT_FEATURE(sb, | 755 | if (gdb_off == 0 && !EXT4_HAS_RO_COMPAT_FEATURE(sb, |
756 | EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER)) { | 756 | EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER)) { |
757 | ext4_warning(sb, __FUNCTION__, | 757 | ext4_warning(sb, __func__, |
758 | "Can't resize non-sparse filesystem further"); | 758 | "Can't resize non-sparse filesystem further"); |
759 | return -EPERM; | 759 | return -EPERM; |
760 | } | 760 | } |
761 | 761 | ||
762 | if (ext4_blocks_count(es) + input->blocks_count < | 762 | if (ext4_blocks_count(es) + input->blocks_count < |
763 | ext4_blocks_count(es)) { | 763 | ext4_blocks_count(es)) { |
764 | ext4_warning(sb, __FUNCTION__, "blocks_count overflow\n"); | 764 | ext4_warning(sb, __func__, "blocks_count overflow\n"); |
765 | return -EINVAL; | 765 | return -EINVAL; |
766 | } | 766 | } |
767 | 767 | ||
768 | if (le32_to_cpu(es->s_inodes_count) + EXT4_INODES_PER_GROUP(sb) < | 768 | if (le32_to_cpu(es->s_inodes_count) + EXT4_INODES_PER_GROUP(sb) < |
769 | le32_to_cpu(es->s_inodes_count)) { | 769 | le32_to_cpu(es->s_inodes_count)) { |
770 | ext4_warning(sb, __FUNCTION__, "inodes_count overflow\n"); | 770 | ext4_warning(sb, __func__, "inodes_count overflow\n"); |
771 | return -EINVAL; | 771 | return -EINVAL; |
772 | } | 772 | } |
773 | 773 | ||
774 | if (reserved_gdb || gdb_off == 0) { | 774 | if (reserved_gdb || gdb_off == 0) { |
775 | if (!EXT4_HAS_COMPAT_FEATURE(sb, | 775 | if (!EXT4_HAS_COMPAT_FEATURE(sb, |
776 | EXT4_FEATURE_COMPAT_RESIZE_INODE)){ | 776 | EXT4_FEATURE_COMPAT_RESIZE_INODE)){ |
777 | ext4_warning(sb, __FUNCTION__, | 777 | ext4_warning(sb, __func__, |
778 | "No reserved GDT blocks, can't resize"); | 778 | "No reserved GDT blocks, can't resize"); |
779 | return -EPERM; | 779 | return -EPERM; |
780 | } | 780 | } |
781 | inode = ext4_iget(sb, EXT4_RESIZE_INO); | 781 | inode = ext4_iget(sb, EXT4_RESIZE_INO); |
782 | if (IS_ERR(inode)) { | 782 | if (IS_ERR(inode)) { |
783 | ext4_warning(sb, __FUNCTION__, | 783 | ext4_warning(sb, __func__, |
784 | "Error opening resize inode"); | 784 | "Error opening resize inode"); |
785 | return PTR_ERR(inode); | 785 | return PTR_ERR(inode); |
786 | } | 786 | } |
@@ -809,7 +809,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) | |||
809 | 809 | ||
810 | lock_super(sb); | 810 | lock_super(sb); |
811 | if (input->group != sbi->s_groups_count) { | 811 | if (input->group != sbi->s_groups_count) { |
812 | ext4_warning(sb, __FUNCTION__, | 812 | ext4_warning(sb, __func__, |
813 | "multiple resizers run on filesystem!"); | 813 | "multiple resizers run on filesystem!"); |
814 | err = -EBUSY; | 814 | err = -EBUSY; |
815 | goto exit_journal; | 815 | goto exit_journal; |
@@ -975,13 +975,13 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
975 | " too large to resize to %llu blocks safely\n", | 975 | " too large to resize to %llu blocks safely\n", |
976 | sb->s_id, n_blocks_count); | 976 | sb->s_id, n_blocks_count); |
977 | if (sizeof(sector_t) < 8) | 977 | if (sizeof(sector_t) < 8) |
978 | ext4_warning(sb, __FUNCTION__, | 978 | ext4_warning(sb, __func__, |
979 | "CONFIG_LBD not enabled\n"); | 979 | "CONFIG_LBD not enabled\n"); |
980 | return -EINVAL; | 980 | return -EINVAL; |
981 | } | 981 | } |
982 | 982 | ||
983 | if (n_blocks_count < o_blocks_count) { | 983 | if (n_blocks_count < o_blocks_count) { |
984 | ext4_warning(sb, __FUNCTION__, | 984 | ext4_warning(sb, __func__, |
985 | "can't shrink FS - resize aborted"); | 985 | "can't shrink FS - resize aborted"); |
986 | return -EBUSY; | 986 | return -EBUSY; |
987 | } | 987 | } |
@@ -990,7 +990,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
990 | ext4_get_group_no_and_offset(sb, o_blocks_count, NULL, &last); | 990 | ext4_get_group_no_and_offset(sb, o_blocks_count, NULL, &last); |
991 | 991 | ||
992 | if (last == 0) { | 992 | if (last == 0) { |
993 | ext4_warning(sb, __FUNCTION__, | 993 | ext4_warning(sb, __func__, |
994 | "need to use ext2online to resize further"); | 994 | "need to use ext2online to resize further"); |
995 | return -EPERM; | 995 | return -EPERM; |
996 | } | 996 | } |
@@ -998,7 +998,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
998 | add = EXT4_BLOCKS_PER_GROUP(sb) - last; | 998 | add = EXT4_BLOCKS_PER_GROUP(sb) - last; |
999 | 999 | ||
1000 | if (o_blocks_count + add < o_blocks_count) { | 1000 | if (o_blocks_count + add < o_blocks_count) { |
1001 | ext4_warning(sb, __FUNCTION__, "blocks_count overflow"); | 1001 | ext4_warning(sb, __func__, "blocks_count overflow"); |
1002 | return -EINVAL; | 1002 | return -EINVAL; |
1003 | } | 1003 | } |
1004 | 1004 | ||
@@ -1006,7 +1006,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1006 | add = n_blocks_count - o_blocks_count; | 1006 | add = n_blocks_count - o_blocks_count; |
1007 | 1007 | ||
1008 | if (o_blocks_count + add < n_blocks_count) | 1008 | if (o_blocks_count + add < n_blocks_count) |
1009 | ext4_warning(sb, __FUNCTION__, | 1009 | ext4_warning(sb, __func__, |
1010 | "will only finish group (%llu" | 1010 | "will only finish group (%llu" |
1011 | " blocks, %u new)", | 1011 | " blocks, %u new)", |
1012 | o_blocks_count + add, add); | 1012 | o_blocks_count + add, add); |
@@ -1014,7 +1014,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1014 | /* See if the device is actually as big as what was requested */ | 1014 | /* See if the device is actually as big as what was requested */ |
1015 | bh = sb_bread(sb, o_blocks_count + add -1); | 1015 | bh = sb_bread(sb, o_blocks_count + add -1); |
1016 | if (!bh) { | 1016 | if (!bh) { |
1017 | ext4_warning(sb, __FUNCTION__, | 1017 | ext4_warning(sb, __func__, |
1018 | "can't read last block, resize aborted"); | 1018 | "can't read last block, resize aborted"); |
1019 | return -ENOSPC; | 1019 | return -ENOSPC; |
1020 | } | 1020 | } |
@@ -1026,13 +1026,13 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1026 | handle = ext4_journal_start_sb(sb, 3); | 1026 | handle = ext4_journal_start_sb(sb, 3); |
1027 | if (IS_ERR(handle)) { | 1027 | if (IS_ERR(handle)) { |
1028 | err = PTR_ERR(handle); | 1028 | err = PTR_ERR(handle); |
1029 | ext4_warning(sb, __FUNCTION__, "error %d on journal start",err); | 1029 | ext4_warning(sb, __func__, "error %d on journal start", err); |
1030 | goto exit_put; | 1030 | goto exit_put; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | lock_super(sb); | 1033 | lock_super(sb); |
1034 | if (o_blocks_count != ext4_blocks_count(es)) { | 1034 | if (o_blocks_count != ext4_blocks_count(es)) { |
1035 | ext4_warning(sb, __FUNCTION__, | 1035 | ext4_warning(sb, __func__, |
1036 | "multiple resizers run on filesystem!"); | 1036 | "multiple resizers run on filesystem!"); |
1037 | unlock_super(sb); | 1037 | unlock_super(sb); |
1038 | ext4_journal_stop(handle); | 1038 | ext4_journal_stop(handle); |
@@ -1042,7 +1042,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1042 | 1042 | ||
1043 | if ((err = ext4_journal_get_write_access(handle, | 1043 | if ((err = ext4_journal_get_write_access(handle, |
1044 | EXT4_SB(sb)->s_sbh))) { | 1044 | EXT4_SB(sb)->s_sbh))) { |
1045 | ext4_warning(sb, __FUNCTION__, | 1045 | ext4_warning(sb, __func__, |
1046 | "error %d on journal write access", err); | 1046 | "error %d on journal write access", err); |
1047 | unlock_super(sb); | 1047 | unlock_super(sb); |
1048 | ext4_journal_stop(handle); | 1048 | ext4_journal_stop(handle); |