Lines Matching refs:fs
56 static int release_inode_block(ext2_filsys fs,
79 if ((blk < fs->super->s_first_data_block) ||
80 (blk >= fs->super->s_blocks_count)) {
87 if (!ext2fs_test_block_bitmap(fs->block_map, blk)) {
106 pb->errcode = io_channel_read_blk(fs->io, blk, 1,
111 limit = fs->blocksize >> 2;
128 pb->errcode = io_channel_read_blk(fs->io, blk, 1,
133 fs->blocksize - pb->truncate_offset);
134 pb->errcode = io_channel_write_blk(fs->io, blk, 1,
144 ext2fs_block_alloc_stats(fs, blk, -1);
158 ext2_filsys fs = ctx->fs;
165 pb.buf = block_buf + 3 * ctx->fs->blocksize;
174 inode->i_size + fs->blocksize - 1) /
175 fs->blocksize);
176 pb.truncate_offset = inode->i_size % fs->blocksize;
183 retval = ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_DEPTH_TRAVERSE,
198 ext2fs_iblk_sub_blocks(fs, inode, pb.truncated_blocks);
201 retval = ext2fs_adjust_ea_refcount(fs, inode->i_file_acl,
214 ext2fs_block_alloc_stats(fs, inode->i_file_acl, -1);
226 ext2_filsys fs = ctx->fs;
232 if ((ino = fs->super->s_last_orphan) == 0)
239 fs->super->s_last_orphan = 0;
240 ext2fs_mark_super_dirty(fs);
247 if (fs->super->s_state & EXT2_ERROR_FS)
250 if ((ino < EXT2_FIRST_INODE(fs->super)) ||
251 (ino > fs->super->s_inodes_count)) {
258 block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 4,
274 ((next_ino < EXT2_FIRST_INODE(fs->super)) ||
275 (next_ino > fs->super->s_inodes_count))) {
285 ext2fs_inode_alloc_stats2(fs, ino, -1,
309 ext2_filsys fs = ctx->fs;
324 if (!(fs->super->s_feature_compat &
326 if (fs->super->s_reserved_gdt_blocks) {
327 pctx.num = fs->super->s_reserved_gdt_blocks;
330 fs->super->s_reserved_gdt_blocks = 0;
331 ext2fs_mark_super_dirty(fs);
338 retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
340 if (fs->super->s_feature_compat &
350 if (!(fs->super->s_feature_compat &
376 (blk < fs->super->s_first_data_block ||
377 blk >= fs->super->s_blocks_count)) {
386 fs->super->s_state &= ~EXT2_VALID_FS;
387 ext2fs_mark_super_dirty(fs);
391 dind_buf = (__u32 *) e2fsck_allocate_memory(ctx, fs->blocksize * 2,
393 ind_buf = (__u32 *) ((char *) dind_buf + fs->blocksize);
395 retval = ext2fs_read_ind_block(fs, blk, dind_buf);
399 gdt_off = fs->desc_blocks;
400 pblk = fs->super->s_first_data_block + 1 + fs->desc_blocks;
401 for (i = 0; i < fs->super->s_reserved_gdt_blocks / 4;
403 gdt_off %= fs->blocksize/4;
406 retval = ext2fs_read_ind_block(fs, pblk, ind_buf);
410 for (j = 1; j < fs->group_desc_count; j++) {
411 if (!ext2fs_bg_has_super(fs, j))
413 expect = pblk + (j * fs->super->s_blocks_per_group);
431 struct ext2_super_block *sb = ctx->fs->super;
449 ext2fs_mark_super_dirty(ctx->fs);
456 ext2_filsys fs = ctx->fs;
458 struct ext2_super_block *sb = fs->super;
461 blk_t blocks_per_group = fs->super->s_blocks_per_group;
475 inodes_per_block = EXT2_INODES_PER_BLOCK(fs->super);
484 sizeof(int) * fs->group_desc_count, "invalid_inode_bitmap");
486 sizeof(int) * fs->group_desc_count, "invalid_block_bitmap");
488 sizeof(int) * fs->group_desc_count, "invalid_inode_table");
517 fs->blocksize/4);
525 EXT2_GOOD_OLD_INODE_SIZE, fs->blocksize);
571 should_be = sb->s_inodes_per_group * fs->group_desc_count;
577 ext2fs_mark_super_dirty(fs);
587 csum_flag = EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
589 for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) {
592 if (!EXT2_HAS_INCOMPAT_FEATURE(fs->super,
594 first_block = ext2fs_group_first_block(fs, i);
595 last_block = ext2fs_group_last_block(fs, i);
620 fs->inode_blocks_per_group - 1) > last_block)) {
635 ext2fs_unmark_valid(fs);
638 if (!ext2fs_group_desc_csum_verify(fs, i)) {
645 ext2fs_unmark_valid(fs);
657 ext2fs_unmark_valid(fs);
660 if (i == fs->group_desc_count - 1 &&
666 ext2fs_unmark_valid(fs);
675 ext2fs_unmark_valid(fs);
686 ext2fs_unmark_valid(fs);
690 ext2fs_group_desc_csum_set(fs, i);
703 ext2fs_unmark_valid(fs);
707 ext2fs_mark_super_dirty(fs);
713 ext2fs_unmark_valid(fs);
722 ext2fs_mark_super_dirty(fs);
734 ext2fs_mark_super_dirty(fs);
735 fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
748 (fs->super->s_flags & EXT2_FLAGS_TEST_FILESYS) &&
751 fs->super->s_flags &= ~EXT2_FLAGS_TEST_FILESYS;
752 ext2fs_mark_super_dirty(fs);
753 fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
762 fs->super->s_creator_os == EXT2_OS_HURD &&
763 (fs->super->s_feature_incompat &
766 fs->super->s_feature_incompat &=
768 ext2fs_mark_super_dirty(fs);
769 fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
780 fs->super->s_rev_level == EXT2_GOOD_OLD_REV &&
781 (fs->super->s_feature_compat ||
782 fs->super->s_feature_ro_compat ||
783 fs->super->s_feature_incompat) &&
785 ext2fs_update_dynamic_rev(fs);
786 ext2fs_mark_super_dirty(fs);
787 fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
794 fs->super->s_state &= ~EXT2_VALID_FS;
795 ext2fs_mark_super_dirty(fs);
834 fs->super->s_mtime > (__u32) ctx->now) {
835 pctx.num = fs->super->s_mtime;
837 if (fs->super->s_mtime <= (__u32) ctx->now + ctx->time_fudge)
840 fs->super->s_mtime = ctx->now;
841 ext2fs_mark_super_dirty(fs);
846 fs->super->s_wtime > (__u32) ctx->now) {
847 pctx.num = fs->super->s_wtime;
849 if (fs->super->s_wtime <= (__u32) ctx->now + ctx->time_fudge)
852 fs->super->s_wtime = ctx->now;
853 ext2fs_mark_super_dirty(fs);
901 ext2_filsys fs = ctx->fs;
916 if (((fs->flags & EXT2_FLAG_MASTER_SB_ONLY) == 0) ||
917 !ext2fs_test_valid(fs) ||
918 (fs->super->s_state & EXT2_ERROR_FS) ||
923 for (g = 1; g < fs->group_desc_count; g++) {
924 if (!ext2fs_bg_has_super(fs, g))
927 sb = fs->super->s_first_data_block +
928 (g * fs->super->s_blocks_per_group);
930 retval = io_channel_read_blk(fs->io, sb, -SUPERBLOCK_SIZE,
946 ((fs->super->x & ~FEATURE_INCOMPAT_IGNORE) != \
949 ((fs->super->x & ~FEATURE_RO_COMPAT_IGNORE) != \
952 (fs->super->x != backup_sb->x)
959 memcmp(fs->super->s_uuid, backup_sb->s_uuid,
960 sizeof(fs->super->s_uuid)))