Lines Matching refs:fs
63 static int check_dir_block(ext2_filsys fs,
83 struct ext2_super_block *sb = ctx->fs->super;
85 ext2_filsys fs = ctx->fs;
99 init_resource_track(&rtrack, ctx->fs->io);
114 e2fsck_set_bitmap_type(fs, EXT2FS_BMAP64_RBTREE,
116 cd.pctx.errcode = ext2fs_create_icount2(fs,
120 fs->default_bitmap_type = save_type;
127 buf = (char *) e2fsck_allocate_memory(ctx, 2*fs->blocksize,
140 cd.max = ext2fs_dblist_count2(fs->dblist);
145 if (fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_DIR_INDEX)
146 ext2fs_dblist_sort2(fs->dblist, special_dir_block_cmp);
148 cd.pctx.errcode = ext2fs_dblist_iterate2(fs->dblist, check_dir_block,
254 ext2fs_free_dblist(fs->dblist);
272 fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
273 ext2fs_mark_super_dirty(fs);
277 ext2fs_update_dynamic_rev(fs);
278 ext2fs_mark_super_dirty(fs);
282 print_resource_track(ctx, _("Pass 2"), &rtrack, fs->io);
365 (void) ext2fs_get_rec_len(ctx->fs, dirent, &rec_len);
392 (void) ext2fs_set_rec_len(ctx->fs, new_len,
424 (void) ext2fs_get_rec_len(ctx->fs, dirent, &rec_len);
489 if (!(ctx->fs->super->s_feature_incompat &
525 static void parse_int_node(ext2_filsys fs,
567 expect_limit = (fs->blocksize - ((char *) ent - block_buf)) /
641 static void salvage_directory(ext2_filsys fs,
651 (void) ext2fs_get_rec_len(fs, dirent, &rec_len);
652 left = fs->blocksize - *offset - rec_len;
671 dirent->inode <= fs->super->s_inodes_count &&
673 (void) ext2fs_set_rec_len(fs, (int) rec_len + left, dirent);
682 (*offset + rec_len <= fs->blocksize)) {
683 (void) ext2fs_get_rec_len(fs, prev, &prev_rec_len);
685 (void) ext2fs_set_rec_len(fs, prev_rec_len, prev);
696 (void) ext2fs_get_rec_len(fs, prev, &prev_rec_len);
697 prev_rec_len += fs->blocksize - *offset;
698 (void) ext2fs_set_rec_len(fs, prev_rec_len, prev);
699 *offset = fs->blocksize;
701 rec_len = fs->blocksize - *offset;
702 (void) ext2fs_set_rec_len(fs, rec_len, dirent);
708 static int check_dir_block(ext2_filsys fs,
782 cd->pctx.errcode = ext2fs_read_dir_block3(fs, block_nr, buf, 0);
791 memset(buf, 0, fs->blocksize);
813 (void) ext2fs_get_rec_len(fs, dirent, &rec_len);
829 (fs->super->s_flags & EXT2_FLAGS_UNSIGNED_HASH))
833 (rec_len == fs->blocksize) &&
836 ((fs->blocksize-8) /
851 (void) ext2fs_get_rec_len(fs, dirent, &rec_len);
854 if (((offset + rec_len) > fs->blocksize) ||
859 salvage_directory(fs, dirent, prev, &offset);
890 (dirent->inode < EXT2_FIRST_INODE(fs->super))) ||
891 (dirent->inode > fs->super->s_inodes_count)) {
943 ext2fs_unmark_valid(fs);
960 buf + fs->blocksize)) {
969 group = ext2fs_group_of_ino(fs, dirent->inode);
970 first_unused_inode = group * fs->super->s_inodes_per_group +
971 1 + fs->super->s_inodes_per_group -
972 ext2fs_bg_itable_unused(fs, group);
983 if (ext2fs_bg_flags_test(fs, group, EXT2_BG_INODE_UNINIT)) {
987 ext2fs_bg_flags_clear(fs, group,
989 ext2fs_mark_super_dirty(fs);
992 ext2fs_unmark_valid(fs);
999 ext2fs_bg_itable_unused_set(fs, group, 0);
1000 ext2fs_mark_super_dirty(fs);
1003 ext2fs_unmark_valid(fs);
1028 ext2fs_unmark_valid(fs);
1044 fs->super->s_hash_seed, &hash, 0);
1106 (void) ext2fs_get_rec_len(fs, dirent, &rec_len);
1109 } while (offset < fs->blocksize);
1123 parse_int_node(fs, db, cd, dx_dir, buf);
1126 if (offset != fs->blocksize) {
1127 cd->pctx.num = rec_len - fs->blocksize + offset;
1134 cd->pctx.errcode = ext2fs_write_dir_block3(fs, block_nr, buf, 0);
1140 ext2fs_mark_changed(fs);
1159 static int deallocate_inode_block(ext2_filsys fs,
1170 if ((*block_nr < fs->super->s_first_data_block) ||
1171 (*block_nr >= ext2fs_blocks_count(fs->super)))
1174 ext2fs_block_alloc_stats2(fs, *block_nr, -1);
1184 ext2_filsys fs = ctx->fs;
1198 ext2fs_inode_alloc_stats2(fs, ino, -1, LINUX_S_ISDIR(inode.i_mode));
1200 if (ext2fs_file_acl_block(fs, &inode) &&
1201 (fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
1202 fs,
1203 ext2fs_file_acl_block(fs, &inode),
1210 pctx.blk = ext2fs_file_acl_block(fs, &inode);
1217 ext2fs_file_acl_block(fs, &inode));
1218 ext2fs_block_alloc_stats2(fs,
1219 ext2fs_file_acl_block(fs, &inode), -1);
1221 ext2fs_file_acl_block_set(fs, &inode, 0);
1224 if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
1233 pctx.errcode = ext2fs_block_iterate3(fs, ino, 0, block_buf,
1265 ext2_filsys fs = ctx->fs;
1280 if (ext2fs_file_acl_block(fs, &inode) &&
1281 !(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
1283 ext2fs_file_acl_block_set(fs, &inode, 0);
1295 && !e2fsck_pass1_check_device_inode(fs, &inode))
1298 && !e2fsck_pass1_check_device_inode(fs, &inode))
1301 && !e2fsck_pass1_check_device_inode(fs, &inode))
1304 && !e2fsck_pass1_check_device_inode(fs, &inode))
1307 && !e2fsck_pass1_check_symlink(fs, ino, &inode, buf)) {
1330 switch (fs->super->s_creator_os) {
1357 if ((fs->super->s_creator_os == EXT2_OS_LINUX) &&
1358 !(fs->super->s_feature_ro_compat &
1368 if (!(fs->super->s_feature_incompat &
1379 if (ext2fs_file_acl_block(fs, &inode) &&
1380 ((ext2fs_file_acl_block(fs, &inode) < fs->super->s_first_data_block) ||
1381 (ext2fs_file_acl_block(fs, &inode) >= ext2fs_blocks_count(fs->super)))) {
1383 ext2fs_file_acl_block_set(fs, &inode, 0);
1416 ext2_filsys fs = ctx->fs;
1433 pctx->errcode = ext2fs_new_block2(fs, 0, ctx->block_found_map, &blk);
1440 ext2fs_mark_block_bitmap2(fs->block_map, blk);
1441 ext2fs_mark_bb_dirty(fs);
1447 pctx->errcode = ext2fs_new_dir_block(fs, 0, 0, &block);
1449 pctx->errcode = ext2fs_new_dir_block(fs, db->ino,
1458 pctx->errcode = ext2fs_write_dir_block3(fs, blk, block, 0);
1470 ext2fs_iblk_add_blocks(fs, &inode, 1);
1471 if (inode.i_size < (db->blockcnt+1) * fs->blocksize)
1472 inode.i_size = (db->blockcnt+1) * fs->blocksize;
1479 pctx->errcode = ext2fs_bmap2(fs, db->ino, &inode, 0, BMAP_SET,