Lines Matching refs:super
60 struct ext2_super_block *sb = fs->super; in calc_reserved_gdt_blocks()
94 struct ext2_super_block *super; in ext2fs_initialize() local
148 retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &super); in ext2fs_initialize()
151 fs->super = super; in ext2fs_initialize()
153 memset(super, 0, SUPERBLOCK_SIZE); in ext2fs_initialize()
155 #define set_field(field, default) (super->field = param->field ? \ in ext2fs_initialize()
157 #define assign_field(field) (super->field = param->field) in ext2fs_initialize()
159 super->s_magic = EXT2_SUPER_MAGIC; in ext2fs_initialize()
160 super->s_state = EXT2_VALID_FS; in ext2fs_initialize()
167 set_field(s_log_cluster_size, super->s_log_block_size+4); in ext2fs_initialize()
168 if (super->s_log_block_size > super->s_log_cluster_size) { in ext2fs_initialize()
173 super->s_log_cluster_size = super->s_log_block_size; in ext2fs_initialize()
175 set_field(s_first_data_block, super->s_log_cluster_size ? 0 : 1); in ext2fs_initialize()
196 if (super->s_feature_incompat & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) { in ext2fs_initialize()
200 if (super->s_feature_ro_compat & ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP) { in ext2fs_initialize()
206 if (super->s_rev_level >= EXT2_DYNAMIC_REV) { in ext2fs_initialize()
209 if (super->s_inode_size >= sizeof(struct ext2_inode_large)) { in ext2fs_initialize()
216 super->s_first_ino = EXT2_GOOD_OLD_FIRST_INO; in ext2fs_initialize()
217 super->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE; in ext2fs_initialize()
221 super->s_mkfs_time = super->s_lastcheck = fs->now ? fs->now : time(NULL); in ext2fs_initialize()
223 super->s_creator_os = CREATOR_OS; in ext2fs_initialize()
225 fs->fragsize = fs->blocksize = EXT2_BLOCK_SIZE(super); in ext2fs_initialize()
226 fs->cluster_ratio_bits = super->s_log_cluster_size - in ext2fs_initialize()
227 super->s_log_block_size; in ext2fs_initialize()
242 super->s_clusters_per_group = in ext2fs_initialize()
245 else if (super->s_log_cluster_size + 15 < 32) in ext2fs_initialize()
246 super->s_clusters_per_group = fs->blocksize * 8; in ext2fs_initialize()
248 super->s_clusters_per_group = (fs->blocksize - 1) * 8; in ext2fs_initialize()
249 if (super->s_clusters_per_group > EXT2_MAX_CLUSTERS_PER_GROUP(super)) in ext2fs_initialize()
250 super->s_clusters_per_group = EXT2_MAX_CLUSTERS_PER_GROUP(super); in ext2fs_initialize()
252 (unsigned long long) super->s_clusters_per_group); in ext2fs_initialize()
257 super->s_blocks_per_group = bpg; in ext2fs_initialize()
260 if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) in ext2fs_initialize()
261 super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); in ext2fs_initialize()
262 super->s_clusters_per_group = super->s_blocks_per_group; in ext2fs_initialize()
265 ext2fs_blocks_count_set(super, ext2fs_blocks_count(param) & in ext2fs_initialize()
267 ext2fs_r_blocks_count_set(super, ext2fs_r_blocks_count(param)); in ext2fs_initialize()
268 if (ext2fs_r_blocks_count(super) >= ext2fs_blocks_count(param)) { in ext2fs_initialize()
279 if (ext2fs_has_feature_journal_dev(super)) { in ext2fs_initialize()
288 ext2fs_blocks_count(super) - super->s_first_data_block, in ext2fs_initialize()
289 EXT2_BLOCKS_PER_GROUP(super)); in ext2fs_initialize()
296 ext2fs_has_feature_64bit(super) ? in ext2fs_initialize()
300 EXT2_DESC_PER_BLOCK(super)); in ext2fs_initialize()
304 if (ext2fs_has_feature_64bit(super) && in ext2fs_initialize()
305 (ext2fs_blocks_count(super) / i) >= (1ULL << 32)) in ext2fs_initialize()
308 set_field(s_inodes_count, ext2fs_blocks_count(super) / i); in ext2fs_initialize()
314 if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) in ext2fs_initialize()
315 super->s_inodes_count = EXT2_FIRST_INODE(super)+1; in ext2fs_initialize()
323 ipg = ext2fs_div_ceil(super->s_inodes_count, fs->group_desc_count); in ext2fs_initialize()
325 if (!bigalloc_flag && super->s_blocks_per_group >= 256) { in ext2fs_initialize()
327 super->s_blocks_per_group -= 8; in ext2fs_initialize()
328 ext2fs_blocks_count_set(super, in ext2fs_initialize()
330 super->s_clusters_per_group = super->s_blocks_per_group; in ext2fs_initialize()
338 if (ipg > (unsigned) EXT2_MAX_INODES_PER_GROUP(super)) in ext2fs_initialize()
339 ipg = EXT2_MAX_INODES_PER_GROUP(super); in ext2fs_initialize()
342 super->s_inodes_per_group = ipg; in ext2fs_initialize()
349 fs->inode_blocks_per_group = (((super->s_inodes_per_group * in ext2fs_initialize()
350 EXT2_INODE_SIZE(super)) + in ext2fs_initialize()
351 EXT2_BLOCK_SIZE(super) - 1) / in ext2fs_initialize()
352 EXT2_BLOCK_SIZE(super)); in ext2fs_initialize()
353 super->s_inodes_per_group = ((fs->inode_blocks_per_group * in ext2fs_initialize()
354 EXT2_BLOCK_SIZE(super)) / in ext2fs_initialize()
355 EXT2_INODE_SIZE(super)); in ext2fs_initialize()
361 if (super->s_inodes_per_group < 8) in ext2fs_initialize()
362 super->s_inodes_per_group = 8; in ext2fs_initialize()
363 super->s_inodes_per_group &= ~7; in ext2fs_initialize()
364 fs->inode_blocks_per_group = (((super->s_inodes_per_group * in ext2fs_initialize()
365 EXT2_INODE_SIZE(super)) + in ext2fs_initialize()
366 EXT2_BLOCK_SIZE(super) - 1) / in ext2fs_initialize()
367 EXT2_BLOCK_SIZE(super)); in ext2fs_initialize()
372 if ((__u64)super->s_inodes_per_group * fs->group_desc_count > ~0U) { in ext2fs_initialize()
376 super->s_inodes_count = super->s_inodes_per_group * in ext2fs_initialize()
378 super->s_free_inodes_count = super->s_inodes_count; in ext2fs_initialize()
383 if (ext2fs_has_feature_resize_inode(super)) in ext2fs_initialize()
388 if (super->s_reserved_gdt_blocks > EXT2_ADDR_PER_BLOCK(super)) { in ext2fs_initialize()
393 if (super->s_reserved_gdt_blocks + fs->desc_blocks > in ext2fs_initialize()
394 super->s_blocks_per_group * 3 / 4) { in ext2fs_initialize()
395 ext2fs_set_feature_meta_bg(fs->super); in ext2fs_initialize()
396 ext2fs_clear_feature_resize_inode(fs->super); in ext2fs_initialize()
407 super->s_reserved_gdt_blocks); in ext2fs_initialize()
409 if (ext2fs_has_feature_meta_bg(fs->super)) in ext2fs_initialize()
415 if (overhead > super->s_blocks_per_group) { in ext2fs_initialize()
429 if (ext2fs_has_feature_sparse_super2(super)) { in ext2fs_initialize()
441 overhead += 1 + fs->desc_blocks + super->s_reserved_gdt_blocks; in ext2fs_initialize()
442 rem = ((ext2fs_blocks_count(super) - super->s_first_data_block) % in ext2fs_initialize()
443 super->s_blocks_per_group); in ext2fs_initialize()
449 ext2fs_blocks_count_set(super, ext2fs_blocks_count(super) - in ext2fs_initialize()
457 ext2fs_r_blocks_count_set(super, reserved_ratio * in ext2fs_initialize()
458 ext2fs_blocks_count(super) / 100.0); in ext2fs_initialize()
470 if (ext2fs_has_feature_sparse_super2(super)) { in ext2fs_initialize()
471 if (super->s_backup_bgs[0] >= fs->group_desc_count) in ext2fs_initialize()
472 super->s_backup_bgs[0] = fs->group_desc_count - 1; in ext2fs_initialize()
473 if (super->s_backup_bgs[1] >= fs->group_desc_count) in ext2fs_initialize()
474 super->s_backup_bgs[1] = fs->group_desc_count - 1; in ext2fs_initialize()
475 if (super->s_backup_bgs[0] == super->s_backup_bgs[1]) in ext2fs_initialize()
476 super->s_backup_bgs[1] = 0; in ext2fs_initialize()
477 if (super->s_backup_bgs[0] > super->s_backup_bgs[1]) { in ext2fs_initialize()
478 __u32 t = super->s_backup_bgs[0]; in ext2fs_initialize()
479 super->s_backup_bgs[0] = super->s_backup_bgs[1]; in ext2fs_initialize()
480 super->s_backup_bgs[1] = t; in ext2fs_initialize()
522 reserved_inos = super->s_first_ino; in ext2fs_initialize()
533 numblocks = super->s_inodes_per_group; in ext2fs_initialize()
546 if (fs->super->s_log_groups_per_flex) in ext2fs_initialize()
551 ext2fs_bg_free_inodes_count_set(fs, i, fs->super->s_inodes_per_group); in ext2fs_initialize()
556 ext2fs_free_blocks_count_set(super, free_blocks); in ext2fs_initialize()
560 super->s_flags |= EXT2_FLAGS_SIGNED_HASH; in ext2fs_initialize()
562 super->s_flags |= EXT2_FLAGS_UNSIGNED_HASH; in ext2fs_initialize()
594 for (blk = fs->super->s_first_data_block; in ext2fs_calculate_summary_stats()
595 blk < ext2fs_blocks_count(fs->super); blk++) { in ext2fs_calculate_summary_stats()
603 if ((count == fs->super->s_blocks_per_group) || in ext2fs_calculate_summary_stats()
604 (blk == ext2fs_blocks_count(fs->super)-1)) { in ext2fs_calculate_summary_stats()
609 ext2fs_blocks_count(fs->super) - 1) in ext2fs_calculate_summary_stats()
623 ext2fs_free_blocks_count_set(fs->super, total_free); in ext2fs_calculate_summary_stats()
635 for (ino = 1; ino <= fs->super->s_inodes_count && ino > 0; ino++) { in ext2fs_calculate_summary_stats()
643 if ((count == fs->super->s_inodes_per_group) || in ext2fs_calculate_summary_stats()
644 (ino == fs->super->s_inodes_count)) { in ext2fs_calculate_summary_stats()
650 fs->super->s_inodes_per_group - in ext2fs_calculate_summary_stats()
652 fs->super->s_inodes_per_group)); in ext2fs_calculate_summary_stats()
668 fs->super->s_free_inodes_count = total_free; in ext2fs_calculate_summary_stats()