Whamcloud - gitweb
In e2fsck, if the number of mounts until the next forced filesystem
authorTheodore Ts'o <tytso@mit.edu>
Fri, 21 Nov 2003 15:54:54 +0000 (10:54 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 21 Nov 2003 15:54:54 +0000 (10:54 -0500)
check is 5 or less, mention this to the user.  (Addresses
Debian bug #157194)

e2fsck/ChangeLog
e2fsck/unix.c

index 094555a..8724eb2 100644 (file)
@@ -1,5 +1,9 @@
 2003-09-13  Theodore Ts'o  <tytso@mit.edu>
 
+       * unix.c (check_if_skip): If the number of mounts until the next
+               forced filesystem check is 5 or less, mention this to the
+               user.  (Addresses Debian bug #157194)
+
        * pass1.c (e2fsck_pass1), problem.h (PR_1_BB_FS_BLOCK), 
          problem.c (PR_1_BB_FS_BLOCK, PR_1_BBINODE_BAD_METABLOCK_PROMPT): 
                Fix up the handling of corrupted indirect blocks in the 
index 9109773..211a127 100644 (file)
@@ -209,6 +209,8 @@ static void check_if_skip(e2fsck_t ctx)
        ext2_filsys fs = ctx->fs;
        const char *reason = NULL;
        unsigned int reason_arg = 0;
+       long next_check;
+       time_t now = time(0);
        
        if ((ctx->options & E2F_OPT_FORCE) || bad_blocks_file ||
            cflag || swapfs)
@@ -224,10 +226,10 @@ static void check_if_skip(e2fsck_t ctx)
                reason = _(" has been mounted %u times without being checked");
                reason_arg = fs->super->s_mnt_count;
        } else if (fs->super->s_checkinterval &&
-                time(0) >= (fs->super->s_lastcheck +
+                now >= (fs->super->s_lastcheck +
                             fs->super->s_checkinterval)) {
                reason = _(" has gone %u days without being checked");
-               reason_arg = (time(0) - fs->super->s_lastcheck)/(3600*24);
+               reason_arg = (now - fs->super->s_lastcheck)/(3600*24);
        }
        if (reason) {
                fputs(ctx->device_name, stdout);
@@ -235,11 +237,26 @@ static void check_if_skip(e2fsck_t ctx)
                fputs(_(", check forced.\n"), stdout);
                return;
        }
-       printf(_("%s: clean, %d/%d files, %d/%d blocks\n"), ctx->device_name,
+       printf(_("%s: clean, %d/%d files, %d/%d blocks"), ctx->device_name,
               fs->super->s_inodes_count - fs->super->s_free_inodes_count,
               fs->super->s_inodes_count,
               fs->super->s_blocks_count - fs->super->s_free_blocks_count,
               fs->super->s_blocks_count);
+       next_check = 100000;
+       if (fs->super->s_max_mnt_count > 0) {
+               next_check = fs->super->s_max_mnt_count - fs->super->s_mnt_count;
+               if (next_check <= 0) 
+                       next_check = 1;
+       }
+       if (now >= (fs->super->s_lastcheck + fs->super->s_checkinterval))
+               next_check = 1;
+       if (next_check <= 5) {
+               if (next_check == 1)
+                       fputs(_(" (check after next mount)"), stdout);
+               else
+                       printf(_(" (check in %d mounts)"), next_check);
+       }
+       fputc('\n', stdout);
        ext2fs_close(fs);
        ctx->fs = NULL;
        e2fsck_free_context(ctx);