diff options
author | Ruediger Meier | 2015-12-09 09:36:14 +0100 |
---|---|---|
committer | Ruediger Meier | 2015-12-09 18:23:29 +0100 |
commit | 0e765365798c54d412e355798ad584a52035f228 (patch) | |
tree | e45dd96d7528b2367bb500f6bca1439847d99af0 /sys-utils/blkdiscard.c | |
parent | libmount: use fstatat(AT_NO_AUTOMOUNT) for mountpoints (diff) | |
download | kernel-qcow2-util-linux-0e765365798c54d412e355798ad584a52035f228.tar.gz kernel-qcow2-util-linux-0e765365798c54d412e355798ad584a52035f228.tar.xz kernel-qcow2-util-linux-0e765365798c54d412e355798ad584a52035f228.zip |
blkdiscard: fix timeval comparison inclusive usecs
We will see if this makes our "--step" tests reliable.
CC: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'sys-utils/blkdiscard.c')
-rw-r--r-- | sys-utils/blkdiscard.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c index 150689a62..a853a3519 100644 --- a/sys-utils/blkdiscard.c +++ b/sys-utils/blkdiscard.c @@ -197,10 +197,11 @@ int main(int argc, char **argv) err(EXIT_FAILURE, _("%s: BLKDISCARD ioctl failed"), path); } - /* reporting progress */ + /* reporting progress at most once per second */ if (verbose && step) { gettime_monotonic(&now); - if (last.tv_sec < now.tv_sec) { + if (now.tv_sec > last.tv_sec && + (now.tv_usec >= last.tv_usec || now.tv_sec > last.tv_sec + 1)) { print_stats(path, stats); stats[0] = range[0], stats[1] = 0; last = now; |