mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2025-01-22 16:33:37 +08:00
mke2fs: throttle allocating groups progress as well
Throttle updates for the "Allocating Groups" progress updates to once a second as well. We now do this throttling in libext2fs, so we don't have to do this for each of mke2fs's progress updates, and because the updates from ext2fs_allocate_tables() come from within libext2fs anyway. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
802f46783c
commit
b2f5ce5516
@ -14,6 +14,8 @@
|
||||
#include "ext2fs.h"
|
||||
#include "ext2fsP.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
static char spaces[80], backspaces[80];
|
||||
|
||||
static int int_log10(unsigned int arg)
|
||||
@ -64,10 +66,16 @@ void ext2fs_numeric_progress_update(ext2_filsys fs,
|
||||
struct ext2fs_numeric_progress_struct * progress,
|
||||
__u64 val)
|
||||
{
|
||||
static time_t now, last_update = 0;
|
||||
|
||||
if (!(fs->flags & EXT2_FLAG_PRINT_PROGRESS))
|
||||
return;
|
||||
if (progress->skip_progress)
|
||||
return;
|
||||
now = time(0);
|
||||
if (now == last_update)
|
||||
return;
|
||||
last_update = now;
|
||||
|
||||
printf("%*llu/%*llu", progress->log_max, val,
|
||||
progress->log_max, progress->max);
|
||||
|
@ -310,7 +310,6 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed)
|
||||
errcode_t retval;
|
||||
blk64_t blk;
|
||||
dgrp_t i;
|
||||
time_t now, last_update = 0;
|
||||
int num;
|
||||
struct ext2fs_numeric_progress_struct progress;
|
||||
|
||||
@ -319,11 +318,8 @@ 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++) {
|
||||
now = time(0);
|
||||
if (now != last_update && no_progress) {
|
||||
if (!no_progress)
|
||||
ext2fs_numeric_progress_update(fs, &progress, i);
|
||||
last_update = now;
|
||||
}
|
||||
|
||||
blk = ext2fs_inode_table_loc(fs, i);
|
||||
num = fs->inode_blocks_per_group;
|
||||
@ -2145,7 +2141,6 @@ static int mke2fs_discard_device(ext2_filsys fs)
|
||||
blk64_t count = DISCARD_STEP_MB;
|
||||
blk64_t cur;
|
||||
int retval = 0;
|
||||
time_t now, last_update = 0;
|
||||
|
||||
/*
|
||||
* Let's try if discard really works on the device, so
|
||||
@ -2164,11 +2159,8 @@ static int mke2fs_discard_device(ext2_filsys fs)
|
||||
_("Discarding device blocks: "),
|
||||
blocks);
|
||||
while (cur < blocks) {
|
||||
now = time(0);
|
||||
if (now != last_update && !no_progress) {
|
||||
if (!no_progress)
|
||||
ext2fs_numeric_progress_update(fs, &progress, cur);
|
||||
last_update = now;
|
||||
}
|
||||
|
||||
if (cur + count > blocks)
|
||||
count = blocks - cur;
|
||||
|
@ -14,9 +14,9 @@ Maximum filesystem blocks=8421376
|
||||
Superblock backups stored on blocks:
|
||||
1025, 3073, 5121, 7169, 9217
|
||||
|
||||
Allocating group tables: 0/16 1/16 2/16 3/16 4/16 5/16 6/16 7/16 8/16 9/1610/1611/1612/1613/1614/1615/16 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/16 1/16 2/16 3/16 4/16 5/16 6/16 7/16 8/16 9/1610/1611/1612/1613/1614/1615/16 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Pass 1: Checking inodes, blocks, and sizes
|
||||
Pass 2: Checking directory structure
|
||||
|
@ -13,9 +13,9 @@ Maximum filesystem blocks=33554432
|
||||
Superblock backups stored on blocks:
|
||||
16384
|
||||
|
||||
Allocating group tables: 0/21/2 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/21/2 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super
|
||||
|
||||
|
@ -13,10 +13,10 @@ Maximum filesystem blocks=67108864
|
||||
Superblock backups stored on blocks:
|
||||
8193, 24577, 40961, 57345
|
||||
|
||||
Allocating group tables: 0/81/82/83/84/85/86/87/8 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Creating journal (4096 blocks): done
|
||||
Writing superblocks and filesystem accounting information: 0/81/82/83/84/85/86/87/8 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent sparse_super
|
||||
|
||||
|
@ -11,9 +11,9 @@ Maximum filesystem blocks=16777216
|
||||
32768 blocks per group, 32768 fragments per group
|
||||
64 inodes per group
|
||||
|
||||
Allocating group tables: 0/1 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/1 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super large_file
|
||||
|
||||
|
@ -12,9 +12,9 @@ First data block=1
|
||||
Superblock backups stored on blocks:
|
||||
1025, 3073, 5121, 7169, 9217, 25601, 27649, 50177, 82945, 128001
|
||||
|
||||
Allocating group tables: 0/128 1/128 2/128 3/128 4/128 5/128 6/128 7/128 8/128 9/128 10/128 11/128 12/128 13/128 14/128 15/128 16/128 17/128 18/128 19/128 20/128 21/128 22/128 23/128 24/128 25/128 26/128 27/128 28/128 29/128 30/128 31/128 32/128 33/128 34/128 35/128 36/128 37/128 38/128 39/128 40/128 41/128 42/128 43/128 44/128 45/128 46/128 47/128 48/128 49/128 50/128 51/128 52/128 53/128 54/128 55/128 56/128 57/128 58/128 59/128 60/128 61/128 62/128 63/128 64/128 65/128 66/128 67/128 68/128 69/128 70/128 71/128 72/128 73/128 74/128 75/128 76/128 77/128 78/128 79/128 80/128 81/128 82/128 83/128 84/128 85/128 86/128 87/128 88/128 89/128 90/128 91/128 92/128 93/128 94/128 95/128 96/128 97/128 98/128 99/128100/128101/128102/128103/128104/128105/128106/128107/128108/128109/128110/128111/128112/128113/128114/128115/128116/128117/128118/128119/128120/128121/128122/128123/128124/128125/128126/128127/128 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/128 1/128 2/128 3/128 4/128 5/128 6/128 7/128 8/128 9/128 10/128 11/128 12/128 13/128 14/128 15/128 16/128 17/128 18/128 19/128 20/128 21/128 22/128 23/128 24/128 25/128 26/128 27/128 28/128 29/128 30/128 31/128 32/128 33/128 34/128 35/128 36/128 37/128 38/128 39/128 40/128 41/128 42/128 43/128 44/128 45/128 46/128 47/128 48/128 49/128 50/128 51/128 52/128 53/128 54/128 55/128 56/128 57/128 58/128 59/128 60/128 61/128 62/128 63/128 64/128 65/128 66/128 67/128 68/128 69/128 70/128 71/128 72/128 73/128 74/128 75/128 76/128 77/128 78/128 79/128 80/128 81/128 82/128 83/128 84/128 85/128 86/128 87/128 88/128 89/128 90/128 91/128 92/128 93/128 94/128 95/128 96/128 97/128 98/128 99/128100/128101/128102/128103/128104/128105/128106/128107/128108/128109/128110/128111/128112/128113/128114/128115/128116/128117/128118/128119/128120/128121/128122/128123/128124/128125/128126/128127/128 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: ext_attr dir_index filetype meta_bg sparse_super
|
||||
|
||||
|
@ -13,10 +13,10 @@ Maximum filesystem blocks=67108864
|
||||
Superblock backups stored on blocks:
|
||||
32768
|
||||
|
||||
Allocating group tables: 0/21/2 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Multiple mount protection is enabled with update interval 5 seconds.
|
||||
Writing superblocks and filesystem accounting information: 0/21/2 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: ext_attr resize_inode dir_index filetype mmp sparse_super large_file
|
||||
|
||||
|
@ -12,9 +12,9 @@ First data block=1
|
||||
Superblock backups stored on blocks:
|
||||
8193, 16385, 24577, 32769, 40961, 49153, 57345
|
||||
|
||||
Allocating group tables: 0/81/82/83/84/85/86/87/8 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/81/82/83/84/85/86/87/8 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features:(none)
|
||||
|
||||
|
@ -13,9 +13,9 @@ Maximum filesystem blocks=8519680
|
||||
Superblock backups stored on blocks:
|
||||
1025, 3073, 5121, 7169, 9217, 25601, 27649, 50177, 82945, 128001
|
||||
|
||||
Allocating group tables: 0/128 1/128 2/128 3/128 4/128 5/128 6/128 7/128 8/128 9/128 10/128 11/128 12/128 13/128 14/128 15/128 16/128 17/128 18/128 19/128 20/128 21/128 22/128 23/128 24/128 25/128 26/128 27/128 28/128 29/128 30/128 31/128 32/128 33/128 34/128 35/128 36/128 37/128 38/128 39/128 40/128 41/128 42/128 43/128 44/128 45/128 46/128 47/128 48/128 49/128 50/128 51/128 52/128 53/128 54/128 55/128 56/128 57/128 58/128 59/128 60/128 61/128 62/128 63/128 64/128 65/128 66/128 67/128 68/128 69/128 70/128 71/128 72/128 73/128 74/128 75/128 76/128 77/128 78/128 79/128 80/128 81/128 82/128 83/128 84/128 85/128 86/128 87/128 88/128 89/128 90/128 91/128 92/128 93/128 94/128 95/128 96/128 97/128 98/128 99/128100/128101/128102/128103/128104/128105/128106/128107/128108/128109/128110/128111/128112/128113/128114/128115/128116/128117/128118/128119/128120/128121/128122/128123/128124/128125/128126/128127/128 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/128 1/128 2/128 3/128 4/128 5/128 6/128 7/128 8/128 9/128 10/128 11/128 12/128 13/128 14/128 15/128 16/128 17/128 18/128 19/128 20/128 21/128 22/128 23/128 24/128 25/128 26/128 27/128 28/128 29/128 30/128 31/128 32/128 33/128 34/128 35/128 36/128 37/128 38/128 39/128 40/128 41/128 42/128 43/128 44/128 45/128 46/128 47/128 48/128 49/128 50/128 51/128 52/128 53/128 54/128 55/128 56/128 57/128 58/128 59/128 60/128 61/128 62/128 63/128 64/128 65/128 66/128 67/128 68/128 69/128 70/128 71/128 72/128 73/128 74/128 75/128 76/128 77/128 78/128 79/128 80/128 81/128 82/128 83/128 84/128 85/128 86/128 87/128 88/128 89/128 90/128 91/128 92/128 93/128 94/128 95/128 96/128 97/128 98/128 99/128100/128101/128102/128103/128104/128105/128106/128107/128108/128109/128110/128111/128112/128113/128114/128115/128116/128117/128118/128119/128120/128121/128122/128123/128124/128125/128126/128127/128 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super
|
||||
|
||||
|
@ -13,9 +13,9 @@ Maximum filesystem blocks=67108864
|
||||
Superblock backups stored on blocks:
|
||||
8193, 24577, 40961, 57345
|
||||
|
||||
Allocating group tables: 0/81/82/83/84/85/86/87/8 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/81/82/83/84/85/86/87/8 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super
|
||||
|
||||
|
@ -13,9 +13,9 @@ Maximum filesystem blocks=67371008
|
||||
Superblock backups stored on blocks:
|
||||
8193, 24577, 40961, 57345, 73729
|
||||
|
||||
Allocating group tables: 0/16 1/16 2/16 3/16 4/16 5/16 6/16 7/16 8/16 9/1610/1611/1612/1613/1614/1615/16 done
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Writing superblocks and filesystem accounting information: 0/16 1/16 2/16 3/16 4/16 5/16 6/16 7/16 8/16 9/1610/1611/1612/1613/1614/1615/16 done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
Filesystem features: ext_attr resize_inode dir_index filetype sparse_super uninit_bg
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user