[PATCH 2/5] blkdiscard: fix stats reporting (off by one)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>

CC: Federico Simoncelli <fsimonce@xxxxxxxxxx>
Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
 sys-utils/blkdiscard.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c
index a853a35..bb4bae6 100644
--- a/sys-utils/blkdiscard.c
+++ b/sys-utils/blkdiscard.c
@@ -197,18 +197,18 @@ int main(int argc, char **argv)
 				err(EXIT_FAILURE, _("%s: BLKDISCARD ioctl failed"), path);
 		}
 
+		stats[1] += range[1];
+
 		/* reporting progress at most once per second */
 		if (verbose && step) {
 			gettime_monotonic(&now);
 			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;
+				stats[0] += stats[1], stats[1] = 0;
 				last = now;
 			}
 		}
-
-		stats[1] += range[1];
 	}
 
 	if (verbose)
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux