- ext2fs_mark_inode_bitmap(inode_done_map, EXT2_ROOT_INO);
-
- for (i=0; (dir = dir_info_iter(&i)) != 0;) {
- if (ext2fs_test_inode_bitmap(ctx->inode_dir_map, dir->ino))
- check_directory(ctx, dir, &pctx);
- }
-
-
- free_dir_info(fs);
- ext2fs_free_inode_bitmap(inode_loop_detect);
- ext2fs_free_inode_bitmap(inode_done_map);
- if (ctx->options & E2F_OPT_TIME2)
- print_resource_track("Pass 3", &rtrack);
+ if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
+ goto abort_exit;
+
+ ext2fs_mark_inode_bitmap2(inode_done_map, EXT2_ROOT_INO);
+
+ maxdirs = e2fsck_get_num_dirinfo(ctx);
+ count = 1;
+
+ if (ctx->progress)
+ if ((ctx->progress)(ctx, 3, 0, maxdirs))
+ goto abort_exit;
+
+ iter = e2fsck_dir_info_iter_begin(ctx);
+ while ((dir = e2fsck_dir_info_iter(ctx, iter)) != 0) {
+ if (ctx->flags & E2F_FLAG_SIGNAL_MASK ||
+ ctx->flags & E2F_FLAG_RESTART)
+ goto abort_exit;
+ if (ctx->progress && (ctx->progress)(ctx, 3, count++, maxdirs))
+ goto abort_exit;
+ if (ext2fs_test_inode_bitmap2(ctx->inode_dir_map, dir->ino))
+ if (check_directory(ctx, dir->ino, &pctx))
+ goto abort_exit;
+ }
+
+ /*
+ * Force the creation of /lost+found if not present
+ */
+ if ((ctx->options & E2F_OPT_READONLY) == 0)
+ e2fsck_get_lost_and_found(ctx, 1);
+
+ /*
+ * If there are any directories that need to be indexed or
+ * optimized, do it here.
+ */
+ e2fsck_rehash_directories(ctx);
+
+abort_exit:
+ if (iter)
+ e2fsck_dir_info_iter_end(ctx, iter);
+ e2fsck_free_dir_info(ctx);
+ if (inode_loop_detect) {
+ ext2fs_free_inode_bitmap(inode_loop_detect);
+ inode_loop_detect = 0;
+ }
+ if (inode_done_map) {
+ ext2fs_free_inode_bitmap(inode_done_map);
+ inode_done_map = 0;
+ }
+
+ if (ctx->lnf_repair_block) {
+ ext2fs_unmark_block_bitmap2(ctx->block_found_map,
+ ctx->lnf_repair_block);
+ ctx->lnf_repair_block = 0;
+ }
+ if (ctx->root_repair_block) {
+ ext2fs_unmark_block_bitmap2(ctx->block_found_map,
+ ctx->root_repair_block);
+ ctx->root_repair_block = 0;
+ }
+
+ print_resource_track(ctx, _("Pass 3"), &rtrack, ctx->fs->io);