mke2fs: fix progress suppression to make regression tests reliable

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize v1.42.6
Theodore Ts'o 2012-09-22 21:26:48 -04:00
parent 11e5292266
commit c498cb11d3
3 changed files with 10 additions and 13 deletions

View File

@ -17,6 +17,7 @@
#include <time.h>
static char spaces[80], backspaces[80];
static time_t last_update;
static int int_log10(unsigned int arg)
{
@ -44,11 +45,11 @@ void ext2fs_numeric_progress_init(ext2_filsys fs,
spaces[sizeof(spaces)-1] = 0;
memset(backspaces, '\b', sizeof(backspaces)-1);
backspaces[sizeof(backspaces)-1] = 0;
progress->skip_progress = 0;
memset(progress, 0, sizeof(*progress));
if (getenv("E2FSPROGS_SKIP_PROGRESS"))
progress->skip_progress++;
memset(progress, 0, sizeof(*progress));
/*
* Figure out how many digits we need
@ -60,13 +61,14 @@ void ext2fs_numeric_progress_init(ext2_filsys fs,
fputs(label, stdout);
fflush(stdout);
}
last_update = 0;
}
void ext2fs_numeric_progress_update(ext2_filsys fs,
struct ext2fs_numeric_progress_struct * progress,
__u64 val)
{
static time_t now, last_update = 0;
time_t now;
if (!(fs->flags & EXT2_FLAG_PRINT_PROGRESS))
return;

View File

@ -94,7 +94,6 @@ int lazy_itable_init;
char *bad_blocks_filename;
__u32 fs_stride;
int quotatype = -1; /* Initialize both user and group quotas by default */
int no_progress;
struct ext2_super_block fs_param;
char *fs_uuid = NULL;
@ -318,8 +317,7 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed)
fs->group_desc_count);
for (i = 0; i < fs->group_desc_count; i++) {
if (!no_progress)
ext2fs_numeric_progress_update(fs, &progress, i);
ext2fs_numeric_progress_update(fs, &progress, i);
blk = ext2fs_inode_table_loc(fs, i);
num = fs->inode_blocks_per_group;
@ -531,8 +529,7 @@ static void create_journal_dev(ext2_filsys fs)
}
blk += c;
count -= c;
if (!no_progress)
ext2fs_numeric_progress_update(fs, &progress, blk);
ext2fs_numeric_progress_update(fs, &progress, blk);
}
ext2fs_zero_blocks2(0, 0, 0, 0, 0);
@ -1889,8 +1886,6 @@ profile_error:
blocksize, sys_page_size);
}
profile_get_boolean(profile, "options", "no_progress", 0, 0,
&no_progress);
lazy_itable_init = 0;
if (access("/sys/fs/ext4/features/lazy_itable_init", R_OK) == 0)
lazy_itable_init = 1;
@ -2159,8 +2154,7 @@ static int mke2fs_discard_device(ext2_filsys fs)
_("Discarding device blocks: "),
blocks);
while (cur < blocks) {
if (!no_progress)
ext2fs_numeric_progress_update(fs, &progress, cur);
ext2fs_numeric_progress_update(fs, &progress, cur);
if (cur + count > blocks)
count = blocks - cur;

View File

@ -31,4 +31,5 @@ E2FSCK_CONFIG=/dev/null
export E2FSCK_CONFIG
MKE2FS_CONFIG=./mke2fs.conf
export MKE2FS_CONFIG
E2FSPROGS_SKIP_PROGRESS=yes
export E2FSPROGS_SKIP_PROGRESS