Lines Matching refs:sb
143 void read_sb(int fd, struct ext4_super_block *sb) in read_sb() argument
151 ret = read(fd, sb, sizeof(*sb)); in read_sb()
154 if (ret != sizeof(*sb)) in read_sb()
159 void write_sb(int fd, unsigned long long offset, struct ext4_super_block *sb) in write_sb() argument
167 ret = write(fd, sb, sizeof(*sb)); in write_sb()
170 if (ret != sizeof(*sb)) in write_sb()
189 write_sb(fd, 1024, aux_info.sb); in block_device_write_sb()
250 aux_info.sb = (struct ext4_super_block *)((char *)aux_info.sb_block + 1024); in ext4_create_fs_aux_info()
252 aux_info.sb = aux_info.sb_block; in ext4_create_fs_aux_info()
257 if (!aux_info.sb) in ext4_create_fs_aux_info()
283 struct ext4_super_block *sb = aux_info.sb; in ext4_fill_in_sb() local
285 sb->s_inodes_count = info.inodes_per_group * aux_info.groups; in ext4_fill_in_sb()
286 sb->s_blocks_count_lo = aux_info.len_blocks; in ext4_fill_in_sb()
287 sb->s_r_blocks_count_lo = 0; in ext4_fill_in_sb()
288 sb->s_free_blocks_count_lo = 0; in ext4_fill_in_sb()
289 sb->s_free_inodes_count = 0; in ext4_fill_in_sb()
290 sb->s_first_data_block = aux_info.first_data_block; in ext4_fill_in_sb()
291 sb->s_log_block_size = log_2(info.block_size / 1024); in ext4_fill_in_sb()
292 sb->s_obso_log_frag_size = log_2(info.block_size / 1024); in ext4_fill_in_sb()
293 sb->s_blocks_per_group = info.blocks_per_group; in ext4_fill_in_sb()
294 sb->s_obso_frags_per_group = info.blocks_per_group; in ext4_fill_in_sb()
295 sb->s_inodes_per_group = info.inodes_per_group; in ext4_fill_in_sb()
296 sb->s_mtime = 0; in ext4_fill_in_sb()
297 sb->s_wtime = 0; in ext4_fill_in_sb()
298 sb->s_mnt_count = 0; in ext4_fill_in_sb()
299 sb->s_max_mnt_count = 10; in ext4_fill_in_sb()
300 sb->s_magic = EXT4_SUPER_MAGIC; in ext4_fill_in_sb()
301 sb->s_state = EXT4_VALID_FS; in ext4_fill_in_sb()
302 sb->s_errors = EXT4_ERRORS_RO; in ext4_fill_in_sb()
303 sb->s_minor_rev_level = 0; in ext4_fill_in_sb()
304 sb->s_lastcheck = 0; in ext4_fill_in_sb()
305 sb->s_checkinterval = 0; in ext4_fill_in_sb()
306 sb->s_creator_os = EXT4_OS_LINUX; in ext4_fill_in_sb()
307 sb->s_rev_level = EXT4_DYNAMIC_REV; in ext4_fill_in_sb()
308 sb->s_def_resuid = EXT4_DEF_RESUID; in ext4_fill_in_sb()
309 sb->s_def_resgid = EXT4_DEF_RESGID; in ext4_fill_in_sb()
311 sb->s_first_ino = EXT4_GOOD_OLD_FIRST_INO; in ext4_fill_in_sb()
312 sb->s_inode_size = info.inode_size; in ext4_fill_in_sb()
313 sb->s_block_group_nr = 0; in ext4_fill_in_sb()
314 sb->s_feature_compat = info.feat_compat; in ext4_fill_in_sb()
315 sb->s_feature_incompat = info.feat_incompat; in ext4_fill_in_sb()
316 sb->s_feature_ro_compat = info.feat_ro_compat; in ext4_fill_in_sb()
319 uuid_generate(sb->s_uuid); in ext4_fill_in_sb()
325 generate_sha1_uuid("extandroid/make_ext4fs", info.label, sb->s_uuid); in ext4_fill_in_sb()
327 memset(sb->s_volume_name, 0, sizeof(sb->s_volume_name)); in ext4_fill_in_sb()
328 strncpy(sb->s_volume_name, info.label, sizeof(sb->s_volume_name)); in ext4_fill_in_sb()
329 memset(sb->s_last_mounted, 0, sizeof(sb->s_last_mounted)); in ext4_fill_in_sb()
330 sb->s_algorithm_usage_bitmap = 0; in ext4_fill_in_sb()
332 sb->s_reserved_gdt_blocks = info.bg_desc_reserve_blocks; in ext4_fill_in_sb()
333 sb->s_prealloc_blocks = 0; in ext4_fill_in_sb()
334 sb->s_prealloc_dir_blocks = 0; in ext4_fill_in_sb()
338 sb->s_journal_inum = EXT4_JOURNAL_INO; in ext4_fill_in_sb()
339 sb->s_journal_dev = 0; in ext4_fill_in_sb()
340 sb->s_last_orphan = 0; in ext4_fill_in_sb()
341 sb->s_hash_seed[0] = 0; /* FIXME */ in ext4_fill_in_sb()
342 sb->s_def_hash_version = DX_HASH_TEA; in ext4_fill_in_sb()
343 sb->s_reserved_char_pad = EXT4_JNL_BACKUP_BLOCKS; in ext4_fill_in_sb()
344 sb->s_desc_size = sizeof(struct ext2_group_desc); in ext4_fill_in_sb()
345 sb->s_default_mount_opts = 0; /* FIXME */ in ext4_fill_in_sb()
346 sb->s_first_meta_bg = 0; in ext4_fill_in_sb()
347 sb->s_mkfs_time = 0; in ext4_fill_in_sb()
350 sb->s_blocks_count_hi = aux_info.len_blocks >> 32; in ext4_fill_in_sb()
351 sb->s_r_blocks_count_hi = 0; in ext4_fill_in_sb()
352 sb->s_free_blocks_count_hi = 0; in ext4_fill_in_sb()
353 sb->s_min_extra_isize = sizeof(struct ext4_inode) - in ext4_fill_in_sb()
355 sb->s_want_extra_isize = sizeof(struct ext4_inode) - in ext4_fill_in_sb()
357 sb->s_flags = 2; in ext4_fill_in_sb()
358 sb->s_raid_stride = info.flash_logical_block_size / info.block_size; in ext4_fill_in_sb()
361 sb->s_raid_stride = 8192 / info.block_size; in ext4_fill_in_sb()
363 sb->s_mmp_interval = 0; in ext4_fill_in_sb()
364 sb->s_mmp_block = 0; in ext4_fill_in_sb()
365 sb->s_raid_stripe_width = info.flash_erase_block_size / info.block_size; in ext4_fill_in_sb()
366 sb->s_log_groups_per_flex = 0; in ext4_fill_in_sb()
367 sb->s_kbytes_written = 0; in ext4_fill_in_sb()
376 memcpy(aux_info.backup_sb[i], sb, sizeof(struct ext4_super_block)); in ext4_fill_in_sb()
392 aux_info.bg_desc[i].bg_free_blocks_count = sb->s_blocks_per_group; in ext4_fill_in_sb()
393 aux_info.bg_desc[i].bg_free_inodes_count = sb->s_inodes_per_group; in ext4_fill_in_sb()
410 void ext4_queue_sb(u64 start_block, struct ext4_super_block *sb) in ext4_queue_sb() argument
412 sparse_file_add_data(ext4_sparse_file, sb, info.block_size, start_block); in ext4_queue_sb()
415 void ext4_parse_sb_info(struct ext4_super_block *sb) in ext4_parse_sb_info() argument
417 if (sb->s_magic != EXT4_SUPER_MAGIC) in ext4_parse_sb_info()
420 if ((sb->s_state & EXT4_VALID_FS) != EXT4_VALID_FS) in ext4_parse_sb_info()
423 ext4_parse_sb(sb, &info); in ext4_parse_sb_info()
427 memcpy(aux_info.sb, sb, sizeof(*sb)); in ext4_parse_sb_info()
429 if (aux_info.first_data_block != sb->s_first_data_block) in ext4_parse_sb_info()
496 memcpy(aux_info.sb->s_jnl_blocks, &inode->i_block, sizeof(inode->i_block)); in ext4_create_journal_inode()
511 aux_info.sb->s_free_blocks_count_lo += bg_free_blocks; in ext4_update_free()
514 aux_info.sb->s_free_inodes_count += bg_free_inodes; in ext4_update_free()
520 crc = ext4_crc16(~0, aux_info.sb->s_uuid, sizeof(aux_info.sb->s_uuid)); in ext4_update_free()
607 struct ext4_super_block sb; in read_ext() local
609 read_sb(fd, &sb); in read_ext()
611 ext4_parse_sb_info(&sb); in read_ext()
639 aux_info.sb->s_inodes_count - aux_info.sb->s_free_inodes_count, in read_ext()
640 aux_info.sb->s_inodes_count, in read_ext()
641 aux_info.sb->s_blocks_count_lo - aux_info.sb->s_free_blocks_count_lo, in read_ext()
642 aux_info.sb->s_blocks_count_lo); in read_ext()