diff --git a/lib/ext2fs/progress.c b/lib/ext2fs/progress.c index 37d15096..1e791fe7 100644 --- a/lib/ext2fs/progress.c +++ b/lib/ext2fs/progress.c @@ -14,6 +14,8 @@ #include "ext2fs.h" #include "ext2fsP.h" +#include + 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); diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 7d597a42..d7e51fc2 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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; diff --git a/tests/f_resize_inode/expect b/tests/f_resize_inode/expect index bbbad603..3fffe44d 100644 --- a/tests/f_resize_inode/expect +++ b/tests/f_resize_inode/expect @@ -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 diff --git a/tests/m_dasd_bs/expect.1 b/tests/m_dasd_bs/expect.1 index a9a2c35b..61f6894b 100644 --- a/tests/m_dasd_bs/expect.1 +++ b/tests/m_dasd_bs/expect.1 @@ -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 diff --git a/tests/m_extent_journal/expect.1 b/tests/m_extent_journal/expect.1 index 9bcac124..aaedf729 100644 --- a/tests/m_extent_journal/expect.1 +++ b/tests/m_extent_journal/expect.1 @@ -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 diff --git a/tests/m_large_file/expect.1 b/tests/m_large_file/expect.1 index c93183bb..59a9b7f9 100644 --- a/tests/m_large_file/expect.1 +++ b/tests/m_large_file/expect.1 @@ -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 diff --git a/tests/m_meta_bg/expect.1 b/tests/m_meta_bg/expect.1 index 49f58981..e7c2b2cc 100644 --- a/tests/m_meta_bg/expect.1 +++ b/tests/m_meta_bg/expect.1 @@ -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 diff --git a/tests/m_mmp/expect.1 b/tests/m_mmp/expect.1 index 63995bbb..1f7737d8 100644 --- a/tests/m_mmp/expect.1 +++ b/tests/m_mmp/expect.1 @@ -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 diff --git a/tests/m_no_opt/expect.1 b/tests/m_no_opt/expect.1 index 13798274..8fa605bb 100644 --- a/tests/m_no_opt/expect.1 +++ b/tests/m_no_opt/expect.1 @@ -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) diff --git a/tests/m_raid_opt/expect.1 b/tests/m_raid_opt/expect.1 index 1cc33301..0c357008 100644 --- a/tests/m_raid_opt/expect.1 +++ b/tests/m_raid_opt/expect.1 @@ -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 diff --git a/tests/m_std/expect.1 b/tests/m_std/expect.1 index b0bcf527..23876ece 100644 --- a/tests/m_std/expect.1 +++ b/tests/m_std/expect.1 @@ -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 diff --git a/tests/m_uninit/expect.1 b/tests/m_uninit/expect.1 index d7971f17..f2852149 100644 --- a/tests/m_uninit/expect.1 +++ b/tests/m_uninit/expect.1 @@ -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