• Home
  • Raw
  • Download

Lines Matching refs:fs

31 static void check_block_uninit(ext2_filsys fs, ext2fs_block_bitmap map,  in check_block_uninit()  argument
38 if (!(EXT2_HAS_RO_COMPAT_FEATURE(fs->super, in check_block_uninit()
40 !(fs->group_desc[group].bg_flags & EXT2_BG_BLOCK_UNINIT)) in check_block_uninit()
43 blk = (group * fs->super->s_blocks_per_group) + in check_block_uninit()
44 fs->super->s_first_data_block; in check_block_uninit()
46 ext2fs_super_and_bgd_loc(fs, group, &super_blk, in check_block_uninit()
49 if (fs->super->s_feature_incompat & in check_block_uninit()
51 old_desc_blocks = fs->super->s_first_meta_bg; in check_block_uninit()
53 old_desc_blocks = fs->desc_blocks + fs->super->s_reserved_gdt_blocks; in check_block_uninit()
55 for (i=0; i < fs->super->s_blocks_per_group; i++, blk++) { in check_block_uninit()
61 (blk == fs->group_desc[group].bg_block_bitmap) || in check_block_uninit()
62 (blk == fs->group_desc[group].bg_inode_bitmap) || in check_block_uninit()
63 (blk >= fs->group_desc[group].bg_inode_table && in check_block_uninit()
64 (blk < fs->group_desc[group].bg_inode_table in check_block_uninit()
65 + fs->inode_blocks_per_group))) in check_block_uninit()
70 fs->group_desc[group].bg_flags &= ~EXT2_BG_BLOCK_UNINIT; in check_block_uninit()
71 ext2fs_group_desc_csum_set(fs, group); in check_block_uninit()
77 static void check_inode_uninit(ext2_filsys fs, ext2fs_inode_bitmap map, in check_inode_uninit() argument
82 if (!(EXT2_HAS_RO_COMPAT_FEATURE(fs->super, in check_inode_uninit()
84 !(fs->group_desc[group].bg_flags & EXT2_BG_INODE_UNINIT)) in check_inode_uninit()
87 ino = (group * fs->super->s_inodes_per_group) + 1; in check_inode_uninit()
88 for (i=0; i < fs->super->s_inodes_per_group; i++, ino++) in check_inode_uninit()
91 fs->group_desc[group].bg_flags &= ~EXT2_BG_INODE_UNINIT; in check_inode_uninit()
92 check_block_uninit(fs, fs->block_map, group); in check_inode_uninit()
101 errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, in ext2fs_new_inode() argument
109 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); in ext2fs_new_inode()
112 map = fs->inode_map; in ext2fs_new_inode()
117 dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super); in ext2fs_new_inode()
119 start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1; in ext2fs_new_inode()
120 if (start_inode < EXT2_FIRST_INODE(fs->super)) in ext2fs_new_inode()
121 start_inode = EXT2_FIRST_INODE(fs->super); in ext2fs_new_inode()
122 if (start_inode > fs->super->s_inodes_count) in ext2fs_new_inode()
127 if (((i - 1) % EXT2_INODES_PER_GROUP(fs->super)) == 0) in ext2fs_new_inode()
128 check_inode_uninit(fs, map, (i - 1) / in ext2fs_new_inode()
129 EXT2_INODES_PER_GROUP(fs->super)); in ext2fs_new_inode()
134 if (i > fs->super->s_inodes_count) in ext2fs_new_inode()
135 i = EXT2_FIRST_INODE(fs->super); in ext2fs_new_inode()
148 errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, in ext2fs_new_block() argument
153 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); in ext2fs_new_block()
156 map = fs->block_map; in ext2fs_new_block()
159 if (!goal || (goal >= fs->super->s_blocks_count)) in ext2fs_new_block()
160 goal = fs->super->s_first_data_block; in ext2fs_new_block()
162 check_block_uninit(fs, map, in ext2fs_new_block()
163 (i - fs->super->s_first_data_block) / in ext2fs_new_block()
164 EXT2_BLOCKS_PER_GROUP(fs->super)); in ext2fs_new_block()
166 if (((i - fs->super->s_first_data_block) % in ext2fs_new_block()
167 EXT2_BLOCKS_PER_GROUP(fs->super)) == 0) in ext2fs_new_block()
168 check_block_uninit(fs, map, in ext2fs_new_block()
169 (i - fs->super->s_first_data_block) / in ext2fs_new_block()
170 EXT2_BLOCKS_PER_GROUP(fs->super)); in ext2fs_new_block()
177 if (i >= fs->super->s_blocks_count) in ext2fs_new_block()
178 i = fs->super->s_first_data_block; in ext2fs_new_block()
187 errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, in ext2fs_alloc_block() argument
195 retval = ext2fs_get_mem(fs->blocksize, &buf); in ext2fs_alloc_block()
200 memset(block_buf, 0, fs->blocksize); in ext2fs_alloc_block()
202 if (fs->get_alloc_block) { in ext2fs_alloc_block()
205 retval = (fs->get_alloc_block)(fs, (blk64_t) goal, &new); in ext2fs_alloc_block()
210 if (!fs->block_map) { in ext2fs_alloc_block()
211 retval = ext2fs_read_block_bitmap(fs); in ext2fs_alloc_block()
216 retval = ext2fs_new_block(fs, goal, 0, &block); in ext2fs_alloc_block()
221 retval = io_channel_write_blk(fs->io, block, 1, block_buf); in ext2fs_alloc_block()
225 ext2fs_block_alloc_stats(fs, block, +1); in ext2fs_alloc_block()
234 errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish, in ext2fs_get_free_blocks() argument
239 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); in ext2fs_get_free_blocks()
242 map = fs->block_map; in ext2fs_get_free_blocks()
246 b = fs->super->s_first_data_block; in ext2fs_get_free_blocks()
252 if (b+num-1 > fs->super->s_blocks_count) in ext2fs_get_free_blocks()
253 b = fs->super->s_first_data_block; in ext2fs_get_free_blocks()
263 void ext2fs_set_alloc_block_callback(ext2_filsys fs, in ext2fs_set_alloc_block_callback() argument
264 errcode_t (*func)(ext2_filsys fs, in ext2fs_set_alloc_block_callback() argument
267 errcode_t (**old)(ext2_filsys fs, in ext2fs_set_alloc_block_callback() argument
271 if (!fs || fs->magic != EXT2_ET_MAGIC_EXT2FS_FILSYS) in ext2fs_set_alloc_block_callback()
275 *old = fs->get_alloc_block; in ext2fs_set_alloc_block_callback()
277 fs->get_alloc_block = func; in ext2fs_set_alloc_block_callback()