Whamcloud - gitweb
e2fsck: Don't set the group descriptor checksums if the fsck was cancelled
[tools/e2fsprogs.git] / e2fsck / pass5.c
index cc17820..bc3bf02 100644 (file)
@@ -1,13 +1,13 @@
 /*
  * pass5.c --- check block and inode bitmaps against on-disk bitmaps
- * 
+ *
  * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o.
  *
  * %Begin-Header%
  * This file may be redistributed under the terms of the GNU Public
  * License.
  * %End-Header%
- * 
+ *
  */
 
 #include "e2fsck.h"
@@ -24,15 +24,12 @@ void e2fsck_pass5(e2fsck_t ctx)
        struct resource_track   rtrack;
 #endif
        struct problem_context  pctx;
-       
+
 #ifdef MTRACE
        mtrace_print("Pass 5");
 #endif
 
-#ifdef RESOURCE_TRACK
        init_resource_track(&rtrack, ctx->fs->io);
-#endif
-       
        clear_problem_context(&pctx);
 
        if (!(ctx->options & E2F_OPT_PREEN))
@@ -64,12 +61,7 @@ void e2fsck_pass5(e2fsck_t ctx)
        ext2fs_free_block_bitmap(ctx->block_found_map);
        ctx->block_found_map = 0;
 
-#ifdef RESOURCE_TRACK
-       if (ctx->options & E2F_OPT_TIME2) {
-               e2fsck_clear_progbar(ctx);
-               print_resource_track(_("Pass 5"), &rtrack, ctx->fs->io);
-       }
-#endif
+       print_resource_track(ctx, _("Pass 5"), &rtrack, ctx->fs->io);
 }
 
 #define NO_BLK ((blk_t) -1)
@@ -111,7 +103,7 @@ static void print_bitmap_problem(e2fsck_t ctx, int problem,
 static void check_block_bitmaps(e2fsck_t ctx)
 {
        ext2_filsys fs = ctx->fs;
-       blk_t   i, super;
+       blk_t   i;
        int     *free_array;
        int     group = 0;
        blk_t   blocks = 0;
@@ -167,7 +159,6 @@ redo_counts:
        if (csum_flag &&
            (fs->group_desc[group].bg_flags & EXT2_BG_BLOCK_UNINIT))
                skip_group++;
-       super = fs->super->s_first_data_block;
        for (i = fs->super->s_first_data_block;
             i < fs->super->s_blocks_count;
             i++) {
@@ -263,7 +254,6 @@ redo_counts:
                        blocks = 0;
                        group_free = 0;
                        skip_group = 0;
-                       super += fs->super->s_blocks_per_group;
                        if (ctx->progress)
                                if ((ctx->progress)(ctx, 5, group,
                                                    fs->group_desc_count*2))
@@ -571,11 +561,11 @@ static void check_inode_end(e2fsck_t ctx)
        if (save_inodes_count == end)
                return;
 
-       /* protect loop from wrap-around if end is maxed */     
+       /* protect loop from wrap-around if end is maxed */
        for (i = save_inodes_count + 1; i <= end && i > save_inodes_count; i++) {
                if (!ext2fs_test_inode_bitmap(fs->inode_map, i)) {
                        if (fix_problem(ctx, PR_5_INODE_BMAP_PADDING, &pctx)) {
-                               for (i = save_inodes_count + 1; i <= end; i++)
+                               for (; i <= end; i++)
                                        ext2fs_mark_inode_bitmap(fs->inode_map,
                                                                 i);
                                ext2fs_mark_ib_dirty(fs);
@@ -616,11 +606,11 @@ static void check_block_end(e2fsck_t ctx)
        if (save_blocks_count == end)
                return;
 
-       /* Protect loop from wrap-around if end is maxed */     
+       /* Protect loop from wrap-around if end is maxed */
        for (i = save_blocks_count + 1; i <= end && i > save_blocks_count; i++) {
                if (!ext2fs_test_block_bitmap(fs->block_map, i)) {
                        if (fix_problem(ctx, PR_5_BLOCK_BMAP_PADDING, &pctx)) {
-                               for (i = save_blocks_count + 1; i <= end; i++)
+                               for (; i <= end; i++)
                                        ext2fs_mark_block_bitmap(fs->block_map,
                                                                 i);
                                ext2fs_mark_bb_dirty(fs);