Whamcloud - gitweb
Many files:
authorTheodore Ts'o <tytso@mit.edu>
Mon, 20 Oct 1997 01:38:32 +0000 (01:38 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 20 Oct 1997 01:38:32 +0000 (01:38 +0000)
  Place #ifdef RESOURCE_TRACK around code which uses init_resource_track
  and print_resource_track.  (Not all systems have timeval)

e2fsck/ChangeLog
e2fsck/Makefile.in
e2fsck/e2fsck.h
e2fsck/pass1.c
e2fsck/pass2.c
e2fsck/pass3.c
e2fsck/pass4.c
e2fsck/pass5.c
e2fsck/swapfs.c
e2fsck/unix.c
e2fsck/util.c

index d8de07f..880975f 100644 (file)
@@ -1,5 +1,9 @@
 Sun Oct 19 21:12:11 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
+       * pass*.c, super.c, unix.c, util.c, e2fsck.h: Place #ifdef
+               RESOURCE_TRACK around code which uses init_resource_track
+               and print_resource_track.  (Not all systems have timeval)
+
        * super.c: Remove excess #includes which are not necessary.
 
        * e2fsck.h: Add #ifdef's for HAVE_SYS_TYPES_H and HAVE_SYS_TIME_H
index afb130b..40595e6 100644 (file)
@@ -14,6 +14,7 @@ LDFLAG_STATIC = @LDFLAG_STATIC@
 
 PROGS=         e2fsck @EXTRA_PROGS@
 MANPAGES=      e2fsck.8
+XTRA_CFLAGS=   -DRESOURCE_TRACK
 
 LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBUUID)
 DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBUUID)
index b185d6b..83c5d61 100644 (file)
@@ -59,6 +59,7 @@ struct dir_info {
        ino_t                   parent; /* Parent according to treewalk */
 };
 
+#ifdef RESOURCE_TRACK
 /*
  * This structure is used for keeping track of how much resources have
  * been used for a particular pass of e2fsck.
@@ -69,6 +70,7 @@ struct resource_track {
        struct timeval system_start;
        void    *brk_start;
 };
+#endif
 
 /*
  * E2fsck options
@@ -130,10 +132,12 @@ struct e2fsck_struct {
        int process_inode_size;
        int inode_buffer_blocks;
 
+#ifdef RESOURCE_TRACK
        /*
         * For timing purposes
         */
        struct resource_track   global_rtrack;
+#endif
 
        /* File counts */
        int fs_directory_count;
@@ -215,9 +219,11 @@ extern void fatal_error (const char * fmt_string);
 extern void read_bitmaps(e2fsck_t ctx);
 extern void write_bitmaps(e2fsck_t ctx);
 extern void preenhalt(e2fsck_t ctx);
+#ifdef RESOURCE_TRACK
 extern void print_resource_track(const char *desc,
                                 struct resource_track *track);
 extern void init_resource_track(struct resource_track *track);
+#endif
 extern int inode_has_valid_blocks(struct ext2_inode *inode);
 extern void e2fsck_read_inode(ext2_filsys fs, unsigned long ino,
                              struct ext2_inode * inode, const char * proc);
index bd046d2..bda1a51 100644 (file)
@@ -120,11 +120,15 @@ void pass1(e2fsck_t ctx)
        struct ext2_inode inode;
        ext2_inode_scan scan;
        char            *block_buf;
+#ifdef RESOURCE_TRACK
        struct resource_track   rtrack;
+#endif
        unsigned char   frag, fsize;
        struct          problem_context pctx;
        
+#ifdef RESOURCE_TRACK
        init_resource_track(&rtrack);
+#endif
        clear_problem_context(&pctx);
 
        if (!(ctx->options & E2F_OPT_PREEN))
@@ -435,8 +439,10 @@ endit:
        ext2fs_free_block_bitmap(ctx->block_illegal_map);
        ctx->block_illegal_map = 0;
 
+#ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME2)
                print_resource_track("Pass 1", &rtrack);
