Home | History | Annotate | Download | only in ext2fs

Lines Matching refs:fs

53 static unsigned int calc_reserved_gdt_blocks(ext2_filsys fs)
55 struct ext2_super_block *sb = fs->super;
72 rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) - fs->desc_blocks;
87 ext2_filsys fs;
108 retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs);
112 memset(fs, 0, sizeof(struct struct_ext2_filsys));
113 fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS;
114 fs->flags = flags | EXT2_FLAG_RW;
115 fs->umask = 022;
116 fs->default_bitmap_type = EXT2FS_BMAP64_RBTREE;
118 fs->flags |= EXT2_FLAG_SWAP_BYTES;
125 retval = manager->open(name, io_flags, &fs->io);
128 fs->image_io = fs->io;
129 fs->io->app_data = fs;
130 retval = ext2fs_get_mem(strlen(name)+1, &fs->device_name);
134 strcpy(fs->device_name, name);
138 fs->super = super;
200 super->s_mkfs_time = super->s_lastcheck = fs->now ? fs->now : time(NULL);
204 fs->fragsize = fs->blocksize = EXT2_BLOCK_SIZE(super);
205 fs->cluster_ratio_bits = super->s_log_cluster_size -
213 ((param->s_clusters_per_group * EXT2FS_CLUSTER_RATIO(fs)) !=
223 EXT2FS_CLUSTER_RATIO(fs);
225 super->s_clusters_per_group = fs->blocksize * 8;
227 super->s_clusters_per_group = (fs->blocksize - 1) * 8;
230 bpg = EXT2FS_C2B(fs,
238 set_field(s_blocks_per_group, fs->blocksize * 8);
245 ~((blk64_t) EXT2FS_CLUSTER_MASK(fs)));
259 fs->group_desc_count = 0;
260 ext2fs_mark_super_dirty(fs);
261 *ret_fs = fs;
266 fs->group_desc_count = (dgrp_t) ext2fs_div64_ceil(
269 if (fs->group_desc_count == 0) {
278 fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count,
281 i = fs->blocksize >= 4096 ? 1 : 4096 / fs->blocksize;
302 ipg = ext2fs_div_ceil(super->s_inodes_count, fs->group_desc_count);
303 if (ipg > fs->blocksize * 8) {
328 fs->inode_blocks_per_group = (((super->s_inodes_per_group *
332 super->s_inodes_per_group = ((fs->inode_blocks_per_group *
343 fs->inode_blocks_per_group = (((super->s_inodes_per_group *
351 if ((__u64)super->s_inodes_per_group * fs->group_desc_count > ~0U) {
356 fs->group_desc_count;
363 rsv_gdt = calc_reserved_gdt_blocks(fs);
378 overhead = (int) (3 + fs->inode_blocks_per_group +
379 fs->desc_blocks + super->s_reserved_gdt_blocks);
394 overhead = (int) (2 + fs->inode_blocks_per_group);
395 if (ext2fs_bg_has_super(fs, fs->group_desc_count - 1))
396 overhead += 1 + fs->desc_blocks + super->s_reserved_gdt_blocks;
399 if ((fs->group_desc_count == 1) && rem && (rem < overhead)) {
424 retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf);
429 strcat(buf, fs->device_name);
430 retval = ext2fs_allocate_subcluster_bitmap(fs, buf, &fs->block_map);
435 strcat(buf, fs->device_name);
436 retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map);
442 retval = ext2fs_get_array(fs->desc_blocks, fs->blocksize,
443 &fs->group_desc);
447 memset(fs->group_desc, 0, (size_t) fs->desc_blocks * fs->blocksize);
461 csum_flag = EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
464 for (i = 0; i < fs->group_desc_count; i++) {
470 if (i != fs->group_desc_count - 1)
471 ext2fs_bg_flags_set(fs, i,
473 ext2fs_bg_flags_set(fs, i, EXT2_BG_INODE_UNINIT);
484 ext2fs_bg_itable_unused_set(fs, i, numblocks);
486 numblocks = ext2fs_reserve_super_and_bgd(fs, i, fs->block_map);
487 if (fs->super->s_log_groups_per_flex)
488 numblocks += 2 + fs->inode_blocks_per_group;
491 ext2fs_bg_free_blocks_count_set(fs, i, numblocks);
492 ext2fs_bg_free_inodes_count_set(fs, i, fs->super->s_inodes_per_group);
493 ext2fs_bg_used_dirs_count_set(fs, i, 0);
494 ext2fs_group_desc_csum_set(fs, i);
496 free_blocks &= ~EXT2FS_CLUSTER_MASK(fs);
506 ext2fs_mark_super_dirty(fs);
507 ext2fs_mark_bb_dirty(fs);
508 ext2fs_mark_ib_dirty(fs);
510 io_channel_set_blksize(fs->io, fs->blocksize);
512 *ret_fs = fs;
516 ext2fs_free(fs);