unsigned long kb;
unsigned long io_blocks;
unsigned long io_kb;
+ unsigned long this_io_kb;
unsigned long last_kb;
sem_t mutex;
struct drand48_data random_state;
buflen = (buflen + td->min_bs - 1) & ~(td->min_bs - 1);
}
- if (buflen > ((td->kb - td->io_kb) << 10))
- buflen = (td->kb - td->io_kb) << 10;
+ if (buflen > ((td->kb - td->this_io_kb) << 10))
+ buflen = (td->kb - td->this_io_kb) << 10;
td->last_kb += buflen >> 10;
return buflen;
if (spent < td->bw_avg_time)
return;
- rate = ((td->io_kb - td->stat_io_kb) * 1024) / spent;
+ rate = ((td->this_io_kb - td->stat_io_kb) * 1024) / spent;
add_stat_sample(td, &td->bw_stat, rate);
if (td->bw_log)
add_log_sample(td, td->bw_log, rate);
gettimeofday(&td->stat_sample_time, NULL);
- td->stat_io_kb = td->io_kb;
+ td->stat_io_kb = td->this_io_kb;
}
static void usec_sleep(int usec)
if (spent < td->ratecycle)
return 0;
- rate = ((td->io_kb - td->rate_kb) * 1024) / spent;
+ rate = ((td->this_io_kb - td->rate_kb) * 1024) / spent;
if (rate < td->ratemin) {
printf("Client%d: min rate %d not met, got %ldKiB/sec\n", td->thread_number, td->ratemin, rate);
if (rate_quit)
}
}
- td->rate_kb = td->io_kb;
+ td->rate_kb = td->this_io_kb;
memcpy(&td->lastrate, now, sizeof(*now));
return 0;
}
break;
if (back) {
+ ret -= back;
if (lseek(td->fd, -back, SEEK_CUR) < 0) {
td->error = errno;
break;
td->cur_off = 0;
td->last_kb = 0;
- for (td->io_kb = 0; td->io_kb < td->kb;) {
+ for (td->this_io_kb = 0; td->this_io_kb < td->kb;) {
int ret;
if (td->terminate)
td->io_blocks++;
td->io_kb += io_u->buflen >> 10;
+ td->this_io_kb += io_u->buflen >> 10;
td->cur_off = io_u->offset + io_u->buflen;
gettimeofday(&e, NULL);
td->io_blocks++;
td->io_kb += io_u->buflen >> 10;
+ td->this_io_kb += io_u->buflen >> 10;
bytes_done += io_u->buflen;
msec = mtime_since(&io_u->issue_time, &e);
td->cur_off = 0;
td->last_kb = 0;
- for (td->io_kb = 0; td->io_kb < td->kb;) {
+ for (td->this_io_kb = 0; td->this_io_kb < td->kb;) {
struct timespec ts = { .tv_sec = 0, .tv_nsec = 0};
struct timespec *timeout;
int ret, min_evts = 0;
do_sync_io(td);
if (td->verify) {
- if (do_sync_verify(td))
+ if (!do_sync_verify(td))
break;
}
} else {
do_async_io(td);
if (td->verify) {
- if (do_async_verify(td))
+ if (!do_async_verify(td))
break;
}
}