Lines Matching refs:super
127 fs->super->s_state |= EXT2_ERROR_FS; in resize_fs()
169 *new_size = ext2fs_blocks_count(rfs->new_fs->super); in resize_fs()
180 ext2fs_free_blocks_count(rfs->old_fs->super), in resize_fs()
181 ext2fs_free_blocks_count(rfs->new_fs->super), in resize_fs()
235 rfs->new_fs->super->s_state &= ~EXT2_ERROR_FS; in resize_fs()
271 if (ext2fs_has_feature_resize_inode(fs->super) && in adjust_reserved_gdt_blocks()
275 new = ((int) fs->super->s_reserved_gdt_blocks) + in adjust_reserved_gdt_blocks()
281 fs->super->s_reserved_gdt_blocks = new; in adjust_reserved_gdt_blocks()
296 if (new_size != ext2fs_blocks_count(rfs->new_fs->super) || in resize_group_descriptors()
297 ext2fs_blocks_count(rfs->new_fs->super) >= (1ULL << 32) || in resize_group_descriptors()
303 ext2fs_clear_feature_64bit(rfs->new_fs->super); in resize_group_descriptors()
304 rfs->new_fs->super->s_desc_size = EXT2_MIN_DESC_SIZE; in resize_group_descriptors()
306 ext2fs_set_feature_64bit(rfs->new_fs->super); in resize_group_descriptors()
307 rfs->new_fs->super->s_desc_size = EXT2_MIN_DESC_SIZE_64BIT; in resize_group_descriptors()
310 if (EXT2_DESC_SIZE(rfs->old_fs->super) == in resize_group_descriptors()
311 EXT2_DESC_SIZE(rfs->new_fs->super)) in resize_group_descriptors()
317 EXT2_DESC_PER_BLOCK(rfs->new_fs->super)); in resize_group_descriptors()
325 if (EXT2_DESC_SIZE(rfs->old_fs->super) <= in resize_group_descriptors()
326 EXT2_DESC_SIZE(rfs->new_fs->super)) in resize_group_descriptors()
327 copy_size = EXT2_DESC_SIZE(rfs->old_fs->super); in resize_group_descriptors()
329 copy_size = EXT2_DESC_SIZE(rfs->new_fs->super); in resize_group_descriptors()
332 n = (char *)n + EXT2_DESC_SIZE(rfs->new_fs->super); in resize_group_descriptors()
333 o = (char *)o + EXT2_DESC_SIZE(rfs->old_fs->super); in resize_group_descriptors()
368 if (ext2fs_has_feature_meta_bg(rfs->old_fs->super)) { in move_bg_metadata()
369 old_desc_blocks = rfs->old_fs->super->s_first_meta_bg; in move_bg_metadata()
370 new_desc_blocks = rfs->new_fs->super->s_first_meta_bg; in move_bg_metadata()
373 rfs->old_fs->super->s_reserved_gdt_blocks; in move_bg_metadata()
375 rfs->new_fs->super->s_reserved_gdt_blocks; in move_bg_metadata()
407 rfs->old_fs->super->s_first_data_block); in move_bg_metadata()
408 b < ext2fs_blocks_count(rfs->new_fs->super); in move_bg_metadata()
461 cluster_ratio > 1 && b < ext2fs_blocks_count(rfs->new_fs->super); in move_bg_metadata()
515 int length = EXT2_INODE_SIZE(fs->super); in zero_high_bits_in_inodes()
524 if (fs->super->s_creator_os == EXT2_OS_HURD) in zero_high_bits_in_inodes()
655 (blk < ext2fs_blocks_count(fs->super)) && in free_gdp_blocks()
663 (blk < ext2fs_blocks_count(fs->super)) && in free_gdp_blocks()
672 if (blk >= ext2fs_blocks_count(fs->super) || in free_gdp_blocks()
705 ext2fs_blocks_count_set(fs->super, new_size); in adjust_fs_info()
708 fs->group_desc_count = ext2fs_div64_ceil(ext2fs_blocks_count(fs->super) - in adjust_fs_info()
709 fs->super->s_first_data_block, in adjust_fs_info()
710 EXT2_BLOCKS_PER_GROUP(fs->super)); in adjust_fs_info()
714 EXT2_DESC_PER_BLOCK(fs->super)); in adjust_fs_info()
725 if (ext2fs_has_feature_sparse_super2(fs->super)) { in adjust_fs_info()
731 has_bg = fs->super->s_backup_bgs[0] != 0; in adjust_fs_info()
733 has_bg = fs->super->s_backup_bgs[1] != 0; in adjust_fs_info()
738 fs->super->s_reserved_gdt_blocks; in adjust_fs_info()
745 rem = (ext2fs_blocks_count(fs->super) - fs->super->s_first_data_block) % in adjust_fs_info()
746 fs->super->s_blocks_per_group; in adjust_fs_info()
750 ext2fs_blocks_count_set(fs->super, in adjust_fs_info()
751 ext2fs_blocks_count(fs->super) - rem); in adjust_fs_info()
757 new_inodes =(unsigned long long) fs->super->s_inodes_per_group * fs->group_desc_count; in adjust_fs_info()
763 fs->super->s_inodes_count = fs->super->s_inodes_per_group * in adjust_fs_info()
769 blk = ext2fs_blocks_count(old_fs->super); in adjust_fs_info()
770 if (blk > ext2fs_blocks_count(fs->super)) in adjust_fs_info()
771 ext2fs_free_blocks_count_set(fs->super, in adjust_fs_info()
772 ext2fs_free_blocks_count(fs->super) - in adjust_fs_info()
773 (blk - ext2fs_blocks_count(fs->super))); in adjust_fs_info()
775 ext2fs_free_blocks_count_set(fs->super, in adjust_fs_info()
776 ext2fs_free_blocks_count(fs->super) + in adjust_fs_info()
777 (ext2fs_blocks_count(fs->super) - blk)); in adjust_fs_info()
782 percent = (ext2fs_r_blocks_count(old_fs->super) * 100.0) / in adjust_fs_info()
783 ext2fs_blocks_count(old_fs->super); in adjust_fs_info()
784 ext2fs_r_blocks_count_set(fs->super, in adjust_fs_info()
785 (percent * ext2fs_blocks_count(fs->super) / in adjust_fs_info()
791 retval = ext2fs_resize_inode_bitmap2(fs->super->s_inodes_count, in adjust_fs_info()
792 fs->super->s_inodes_count, in adjust_fs_info()
796 real_end = EXT2_GROUPS_TO_BLOCKS(fs->super, fs->group_desc_count) - 1 + in adjust_fs_info()
797 fs->super->s_first_data_block; in adjust_fs_info()
806 if (reserve_blocks && new_size > ext2fs_blocks_count(old_fs->super)) { in adjust_fs_info()
815 if (EXT2_DESC_SIZE(old_fs->super) == EXT2_DESC_SIZE(fs->super) && in adjust_fs_info()
838 if (EXT2_DESC_SIZE(old_fs->super) == EXT2_DESC_SIZE(fs->super)) in adjust_fs_info()
841 if (ext2fs_has_feature_meta_bg(fs->super) && in adjust_fs_info()
842 (fs->super->s_first_meta_bg > fs->desc_blocks)) { in adjust_fs_info()
843 ext2fs_clear_feature_meta_bg(fs->super); in adjust_fs_info()
844 fs->super->s_first_meta_bg = 0; in adjust_fs_info()
851 if (ext2fs_has_feature_sparse_super2(fs->super)) { in adjust_fs_info()
857 fs->super->s_backup_bgs[0] = 1; in adjust_fs_info()
860 fs->super->s_backup_bgs[1]) in adjust_fs_info()
861 fs->super->s_backup_bgs[1] = last_bg; in adjust_fs_info()
863 if (fs->super->s_backup_bgs[0] > last_bg) in adjust_fs_info()
864 fs->super->s_backup_bgs[0] = 0; in adjust_fs_info()
865 if (fs->super->s_backup_bgs[1] > last_bg) in adjust_fs_info()
866 fs->super->s_backup_bgs[1] = 0; in adjust_fs_info()
868 old_fs->super->s_backup_bgs[1] == old_last_bg) in adjust_fs_info()
869 fs->super->s_backup_bgs[1] = last_bg; in adjust_fs_info()
890 old_numblocks = (ext2fs_blocks_count(old_fs->super) - in adjust_fs_info()
891 old_fs->super->s_first_data_block) % in adjust_fs_info()
892 old_fs->super->s_blocks_per_group; in adjust_fs_info()
894 old_numblocks = old_fs->super->s_blocks_per_group; in adjust_fs_info()
896 numblocks = (ext2fs_blocks_count(fs->super) - in adjust_fs_info()
897 fs->super->s_first_data_block) % in adjust_fs_info()
898 fs->super->s_blocks_per_group; in adjust_fs_info()
900 numblocks = fs->super->s_blocks_per_group; in adjust_fs_info()
902 numblocks = fs->super->s_blocks_per_group; in adjust_fs_info()
927 if (ext2fs_has_feature_meta_bg(fs->super)) in adjust_fs_info()
928 old_desc_blocks = fs->super->s_first_meta_bg; in adjust_fs_info()
931 fs->super->s_reserved_gdt_blocks; in adjust_fs_info()
954 fs->super->s_inodes_per_group); in adjust_fs_info()
966 meta_bg_size = EXT2_DESC_PER_BLOCK(fs->super); in adjust_fs_info()
968 if (!ext2fs_has_feature_meta_bg(fs->super) || in adjust_fs_info()
969 (meta_bg < fs->super->s_first_meta_bg)) { in adjust_fs_info()
989 ext2fs_free_blocks_count_set(fs->super, in adjust_fs_info()
990 ext2fs_free_blocks_count(fs->super) - adjblocks); in adjust_fs_info()
991 fs->super->s_free_inodes_count += in adjust_fs_info()
992 fs->super->s_inodes_per_group; in adjust_fs_info()
995 fs->super->s_inodes_per_group); in adjust_fs_info()
1002 group_block += fs->super->s_blocks_per_group; in adjust_fs_info()
1050 if ((rfs->old_fs->super->s_inodes_count - in adjust_superblock()
1051 rfs->old_fs->super->s_free_inodes_count) > in adjust_superblock()
1052 rfs->new_fs->super->s_inodes_count) { in adjust_superblock()
1123 group_block += fs->super->s_blocks_per_group; in adjust_superblock()
1216 if (ext2fs_has_feature_flex_bg(fs->super)) { in mark_fs_metablock()
1274 if (ext2fs_blocks_count(old_fs->super) > ext2fs_blocks_count(fs->super)) in blocks_to_move()
1299 new_size = ext2fs_blocks_count(fs->super); in blocks_to_move()
1300 if (new_size < ext2fs_blocks_count(old_fs->super)) { in blocks_to_move()
1333 for (blk = ext2fs_blocks_count(fs->super); in blocks_to_move()
1334 blk < ext2fs_blocks_count(old_fs->super); blk++) { in blocks_to_move()
1353 if (ext2fs_has_feature_meta_bg(old_fs->super)) in blocks_to_move()
1354 old_blocks = old_fs->super->s_first_meta_bg; in blocks_to_move()
1357 old_fs->super->s_reserved_gdt_blocks; in blocks_to_move()
1358 if (ext2fs_has_feature_meta_bg(fs->super)) in blocks_to_move()
1359 new_blocks = fs->super->s_first_meta_bg; in blocks_to_move()
1361 new_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; in blocks_to_move()
1367 if (EXT2_DESC_SIZE(rfs->old_fs->super) == in blocks_to_move()
1368 EXT2_DESC_SIZE(rfs->new_fs->super) && in blocks_to_move()
1377 group_blk = old_fs->super->s_first_data_block; in blocks_to_move()
1398 group_blk += fs->super->s_blocks_per_group; in blocks_to_move()
1421 group_blk += fs->super->s_blocks_per_group; in blocks_to_move()
1430 meta_bg_size = EXT2_DESC_PER_BLOCK(fs->super); in blocks_to_move()
1431 flex_bg = ext2fs_has_feature_flex_bg(fs->super); in blocks_to_move()
1439 if (!ext2fs_has_feature_meta_bg(fs->super) || in blocks_to_move()
1440 (meta_bg < fs->super->s_first_meta_bg)) { in blocks_to_move()
1490 group_blk += rfs->new_fs->super->s_blocks_per_group; in blocks_to_move()
1591 rfs->new_blk = rfs->new_fs->super->s_first_data_block; in init_block_alloc()
1594 if (ext2fs_blocks_count(rfs->new_fs->super) > in init_block_alloc()
1595 ext2fs_blocks_count(rfs->old_fs->super)) in init_block_alloc()
1596 rfs->new_blk = ext2fs_blocks_count(rfs->old_fs->super); in init_block_alloc()
1605 if (rfs->new_blk >= ext2fs_blocks_count(fs->super)) { in get_new_block()
1615 rfs->new_blk = fs->super->s_first_data_block; in get_new_block()
1622 (rfs->new_blk < ext2fs_blocks_count(rfs->old_fs->super)) && in get_new_block()
1679 new_blk = fs->super->s_first_data_block; in block_mover()
1697 for (blk = B2C(old_fs->super->s_first_data_block); in block_mover()
1698 blk < ext2fs_blocks_count(old_fs->super); in block_mover()
1910 if (ext2fs_has_feature_metadata_csum(rfs->new_fs->super)) { in migrate_ea_block()
2008 int inode_size = EXT2_INODE_SIZE(fs->super); in fix_ea_inode_refs()
2105 rfs->new_fs->super->s_inodes_per_group); in inode_scan_and_fix()
2117 new_inode = EXT2_FIRST_INODE(rfs->new_fs->super); in inode_scan_and_fix()
2118 inode_size = EXT2_INODE_SIZE(rfs->new_fs->super); in inode_scan_and_fix()
2224 if (ext2fs_has_feature_metadata_csum(rfs->old_fs->super) && in inode_scan_and_fix()
2234 ext2fs_has_feature_ea_inode(rfs->new_fs->super)) { in inode_scan_and_fix()
2297 if (ext2fs_has_feature_metadata_csum(is->rfs->old_fs->super) && in check_and_change_inodes()
2485 n = n >> EXT2_BLOCK_SIZE_BITS(fs->super); in move_itables()
2567 if (!ext2fs_has_feature_sparse_super2(fs->super)) in clear_sparse_super2_last_group()
2573 if (fs->super->s_backup_bgs[0] == old_fs->super->s_backup_bgs[0] && in clear_sparse_super2_last_group()
2574 fs->super->s_backup_bgs[1] == old_fs->super->s_backup_bgs[1]) in clear_sparse_super2_last_group()
2577 if (old_fs->super->s_backup_bgs[0] != old_last_bg && in clear_sparse_super2_last_group()
2578 old_fs->super->s_backup_bgs[1] != old_last_bg) in clear_sparse_super2_last_group()
2581 if (fs->super->s_backup_bgs[0] == old_last_bg || in clear_sparse_super2_last_group()
2582 fs->super->s_backup_bgs[1] == old_last_bg) in clear_sparse_super2_last_group()
2620 if (!ext2fs_has_feature_sparse_super2(fs->super)) in reserve_sparse_super2_last_group()
2626 if (fs->super->s_backup_bgs[0] == old_fs->super->s_backup_bgs[0] && in reserve_sparse_super2_last_group()
2627 fs->super->s_backup_bgs[1] == old_fs->super->s_backup_bgs[1]) in reserve_sparse_super2_last_group()
2630 if (fs->super->s_backup_bgs[0] != last_bg && in reserve_sparse_super2_last_group()
2631 fs->super->s_backup_bgs[1] != last_bg) in reserve_sparse_super2_last_group()
2634 if (old_fs->super->s_backup_bgs[0] == last_bg || in reserve_sparse_super2_last_group()
2635 old_fs->super->s_backup_bgs[1] == last_bg) in reserve_sparse_super2_last_group()
2704 if (!ext2fs_has_feature_resize_inode(fs->super)) in fix_resize_inode()
2761 if (ext2fs_has_feature_meta_bg(fs->super)) in ext2fs_calculate_summary_stats()
2762 old_desc_blocks = fs->super->s_first_meta_bg; in ext2fs_calculate_summary_stats()
2765 fs->super->s_reserved_gdt_blocks; in ext2fs_calculate_summary_stats()
2766 for (blk = B2C(fs->super->s_first_data_block); in ext2fs_calculate_summary_stats()
2767 blk < ext2fs_blocks_count(fs->super); in ext2fs_calculate_summary_stats()
2785 if ((count == fs->super->s_clusters_per_group) || in ext2fs_calculate_summary_stats()
2786 EQ_CLSTR(blk, ext2fs_blocks_count(fs->super)-1)) { in ext2fs_calculate_summary_stats()
2798 if (ext2fs_has_feature_meta_bg(fs->super)) in ext2fs_calculate_summary_stats()
2799 old_desc_blocks = fs->super->s_first_meta_bg; in ext2fs_calculate_summary_stats()
2802 fs->super->s_reserved_gdt_blocks; in ext2fs_calculate_summary_stats()
2806 ext2fs_free_blocks_count_set(fs->super, total_blocks_free); in ext2fs_calculate_summary_stats()
2817 for (ino = 1; ino <= fs->super->s_inodes_count && ino > 0; ino++) { in ext2fs_calculate_summary_stats()
2824 if ((count == fs->super->s_inodes_per_group) || in ext2fs_calculate_summary_stats()
2825 (ino == fs->super->s_inodes_count)) { in ext2fs_calculate_summary_stats()
2836 fs->super->s_free_inodes_count = total_inodes_free; in ext2fs_calculate_summary_stats()
2850 if (!ext2fs_has_feature_journal(fs->super)) in fix_sb_journal_backup()
2854 if (fs->super->s_journal_dev && !fs->super->s_journal_inum) in fix_sb_journal_backup()
2857 retval = ext2fs_read_inode(fs, fs->super->s_journal_inum, &inode); in fix_sb_journal_backup()
2860 memcpy(fs->super->s_jnl_blocks, inode.i_block, EXT2_N_BLOCKS*4); in fix_sb_journal_backup()
2861 fs->super->s_jnl_blocks[15] = inode.i_size_high; in fix_sb_journal_backup()
2862 fs->super->s_jnl_blocks[16] = inode.i_size; in fix_sb_journal_backup()
2863 fs->super->s_jnl_backup_type = EXT3_JNL_BACKUP_BLOCKS; in fix_sb_journal_backup()
2900 int flexbg_size = 1 << fs->super->s_log_groups_per_flex; in calculate_minimum_resize_size()
2906 inode_count = fs->super->s_inodes_count - in calculate_minimum_resize_size()
2907 fs->super->s_free_inodes_count; in calculate_minimum_resize_size()
2909 fs->super->s_inodes_per_group) * in calculate_minimum_resize_size()
2910 (blk64_t) EXT2_BLOCKS_PER_GROUP(fs->super); in calculate_minimum_resize_size()
2912 EXT2_BLOCKS_PER_GROUP(fs->super)); in calculate_minimum_resize_size()
2922 if (ext2fs_has_feature_meta_bg(fs->super)) in calculate_minimum_resize_size()
2923 old_desc_blocks = fs->super->s_first_meta_bg; in calculate_minimum_resize_size()
2926 fs->super->s_reserved_gdt_blocks; in calculate_minimum_resize_size()
2929 data_needed = ext2fs_blocks_count(fs->super) - in calculate_minimum_resize_size()
2930 ext2fs_free_blocks_count(fs->super); in calculate_minimum_resize_size()
2945 if (ext2fs_has_feature_flex_bg(fs->super)) { in calculate_minimum_resize_size()
2957 data_blocks = EXT2_GROUPS_TO_BLOCKS(fs->super, groups); in calculate_minimum_resize_size()
2968 last_start += EXT2_BLOCKS_PER_GROUP(fs->super) - in calculate_minimum_resize_size()
2993 EXT2_BLOCKS_PER_GROUP(fs->super)); in calculate_minimum_resize_size()
2995 data_blocks += EXT2_GROUPS_TO_BLOCKS(fs->super, extra_grps); in calculate_minimum_resize_size()
2999 last_start += EXT2_BLOCKS_PER_GROUP(fs->super) - overhead; in calculate_minimum_resize_size()
3003 if (!ext2fs_has_feature_flex_bg(fs->super)) in calculate_minimum_resize_size()
3022 last_start += EXT2_BLOCKS_PER_GROUP(fs->super) in calculate_minimum_resize_size()
3039 if (ext2fs_has_feature_flex_bg(fs->super) && in calculate_minimum_resize_size()
3076 overhead += fs->super->s_first_data_block; in calculate_minimum_resize_size()
3092 blks_needed = EXT2_GROUPS_TO_BLOCKS(fs->super, groups - 1); in calculate_minimum_resize_size()
3113 if (blks_needed >= ext2fs_blocks_count(fs->super)) in calculate_minimum_resize_size()
3114 return ext2fs_blocks_count(fs->super); in calculate_minimum_resize_size()
3125 if (ext2fs_has_feature_extents(fs->super)) { in calculate_minimum_resize_size()
3126 blk64_t safe_margin = (ext2fs_blocks_count(fs->super) - in calculate_minimum_resize_size()