[PATCH] Fix initialization of lastrate when using ratemin

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

fio was copying td->bw_sample_time (single timeval) into td->lastrate
(array of two timevals) using the latter's size. Thus is would get one
timeval worth of good data plus who-knows-what for the second timeval.
I'm pretty sure the intent of this code was to copy bw_sample_time
into both members of lastrate.
 fio.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fio.c b/fio.c
index 9063c03..6ba445d 100644
--- a/fio.c
+++ b/fio.c
@@ -1284,9 +1284,12 @@ static void *thread_main(void *data)
 		memcpy(&td->iops_sample_time, &td->start, sizeof(td->start));
 		memcpy(&td->tv_cache, &td->start, sizeof(td->start));
-		if (td->o.ratemin[0] || td->o.ratemin[1])
-			memcpy(&td->lastrate, &td->bw_sample_time,
-							sizeof(td->lastrate));
+		if (td->o.ratemin[0] || td->o.ratemin[1]) {
+		        memcpy(&td->lastrate[0], &td->bw_sample_time,
+						sizeof(td->bw_sample_time));
+		        memcpy(&td->lastrate[1], &td->bw_sample_time,
+						sizeof(td->bw_sample_time));
+		}
 		if (clear_state)

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

[Home]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Video Projectors]     [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Powered by Linux