+#endif
 }
 
 /*
index bcd8aa2..edb2482 100644 (file)
@@ -70,11 +70,15 @@ void pass2(e2fsck_t ctx)
 {
        ext2_filsys     fs = ctx->fs;
        char    *buf;
+#ifdef RESOURCE_TRACK
        struct resource_track   rtrack;
+#endif
        struct dir_info *dir;
        struct check_dir_struct cd;
                
+#ifdef RESOURCE_TRACK
        init_resource_track(&rtrack);
+#endif
 
        clear_problem_context(&cd.pctx);
 
@@ -120,8 +124,10 @@ void pass2(e2fsck_t ctx)
                ext2fs_free_inode_bitmap(ctx->inode_bad_map);
                ctx->inode_bad_map = 0;
        }
+#ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME2)
                print_resource_track("Pass 2", &rtrack);
+#endif
 }
 
 /*
index 7d7c649..52c19c9 100644 (file)
@@ -59,11 +59,15 @@ void pass3(e2fsck_t ctx)
 {
        ext2_filsys fs = ctx->fs;
        int             i;
+#ifdef RESOURCE_TRACK
        struct resource_track   rtrack;
+#endif
        struct problem_context  pctx;
        struct dir_info *dir;
        
+#ifdef RESOURCE_TRACK
        init_resource_track(&rtrack);
+#endif
 
        clear_problem_context(&pctx);
 
@@ -91,8 +95,10 @@ void pass3(e2fsck_t ctx)
                fix_problem(ctx, PR_3_ALLOCATE_IBITMAP_ERROR, &pctx);
                fatal_error(0);
        }
+#ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME)
                print_resource_track("Peak memory", &ctx->global_rtrack);
+#endif
 
        check_root(ctx);
        ext2fs_mark_inode_bitmap(inode_done_map, EXT2_ROOT_INO);
@@ -106,8 +112,10 @@ void pass3(e2fsck_t ctx)
        free_dir_info(fs);
        ext2fs_free_inode_bitmap(inode_loop_detect);
        ext2fs_free_inode_bitmap(inode_done_map);
+#ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME2)
                print_resource_track("Pass 3", &rtrack);
+#endif
 }
 
 /*
index f5784cf..9b814b4 100644 (file)
@@ -80,11 +80,15 @@ void pass4(e2fsck_t ctx)
        ext2_filsys fs = ctx->fs;
        ino_t   i;
        struct ext2_inode       inode;
+#ifdef RESOURCE_TRACK
        struct resource_track   rtrack;
+#endif
        struct problem_context  pctx;
        __u16   link_count, link_counted;
        
+#ifdef RESOURCE_TRACK
        init_resource_track(&rtrack);
+#endif
 
 #ifdef MTRACE
        mtrace_print("Pass 4");
@@ -133,7 +137,9 @@ void pass4(e2fsck_t ctx)
        ext2fs_free_icount(ctx->inode_count); ctx->inode_count = 0;
        ext2fs_free_inode_bitmap(ctx->inode_bb_map);
        ctx->inode_bb_map = 0;
+#ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME2)
                print_resource_track("Pass 4", &rtrack);
+#endif
 }
 
index 499c92c..be2edd9 100644 (file)
@@ -20,14 +20,18 @@ static void check_block_end(e2fsck_t ctx);
 
 void pass5(e2fsck_t ctx)
 {
+#ifdef RESOURCE_TRACK
        struct resource_track   rtrack;
+#endif
        struct problem_context  pctx;
        
 #ifdef MTRACE
        mtrace_print("Pass 5");
 #endif
 
+#ifdef RESOURCE_TRACK
        init_resource_track(&rtrack);
+#endif
        
        clear_problem_context(&pctx);
 
@@ -48,8 +52,10 @@ void 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)
                print_resource_track("Pass 5", &rtrack);
+#endif
 }
 
 static void check_block_bitmaps(e2fsck_t ctx)
index 64d4775..f6d3d70 100644 (file)
@@ -177,9 +177,11 @@ static void swap_inodes(e2fsck_t ctx)
 void swap_filesys(e2fsck_t ctx)
 {
        ext2_filsys fs = ctx->fs;
+#ifdef RESOURCE_TRACK
        struct resource_track   rtrack;
 
        init_resource_track(&rtrack);
+#endif
 
        if (!(ctx->options & E2F_OPT_PREEN))
                printf("Pass 0: Doing byte-swap of filesystem\n");
@@ -210,8 +212,10 @@ void swap_filesys(e2fsck_t ctx)
                       EXT2_FLAG_SWAP_BYTES_WRITE);
        ext2fs_flush(fs);
        
+#ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME2)
                print_resource_track("Byte swap", &rtrack);
+#endif
 }
 
 
index 7bc0963..1125670 100644 (file)
@@ -288,10 +288,15 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
                        ctx->options &= ~(E2F_OPT_PREEN|E2F_OPT_NO);
                        break;
                case 't':
+#ifdef RESOURCE_TRACK
                        if (ctx->options & E2F_OPT_TIME)
                                ctx->options |= E2F_OPT_TIME2;
                        else
                                ctx->options |= E2F_OPT_TIME;
+#else
+                       fprintf(stderr, "The -t option is not "
+                               "supported on this version of e2fsck.\n");
+#endif
                        break;
                case 'c':
                        cflag++;
@@ -433,7 +438,9 @@ int main (int argc, char *argv[])
                exit(1);
        }
 
+#ifdef RESOURCE_TRACK
        init_resource_track(&ctx->global_rtrack);
+#endif
 
        if (!(ctx->options & E2F_OPT_PREEN) || show_version_only)
                fprintf (stderr, "e2fsck %s, %s for EXT2 FS %s, %s\n",
@@ -642,8 +649,10 @@ restart:
        ext2fs_close(fs);
        sync_disks();
        
+#ifdef RESOURCE_TRACK
        if (ctx->options & E2F_OPT_TIME)
                print_resource_track(NULL, &ctx->global_rtrack);
+#endif
 
        e2fsck_free_context(ctx);
        
index 879e7ba..f676b26 100644 (file)
@@ -175,6 +175,7 @@ void preenhalt(e2fsck_t ctx)
        exit(FSCK_UNCORRECTED);
 }
 
+#ifdef RESOURCE_TRACK
 void init_resource_track(struct resource_track *track)
 {
 #ifdef HAVE_GETRUSAGE
@@ -235,6 +236,7 @@ void print_resource_track(const char *desc, struct resource_track *track)
               timeval_subtract(&time_end, &track->time_start));
 #endif
 }
+#endif /* RESOURCE_TRACK */
 
 void e2fsck_read_inode(ext2_filsys fs, unsigned long ino,
                              struct ext2_inode * inode, const char *proc)