diff mbox

[v3,13/22] progress: Allow regressing progress

Message ID 1416503198-17031-14-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz Nov. 20, 2014, 5:06 p.m. UTC
Progress may regress; this should be displayed correctly by
qemu_progress_print().

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 util/qemu-progress.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Eric Blake Nov. 20, 2014, 10:29 p.m. UTC | #1
On 11/20/2014 10:06 AM, Max Reitz wrote:
> Progress may regress; this should be displayed correctly by
> qemu_progress_print().
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  util/qemu-progress.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/util/qemu-progress.c b/util/qemu-progress.c
> index 4ee5cd0..c0fb14d 100644
> --- a/util/qemu-progress.c
> +++ b/util/qemu-progress.c
> @@ -152,6 +152,7 @@ void qemu_progress_print(float delta, int max)
>      state.current = current;
>  
>      if (current > (state.last_print + state.min_skip) ||
> +        current < (state.last_print - state.min_skip) ||
>          (current == 100) || (current == 0)) {

Maybe we can drop the redundant () as long as we are touching this area
of code?  But not worth a respin.
Stefan Hajnoczi Nov. 28, 2014, 1:17 p.m. UTC | #2
On Thu, Nov 20, 2014 at 06:06:29PM +0100, Max Reitz wrote:
> Progress may regress; this should be displayed correctly by
> qemu_progress_print().
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  util/qemu-progress.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox

Patch

diff --git a/util/qemu-progress.c b/util/qemu-progress.c
index 4ee5cd0..c0fb14d 100644
--- a/util/qemu-progress.c
+++ b/util/qemu-progress.c
@@ -152,6 +152,7 @@  void qemu_progress_print(float delta, int max)
     state.current = current;
 
     if (current > (state.last_print + state.min_skip) ||
+        current < (state.last_print - state.min_skip) ||
         (current == 100) || (current == 0)) {
         state.last_print = state.current;
         state.print();