Lines Matching refs:old_fs
115 rfs->old_fs = fs; in resize_fs()
180 ext2fs_free_blocks_count(rfs->old_fs->super), in resize_fs()
245 ext2fs_free(rfs->old_fs); in resize_fs()
246 rfs->old_fs = NULL; in resize_fs()
269 static void adjust_reserved_gdt_blocks(ext2_filsys old_fs, ext2_filsys fs) in adjust_reserved_gdt_blocks() argument
272 (old_fs->desc_blocks != fs->desc_blocks)) { in adjust_reserved_gdt_blocks()
276 (old_fs->desc_blocks - fs->desc_blocks); in adjust_reserved_gdt_blocks()
310 if (EXT2_DESC_SIZE(rfs->old_fs->super) == in resize_group_descriptors()
316 rfs->old_fs->group_desc_count, in resize_group_descriptors()
319 rfs->old_fs->blocksize, &new_group_desc); in resize_group_descriptors()
325 if (EXT2_DESC_SIZE(rfs->old_fs->super) <= in resize_group_descriptors()
327 copy_size = EXT2_DESC_SIZE(rfs->old_fs->super); in resize_group_descriptors()
330 for (i = 0; i < rfs->old_fs->group_desc_count; i++) { in resize_group_descriptors()
333 o = (char *)o + EXT2_DESC_SIZE(rfs->old_fs->super); in resize_group_descriptors()
339 for (i = 0; i < rfs->old_fs->group_desc_count; i++) in resize_group_descriptors()
342 adjust_reserved_gdt_blocks(rfs->old_fs, rfs->new_fs); in resize_group_descriptors()
360 retval = ext2fs_allocate_block_bitmap(rfs->old_fs, "oldfs", &old_map); in move_bg_metadata()
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()
372 old_desc_blocks = rfs->old_fs->desc_blocks + in move_bg_metadata()
373 rfs->old_fs->super->s_reserved_gdt_blocks; in move_bg_metadata()
379 for (i = 0; i < rfs->old_fs->group_desc_count; i++) { in move_bg_metadata()
380 retval = ext2fs_super_and_bgd_loc2(rfs->old_fs, i, &b, &c, &d, in move_bg_metadata()
406 for (b = EXT2FS_B2C(rfs->old_fs, in move_bg_metadata()
407 rfs->old_fs->super->s_first_data_block); in move_bg_metadata()
435 for (i = 0; i < rfs->old_fs->group_desc_count; i++) { in move_bg_metadata()
514 ext2_filsys fs = rfs->old_fs; in zero_high_bits_in_inodes()
631 ext2_filsys old_fs, in free_gdp_blocks() argument
639 dgrp_t count = old_fs->group_desc_count - fs->group_desc_count; in free_gdp_blocks()
653 blk = ext2fs_block_bitmap_loc(old_fs, i); in free_gdp_blocks()
661 blk = ext2fs_inode_bitmap_loc(old_fs, i); in free_gdp_blocks()
669 blk = ext2fs_inode_table_loc(old_fs, i); in free_gdp_blocks()
690 errcode_t adjust_fs_info(ext2_filsys fs, ext2_filsys old_fs, in adjust_fs_info() argument
769 blk = ext2fs_blocks_count(old_fs->super); 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()
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()
816 old_fs->desc_blocks != fs->desc_blocks) { in adjust_fs_info()
817 retval = ext2fs_resize_mem(old_fs->desc_blocks * in adjust_fs_info()
823 if (fs->desc_blocks > old_fs->desc_blocks) in adjust_fs_info()
825 (old_fs->desc_blocks * fs->blocksize), 0, in adjust_fs_info()
826 (fs->desc_blocks - old_fs->desc_blocks) * in adjust_fs_info()
838 if (EXT2_DESC_SIZE(old_fs->super) == EXT2_DESC_SIZE(fs->super)) in adjust_fs_info()
839 adjust_reserved_gdt_blocks(old_fs, fs); in adjust_fs_info()
853 dgrp_t old_last_bg = old_fs->group_desc_count - 1; in adjust_fs_info()
856 if (old_fs->group_desc_count == 1) in adjust_fs_info()
858 if ((old_fs->group_desc_count < 3 && in adjust_fs_info()
868 old_fs->super->s_backup_bgs[1] == old_last_bg) in adjust_fs_info()
877 if (old_fs->group_desc_count > fs->group_desc_count) { in adjust_fs_info()
882 retval = free_gdp_blocks(fs, reserve_blocks, old_fs, 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()
895 if (old_fs->group_desc_count == fs->group_desc_count) { in adjust_fs_info()
903 i = old_fs->group_desc_count - 1; in adjust_fs_info()
912 if (old_fs->group_desc_count >= fs->group_desc_count) { in adjust_fs_info()
921 old_fs->group_desc_count); in adjust_fs_info()
938 for (i = 0; i < old_fs->group_desc_count; i++) in adjust_fs_info()
941 for (i = old_fs->group_desc_count; in adjust_fs_info()
1043 retval = adjust_fs_info(fs, rfs->old_fs, rfs->reserve_blocks, new_size); in adjust_superblock()
1050 if ((rfs->old_fs->super->s_inodes_count - in adjust_superblock()
1051 rfs->old_fs->super->s_free_inodes_count) > in adjust_superblock()
1061 if (rfs->old_fs->group_desc_count > fs->group_desc_count) { in adjust_superblock()
1071 if (rfs->old_fs->group_desc_count >= fs->group_desc_count) { in adjust_superblock()
1096 rfs->old_fs->group_desc_count); in adjust_superblock()
1097 adj = rfs->old_fs->group_desc_count; in adjust_superblock()
1105 for (i = rfs->old_fs->group_desc_count; in adjust_superblock()
1219 for (i = 0; i < rfs->old_fs->group_desc_count; i++) { in mark_fs_metablock()
1245 } else if (ext2fs_test_block_bitmap2(rfs->old_fs->block_map, blk) && in mark_fs_metablock()
1268 ext2_filsys fs, old_fs; in blocks_to_move() local
1273 old_fs = rfs->old_fs; in blocks_to_move()
1274 if (ext2fs_blocks_count(old_fs->super) > ext2fs_blocks_count(fs->super)) in blocks_to_move()
1275 fs = rfs->old_fs; in blocks_to_move()
1287 retval = mark_table_blocks(old_fs, meta_bmap); in blocks_to_move()
1300 if (new_size < ext2fs_blocks_count(old_fs->super)) { in blocks_to_move()
1334 blk < ext2fs_blocks_count(old_fs->super); blk++) { in blocks_to_move()
1337 ext2fs_bg_flags_test(old_fs, g, EXT2_BG_BLOCK_UNINIT)) { in blocks_to_move()
1345 if (ext2fs_test_block_bitmap2(old_fs->block_map, 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()
1356 old_blocks = old_fs->desc_blocks + in blocks_to_move()
1357 old_fs->super->s_reserved_gdt_blocks; in blocks_to_move()
1367 if (EXT2_DESC_SIZE(rfs->old_fs->super) == in blocks_to_move()
1375 if (max_groups > old_fs->group_desc_count) in blocks_to_move()
1376 max_groups = old_fs->group_desc_count; in blocks_to_move()
1377 group_blk = old_fs->super->s_first_data_block; in blocks_to_move()
1397 if (!ext2fs_bg_has_super(old_fs, i)) { in blocks_to_move()
1470 else if (flex_bg && i < old_fs->group_desc_count) in blocks_to_move()
1472 ext2fs_block_bitmap_loc(old_fs, i)); in blocks_to_move()
1477 else if (flex_bg && i < old_fs->group_desc_count) in blocks_to_move()
1479 ext2fs_inode_bitmap_loc(old_fs, i)); in blocks_to_move()
1485 else if (flex_bg && i < old_fs->group_desc_count) in blocks_to_move()
1487 ext2fs_inode_table_loc(old_fs, i), in blocks_to_move()
1488 old_fs->inode_blocks_per_group); in blocks_to_move()
1509 if (ext2fs_block_bitmap_loc(old_fs, i) != in blocks_to_move()
1512 if (ext2fs_test_block_bitmap2(old_fs->block_map, blk) && in blocks_to_move()
1517 if (ext2fs_inode_bitmap_loc(old_fs, i) != in blocks_to_move()
1520 if (ext2fs_test_block_bitmap2(old_fs->block_map, blk) && in blocks_to_move()
1533 if (ext2fs_inode_table_loc(fs, i) == ext2fs_inode_table_loc(old_fs, i)) in blocks_to_move()
1546 if (ext2fs_test_block_bitmap2(old_fs->block_map, blk) && in blocks_to_move()
1556 for (blk = ext2fs_inode_table_loc(rfs->old_fs, i), j=0; in blocks_to_move()
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()
1622 (rfs->new_blk < ext2fs_blocks_count(rfs->old_fs->super)) && in get_new_block()
1623 ext2fs_test_block_bitmap2(rfs->old_fs->block_map, in get_new_block()
1649 ext2fs_mark_block_bitmap2(rfs->old_fs->block_map, blk); in resize2fs_get_alloc_block()
1652 group = ext2fs_group_of_blk2(rfs->old_fs, blk); in resize2fs_get_alloc_block()
1653 ext2fs_clear_block_uninit(rfs->old_fs, group); in resize2fs_get_alloc_block()
1665 ext2_filsys old_fs = rfs->old_fs; in block_mover() local
1673 old_fs->get_alloc_block = resize2fs_get_alloc_block; in block_mover()
1675 retval = ext2fs_read_bb_inode(old_fs, &badblock_list); 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()
1700 if (!ext2fs_test_block_bitmap2(old_fs->block_map, blk)) in block_mover()
1783 retval = ext2fs_update_bb_inode(old_fs, in block_mover()
1899 if (ext2fs_file_acl_block(rfs->old_fs, inode) == 0 || !rfs->bmap) in migrate_ea_block()
1901 new_block = extent_translate(rfs->old_fs, rfs->bmap, in migrate_ea_block()
1902 ext2fs_file_acl_block(rfs->old_fs, inode)); in migrate_ea_block()
1907 ext2fs_file_acl_block_set(rfs->old_fs, inode, new_block); in migrate_ea_block()
1911 err = ext2fs_get_mem(rfs->old_fs->blocksize, &buf); in migrate_ea_block()
1914 rfs->old_fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; in migrate_ea_block()
1915 err = ext2fs_read_ext_attr3(rfs->old_fs, new_block, buf, ino); in migrate_ea_block()
1916 rfs->old_fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; in migrate_ea_block()
1919 err = ext2fs_write_ext_attr3(rfs->old_fs, new_block, buf, ino); in migrate_ea_block()
2089 if ((rfs->old_fs->group_desc_count <= in inode_scan_and_fix()
2096 retval = ext2fs_open_inode_scan(rfs->old_fs, 0, &scan); in inode_scan_and_fix()
2099 retval = ext2fs_init_dblist(rfs->old_fs, 0); in inode_scan_and_fix()
2101 retval = ext2fs_get_array(rfs->old_fs->blocksize, 3, &block_buf); in inode_scan_and_fix()
2109 0, rfs->old_fs->group_desc_count); in inode_scan_and_fix()
2169 retval = ext2fs_write_inode_full(rfs->old_fs, new_inode, in inode_scan_and_fix()
2188 retval = ext2fs_write_inode_full(rfs->old_fs, in inode_scan_and_fix()
2199 rfs->old_fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; in inode_scan_and_fix()
2200 if (ext2fs_inode_has_valid_blocks2(rfs->old_fs, inode) && in inode_scan_and_fix()
2205 retval = ext2fs_block_iterate3(rfs->old_fs, in inode_scan_and_fix()
2217 retval = ext2fs_add_dir_block2(rfs->old_fs->dblist, in inode_scan_and_fix()
2224 if (ext2fs_has_feature_metadata_csum(rfs->old_fs->super) && in inode_scan_and_fix()
2226 retval = ext2fs_fix_extents_checksums(rfs->old_fs, in inode_scan_and_fix()
2240 io_channel_flush(rfs->old_fs->io); in inode_scan_and_fix()
2244 rfs->old_fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; in inode_scan_and_fix()
2285 io_channel_flush(is->rfs->old_fs->io); in check_and_change_inodes()
2297 if (ext2fs_has_feature_metadata_csum(is->rfs->old_fs->super) && in check_and_change_inodes()
2298 !ext2fs_test_inode_bitmap2(is->rfs->old_fs->inode_map, dir)) in check_and_change_inodes()
2318 retval = ext2fs_read_inode(is->rfs->old_fs, dir, &inode); in check_and_change_inodes()
2321 is->err = ext2fs_write_inode(is->rfs->old_fs, dir, &inode); in check_and_change_inodes()
2342 is.max_dirs = ext2fs_dblist_count2(rfs->old_fs->dblist); in inode_ref_fix()
2353 rfs->old_fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; in inode_ref_fix()
2354 retval = ext2fs_dblist_dir_iterate(rfs->old_fs->dblist, in inode_ref_fix()
2357 rfs->old_fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; in inode_ref_fix()
2410 if (max_groups > rfs->old_fs->group_desc_count) in move_itables()
2411 max_groups = rfs->old_fs->group_desc_count; in move_itables()
2436 if (ext2fs_inode_table_loc(rfs->old_fs, i) != in move_itables()
2452 rfs->old_fs->flags |= EXT2_FLAG_MASTER_SB_ONLY; in move_itables()
2455 old_blk = ext2fs_inode_table_loc(rfs->old_fs, i); in move_itables()
2511 for (blk = ext2fs_inode_table_loc(rfs->old_fs, i), j=0; in move_itables()
2526 ext2fs_inode_table_loc_set(rfs->old_fs, i, new_blk); in move_itables()
2527 ext2fs_group_desc_csum_set(rfs->old_fs, i); in move_itables()
2528 ext2fs_mark_super_dirty(rfs->old_fs); in move_itables()
2529 ext2fs_flush(rfs->old_fs); in move_itables()
2560 ext2_filsys old_fs = rfs->old_fs; in clear_sparse_super2_last_group() local
2562 dgrp_t old_last_bg = rfs->old_fs->group_desc_count - 1; 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()
2588 retval = ext2fs_super_and_bgd_loc2(rfs->old_fs, old_last_bg, in clear_sparse_super2_last_group()
2611 ext2_filsys old_fs = rfs->old_fs; in reserve_sparse_super2_last_group() local
2613 dgrp_t old_last_bg = rfs->old_fs->group_desc_count - 1; 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()
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()
2686 if (ext2fs_test_block_bitmap2(old_fs->block_map, blk) && in reserve_sparse_super2_last_group()