• Home
  • Raw
  • Download

Lines Matching refs:fs

35 int ext2fs_bg_has_super(ext2_filsys fs, dgrp_t group)  in ext2fs_bg_has_super()  argument
37 if (!(fs->super->s_feature_ro_compat & in ext2fs_bg_has_super()
63 errcode_t ext2fs_super_and_bgd_loc2(ext2_filsys fs, in ext2fs_super_and_bgd_loc2() argument
76 group_block = ext2fs_group_first_block2(fs, group); in ext2fs_super_and_bgd_loc2()
77 if (group_block == 0 && fs->blocksize == 1024) in ext2fs_super_and_bgd_loc2()
80 if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) in ext2fs_super_and_bgd_loc2()
81 old_desc_blocks = fs->super->s_first_meta_bg; in ext2fs_super_and_bgd_loc2()
84 fs->desc_blocks + fs->super->s_reserved_gdt_blocks; in ext2fs_super_and_bgd_loc2()
86 has_super = ext2fs_bg_has_super(fs, group); in ext2fs_super_and_bgd_loc2()
92 meta_bg_size = EXT2_DESC_PER_BLOCK(fs->super); in ext2fs_super_and_bgd_loc2()
95 if (!(fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) || in ext2fs_super_and_bgd_loc2()
96 (meta_bg < fs->super->s_first_meta_bg)) { in ext2fs_super_and_bgd_loc2()
137 int ext2fs_super_and_bgd_loc(ext2_filsys fs, in ext2fs_super_and_bgd_loc() argument
151 ext2fs_super_and_bgd_loc2(fs, group, &ret_super_blk2, in ext2fs_super_and_bgd_loc()
156 numblocks = ext2fs_group_blocks_count(fs, group); in ext2fs_super_and_bgd_loc()
165 meta_bg_size = EXT2_DESC_PER_BLOCK(fs->super); in ext2fs_super_and_bgd_loc()
169 numblocks -= 2 + fs->inode_blocks_per_group + ret_used_blks; in ext2fs_super_and_bgd_loc()
184 static errcode_t write_primary_superblock(ext2_filsys fs, in write_primary_superblock() argument
191 if (!fs->io->manager->write_byte || !fs->orig_super) { in write_primary_superblock()
193 io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET); in write_primary_superblock()
194 retval = io_channel_write_blk64(fs->io, 1, -SUPERBLOCK_SIZE, in write_primary_superblock()
196 io_channel_set_blksize(fs->io, fs->blocksize); in write_primary_superblock()
200 old_super = (__u16 *) fs->orig_super; in write_primary_superblock()
215 retval = io_channel_write_byte(fs->io, in write_primary_superblock()
223 memcpy(fs->orig_super, super, SUPERBLOCK_SIZE); in write_primary_superblock()
231 void ext2fs_update_dynamic_rev(ext2_filsys fs) in ext2fs_update_dynamic_rev() argument
233 struct ext2_super_block *sb = fs->super; in ext2fs_update_dynamic_rev()
245 static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, in write_backup_super() argument
256 fs->super->s_block_group_nr = sgrp; in write_backup_super()
259 return io_channel_write_blk64(fs->io, group_block, -SUPERBLOCK_SIZE, in write_backup_super()
263 errcode_t ext2fs_flush(ext2_filsys fs) in ext2fs_flush() argument
265 return ext2fs_flush2(fs, 0); in ext2fs_flush()
268 errcode_t ext2fs_flush2(ext2_filsys fs, int flags) in ext2fs_flush2() argument
284 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); in ext2fs_flush2()
286 fs_state = fs->super->s_state; in ext2fs_flush2()
287 feature_incompat = fs->super->s_feature_incompat; in ext2fs_flush2()
289 fs->super->s_wtime = fs->now ? fs->now : time(NULL); in ext2fs_flush2()
290 fs->super->s_block_group_nr = 0; in ext2fs_flush2()
296 retval = ext2fs_get_array(fs->desc_blocks, fs->blocksize, in ext2fs_flush2()
300 memcpy(group_shadow, fs->group_desc, (size_t) fs->blocksize * in ext2fs_flush2()
301 fs->desc_blocks); in ext2fs_flush2()
304 for (j = 0; j < fs->group_desc_count; j++) { in ext2fs_flush2()
305 gdp = ext2fs_group_desc(fs, group_shadow, j); in ext2fs_flush2()
306 ext2fs_swap_group_desc2(fs, gdp); in ext2fs_flush2()
309 super_shadow = fs->super; in ext2fs_flush2()
310 group_shadow = ext2fs_group_desc(fs, fs->group_desc, 0); in ext2fs_flush2()
318 fs->super->s_state &= ~EXT2_VALID_FS; in ext2fs_flush2()
319 fs->super->s_feature_incompat &= ~EXT3_FEATURE_INCOMPAT_RECOVER; in ext2fs_flush2()
321 *super_shadow = *fs->super; in ext2fs_flush2()
329 if (fs->super->s_feature_incompat & in ext2fs_flush2()
338 if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) in ext2fs_flush2()
339 old_desc_blocks = fs->super->s_first_meta_bg; in ext2fs_flush2()
341 old_desc_blocks = fs->desc_blocks; in ext2fs_flush2()
343 ext2fs_numeric_progress_init(fs, &progress, NULL, in ext2fs_flush2()
344 fs->group_desc_count); in ext2fs_flush2()
347 for (i = 0; i < fs->group_desc_count; i++) { in ext2fs_flush2()
350 ext2fs_numeric_progress_update(fs, &progress, i); in ext2fs_flush2()
351 ext2fs_super_and_bgd_loc2(fs, i, &super_blk, &old_desc_blk, in ext2fs_flush2()
354 if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { in ext2fs_flush2()
355 retval = write_backup_super(fs, i, super_blk, in ext2fs_flush2()
360 if (fs->flags & EXT2_FLAG_SUPER_ONLY) in ext2fs_flush2()
363 (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { in ext2fs_flush2()
364 retval = io_channel_write_blk64(fs->io, in ext2fs_flush2()
370 int meta_bg = i / EXT2_DESC_PER_BLOCK(fs->super); in ext2fs_flush2()
372 retval = io_channel_write_blk64(fs->io, new_desc_blk, in ext2fs_flush2()
373 1, group_ptr + (meta_bg*fs->blocksize)); in ext2fs_flush2()
379 ext2fs_numeric_progress_close(fs, &progress, NULL); in ext2fs_flush2()
387 if (fs->write_bitmaps) { in ext2fs_flush2()
388 retval = fs->write_bitmaps(fs); in ext2fs_flush2()
402 fs->super->s_block_group_nr = 0; in ext2fs_flush2()
403 fs->super->s_state = fs_state; in ext2fs_flush2()
404 fs->super->s_feature_incompat = feature_incompat; in ext2fs_flush2()
406 *super_shadow = *fs->super; in ext2fs_flush2()
411 retval = io_channel_flush(fs->io); in ext2fs_flush2()
412 retval = write_primary_superblock(fs, super_shadow); in ext2fs_flush2()
416 fs->flags &= ~EXT2_FLAG_DIRTY; in ext2fs_flush2()
419 retval = io_channel_flush(fs->io); in ext2fs_flush2()
421 fs->super->s_state = fs_state; in ext2fs_flush2()
431 errcode_t ext2fs_close(ext2_filsys fs) in ext2fs_close() argument
433 return ext2fs_close2(fs, 0); in ext2fs_close()
436 errcode_t ext2fs_close2(ext2_filsys fs, int flags) in ext2fs_close2() argument
442 EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); in ext2fs_close2()
444 if (fs->write_bitmaps) { in ext2fs_close2()
445 retval = fs->write_bitmaps(fs); in ext2fs_close2()
449 if (fs->super->s_kbytes_written && in ext2fs_close2()
450 fs->io->manager->get_stats) in ext2fs_close2()
451 fs->io->manager->get_stats(fs->io, &stats); in ext2fs_close2()
452 if (stats && stats->bytes_written && (fs->flags & EXT2_FLAG_RW)) { in ext2fs_close2()
453 fs->super->s_kbytes_written += stats->bytes_written >> 10; in ext2fs_close2()
454 meta_blks = fs->desc_blocks + 1; in ext2fs_close2()
455 if (!(fs->flags & EXT2_FLAG_SUPER_ONLY)) in ext2fs_close2()
456 fs->super->s_kbytes_written += meta_blks / in ext2fs_close2()
457 (fs->blocksize / 1024); in ext2fs_close2()
458 if ((fs->flags & EXT2_FLAG_DIRTY) == 0) in ext2fs_close2()
459 fs->flags |= EXT2_FLAG_SUPER_ONLY | EXT2_FLAG_DIRTY; in ext2fs_close2()
461 if (fs->flags & EXT2_FLAG_DIRTY) { in ext2fs_close2()
462 retval = ext2fs_flush2(fs, flags); in ext2fs_close2()
467 retval = ext2fs_mmp_stop(fs); in ext2fs_close2()
471 ext2fs_free(fs); in ext2fs_close2()