Lines Matching refs:ino
45 static int check_directory(e2fsck_t ctx, ext2_ino_t ino,
47 static void fix_dotdot(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent);
106 if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, dir->ino)) in e2fsck_pass3()
107 if (check_directory(ctx, dir->ino, &pctx)) in e2fsck_pass3()
265 ext2_ino_t ino = dir, parent; in check_directory() local
279 if (ext2fs_mark_inode_bitmap2(inode_done_map, ino)) in check_directory()
282 if (e2fsck_dir_info_get_parent(ctx, ino, &parent)) { in check_directory()
296 pctx->ino = ino; in check_directory()
298 if (e2fsck_reconnect_file(ctx, pctx->ino)) in check_directory()
301 fix_dotdot(ctx, pctx->ino, in check_directory()
308 ino = parent; in check_directory()
310 ext2fs_mark_inode_bitmap2(inode_loop_detect, ino); in check_directory()
331 ino = dir; in check_directory()
339 pctx->ino = dir; in check_directory()
359 ext2_ino_t ino; in e2fsck_get_lost_and_found() local
373 sizeof(name)-1, 0, &ino); in e2fsck_get_lost_and_found()
377 if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino)) { in e2fsck_get_lost_and_found()
378 ctx->lost_and_found = ino; in e2fsck_get_lost_and_found()
379 return ino; in e2fsck_get_lost_and_found()
385 pctx.ino = ino; in e2fsck_get_lost_and_found()
390 pctx.errcode = ext2fs_unlink(fs, EXT2_ROOT_INO, name, ino, 0); in e2fsck_get_lost_and_found()
396 (void) e2fsck_dir_info_set_parent(ctx, ino, 0); in e2fsck_get_lost_and_found()
397 e2fsck_adjust_inode_count(ctx, ino, -1); in e2fsck_get_lost_and_found()
427 ctx->inode_used_map, &ino); in e2fsck_get_lost_and_found()
433 ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); in e2fsck_get_lost_and_found()
434 ext2fs_mark_inode_bitmap2(ctx->inode_dir_map, ino); in e2fsck_get_lost_and_found()
435 ext2fs_inode_alloc_stats2(fs, ino, +1, 1); in e2fsck_get_lost_and_found()
440 retval = ext2fs_new_dir_block(fs, ino, EXT2_ROOT_INO, &block); in e2fsck_get_lost_and_found()
469 pctx.errcode = ext2fs_write_new_inode(fs, ino, &inode); in e2fsck_get_lost_and_found()
478 pctx.errcode = ext2fs_link(fs, EXT2_ROOT_INO, name, ino, EXT2_FT_DIR); in e2fsck_get_lost_and_found()
488 e2fsck_add_dir_info(ctx, ino, EXT2_ROOT_INO); in e2fsck_get_lost_and_found()
490 ext2fs_icount_store(ctx->inode_count, ino, 2); in e2fsck_get_lost_and_found()
491 ext2fs_icount_store(ctx->inode_link_info, ino, 2); in e2fsck_get_lost_and_found()
492 ctx->lost_and_found = ino; in e2fsck_get_lost_and_found()
493 quota_data_add(ctx->qctx, &inode, ino, fs->blocksize); in e2fsck_get_lost_and_found()
494 quota_data_inodes(ctx->qctx, &inode, ino, +1); in e2fsck_get_lost_and_found()
496 printf("/lost+found created; inode #%lu\n", ino); in e2fsck_get_lost_and_found()
498 return ino; in e2fsck_get_lost_and_found()
504 int e2fsck_reconnect_file(e2fsck_t ctx, ext2_ino_t ino) in e2fsck_reconnect_file() argument
514 pctx.ino = ino; in e2fsck_reconnect_file()
525 sprintf(name, "#%u", ino); in e2fsck_reconnect_file()
526 if (ext2fs_read_inode(fs, ino, &inode) == 0) in e2fsck_reconnect_file()
528 retval = ext2fs_link(fs, ctx->lost_and_found, name, ino, file_type); in e2fsck_reconnect_file()
540 ino, file_type); in e2fsck_reconnect_file()
547 e2fsck_adjust_inode_count(ctx, ino, 1); in e2fsck_reconnect_file()
555 errcode_t e2fsck_adjust_inode_count(e2fsck_t ctx, ext2_ino_t ino, int adj) in e2fsck_adjust_inode_count() argument
561 if (!ino) in e2fsck_adjust_inode_count()
564 retval = ext2fs_read_inode(fs, ino, &inode); in e2fsck_adjust_inode_count()
569 printf("Adjusting link count for inode %lu by %d (from %d)\n", ino, adj, in e2fsck_adjust_inode_count()
574 ext2fs_icount_increment(ctx->inode_count, ino, 0); in e2fsck_adjust_inode_count()
577 ext2fs_icount_increment(ctx->inode_link_info, ino, 0); in e2fsck_adjust_inode_count()
580 ext2fs_icount_decrement(ctx->inode_count, ino, 0); in e2fsck_adjust_inode_count()
583 ext2fs_icount_decrement(ctx->inode_link_info, ino, 0); in e2fsck_adjust_inode_count()
587 retval = ext2fs_write_inode(fs, ino, &inode); in e2fsck_adjust_inode_count()
643 static void fix_dotdot(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent) in fix_dotdot() argument
656 printf("Fixing '..' of inode %lu to be %lu...\n", ino, parent); in fix_dotdot()
660 pctx.ino = ino; in fix_dotdot()
661 retval = ext2fs_dir_iterate(fs, ino, DIRENT_FLAG_INCLUDE_EMPTY, in fix_dotdot()
669 (void) e2fsck_dir_info_set_dotdot(ctx, ino, parent); in fix_dotdot()
670 if (e2fsck_dir_info_set_parent(ctx, ino, ctx->lost_and_found)) in fix_dotdot()