Style fixups
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/blktrace.c b/blktrace.c
index 538bcd7..b707180 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -132,7 +132,7 @@
continue;
if (maj == major(st.st_rdev) && min == minor(st.st_rdev)) {
- dprint(FD_BLKTRACE, "device lookup: %d/%d\n", maj,min);
+ dprint(FD_BLKTRACE, "device lookup: %d/%d\n", maj, min);
strcpy(path, full_path);
found = 1;
break;
@@ -275,11 +275,13 @@
}
if ((t.magic & 0xffffff00) != BLK_IO_TRACE_MAGIC) {
- log_err("fio: bad magic in blktrace data: %x\n", t.magic);
+ log_err("fio: bad magic in blktrace data: %x\n",
+ t.magic);
goto err;
}
if ((t.magic & 0xff) != BLK_IO_TRACE_VERSION) {
- log_err("fio: bad blktrace version %d\n", t.magic & 0xff);
+ log_err("fio: bad blktrace version %d\n",
+ t.magic & 0xff);
goto err;
}
ret = discard_pdu(td, fifo, fd, &t);
@@ -311,7 +313,8 @@
close(fd);
if (skipped_writes)
- log_err("fio: <%s> skips replay of %lu writes due to read-only\n", td->o.name, skipped_writes);
+ log_err("fio: %s skips replay of %lu writes due to read-only\n",
+ td->o.name, skipped_writes);
if (!ios[DDIR_READ] && !ios[DDIR_WRITE]) {
log_err("fio: found no ios in blktrace data\n");
diff --git a/diskutil.c b/diskutil.c
index bbaa22d..b5ba709 100644
--- a/diskutil.c
+++ b/diskutil.c
@@ -20,6 +20,7 @@
char line[256];
FILE *f;
char *p;
+ int ret;
f = fopen(du->path, "r");
if (!f)
@@ -31,7 +32,13 @@
return 1;
}
- if (sscanf(p, "%u %u %llu %u %u %u %llu %u %u %u %u\n", &dus->ios[0], &dus->merges[0], &dus->sectors[0], &dus->ticks[0], &dus->ios[1], &dus->merges[1], &dus->sectors[1], &dus->ticks[1], &in_flight, &dus->io_ticks, &dus->time_in_queue) != 11) {
+ ret = scanf(p, "%u %u %llu %u %u %u %llu %u %u %u %u\n", &dus->ios[0],
+ &dus->merges[0], &dus->sectors[0],
+ &dus->ticks[0], &dus->ios[1],
+ &dus->merges[1], &dus->sectors[1],
+ &dus->ticks[1], &in_flight,
+ &dus->io_ticks, &dus->time_in_queue);
+ if (ret != 11) {
fclose(f);
return 1;
}
@@ -258,7 +265,7 @@
last_mindev = mindev;
last_majdev = majdev;
-
+
sprintf(foo, "/sys/block");
if (!find_block_dir(majdev, mindev, foo))
return;
@@ -326,7 +333,12 @@
if (util > 100.0)
util = 100.0;
- log_info(" %s: ios=%u/%u, merge=%u/%u, ticks=%u/%u, in_queue=%u, util=%3.2f%%\n", du->name, dus->ios[0], dus->ios[1], dus->merges[0], dus->merges[1], dus->ticks[0], dus->ticks[1], dus->time_in_queue, util);
+ log_info(" %s: ios=%u/%u, merge=%u/%u, ticks=%u/%u, "
+ "in_queue=%u, util=%3.2f%%\n", du->name,
+ dus->ios[0], dus->ios[1],
+ dus->merges[0], dus->merges[1],
+ dus->ticks[0], dus->ticks[1],
+ dus->time_in_queue, util);
}
/*
diff --git a/eta.c b/eta.c
index d385532..9a9f658 100644
--- a/eta.c
+++ b/eta.c
@@ -17,47 +17,47 @@
char c = run_str[td->thread_number - 1];
switch (td->runstate) {
- case TD_REAPED:
- c = '_';
- break;
- case TD_EXITED:
- c = 'E';
- break;
- case TD_RUNNING:
- if (td_rw(td)) {
- if (td_random(td))
- c = 'm';
- else
- c = 'M';
- } else if (td_read(td)) {
- if (td_random(td))
- c = 'r';
- else
- c = 'R';
- } else {
- if (td_random(td))
- c = 'w';
- else
- c = 'W';
- }
- break;
- case TD_VERIFYING:
- c = 'V';
- break;
- case TD_FSYNCING:
- c = 'F';
- break;
- case TD_CREATED:
- c = 'C';
- break;
- case TD_INITIALIZED:
- c = 'I';
- break;
- case TD_NOT_CREATED:
- c = 'P';
- break;
- default:
- log_err("state %d\n", td->runstate);
+ case TD_REAPED:
+ c = '_';
+ break;
+ case TD_EXITED:
+ c = 'E';
+ break;
+ case TD_RUNNING:
+ if (td_rw(td)) {
+ if (td_random(td))
+ c = 'm';
+ else
+ c = 'M';
+ } else if (td_read(td)) {
+ if (td_random(td))
+ c = 'r';
+ else
+ c = 'R';
+ } else {
+ if (td_random(td))
+ c = 'w';
+ else
+ c = 'W';
+ }
+ break;
+ case TD_VERIFYING:
+ c = 'V';
+ break;
+ case TD_FSYNCING:
+ c = 'F';
+ break;
+ case TD_CREATED:
+ c = 'C';
+ break;
+ case TD_INITIALIZED:
+ c = 'I';
+ break;
+ case TD_NOT_CREATED:
+ c = 'P';
+ break;
+ default:
+ log_err("state %d\n", td->runstate);
}
run_str[td->thread_number - 1] = c;
@@ -176,7 +176,7 @@
prev_io_bytes[0] = io_bytes[0];
prev_io_bytes[1] = io_bytes[1];
}
-
+
/*
* Print status of the jobs we know about. This includes rate estimates,
* ETA, thread state, etc.
@@ -192,7 +192,6 @@
unsigned long long io_bytes[2];
unsigned long rate_time, disp_time, bw_avg_time;
struct timeval now;
- int linelen;
static unsigned long long rate_io_bytes[2];
static unsigned long long disp_io_bytes[2];
@@ -267,7 +266,7 @@
fio_gettime(&now, NULL);
rate_time = mtime_since(&rate_prev_time, &now);
- if (write_bw_log && rate_time> bw_avg_time) {
+ if (write_bw_log && rate_time > bw_avg_time) {
calc_rate(rate_time, io_bytes, rate_io_bytes, rate);
memcpy(&rate_prev_time, &now, sizeof(now));
add_agg_sample(rate[DDIR_READ], DDIR_READ);
@@ -290,12 +289,14 @@
else if (m_iops || t_iops)
printf(", CR=%d/%d IOPS", t_iops, m_iops);
if (eta_sec != INT_MAX && nr_running) {
+ int ll;
+
perc *= 100.0;
- linelen = printf(": [%s] [%3.1f%% done] [%6u/%6u kb/s] [eta %s]",
+ ll = printf(": [%s] [%3.1f%% done] [%6u/%6u kb/s] [eta %s]",
run_str, perc, rate[0], rate[1], eta_str);
- if (linelen >= 0 && linelen < linelen_last)
- printf("%*s", linelen_last-linelen, "");
- linelen_last = linelen;
+ if (ll >= 0 && ll < linelen_last)
+ printf("%*s", linelen_last - ll, "");
+ linelen_last = ll;
}
printf("\r");
fflush(stdout);
diff --git a/fifo.c b/fifo.c
index df165f7..de03184 100644
--- a/fifo.c
+++ b/fifo.c
@@ -69,23 +69,23 @@
return len;
}
-unsigned int fifo_get(struct fifo *fifo, void *buffer, unsigned int len)
+unsigned int fifo_get(struct fifo *fifo, void *buf, unsigned int len)
{
len = min(len, fifo->in - fifo->out);
- if (buffer) {
+ if (buf) {
unsigned int l;
/*
* first get the data from fifo->out until the end of the buffer
*/
l = min(len, fifo->size - (fifo->out & (fifo->size - 1)));
- memcpy(buffer, fifo->buffer + (fifo->out & (fifo->size - 1)),l);
+ memcpy(buf, fifo->buffer + (fifo->out & (fifo->size - 1)), l);
/*
* then get the rest (if any) from the beginning of the buffer
*/
- memcpy(buffer + l, fifo->buffer, len - l);
+ memcpy(buf + l, fifo->buffer, len - l);
}
fifo->out += len;
diff --git a/filesetup.c b/filesetup.c
index 3eba27e..37a3439 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -116,11 +116,13 @@
static unsigned long long get_rand_file_size(struct thread_data *td)
{
- unsigned long long ret;
+ unsigned long long ret, size_d;
long r;
r = os_random_long(&td->file_size_state);
- ret = td->o.file_size_low + (unsigned long long) ((double) (td->o.file_size_high - td->o.file_size_low) * (r / (RAND_MAX + 1.0)));
+ size_d = td->o.file_size_high - td->o.file_size_low;
+ ret = (unsigned long long) ((double) size_d * (r / (RAND_MAX + 1.0)));
+ ret += td->o.file_size_low;
ret -= (ret % td->o.rw_min_bs);
return ret;
}
@@ -171,7 +173,8 @@
return ret;
if (f->file_offset > f->real_file_size) {
- log_err("%s: offset extends end (%Lu > %Lu)\n", td->o.name, f->file_offset, f->real_file_size);
+ log_err("%s: offset extends end (%Lu > %Lu)\n", td->o.name,
+ f->file_offset, f->real_file_size);
return 1;
}
@@ -193,13 +196,15 @@
*/
if (f->mmap)
ret = madvise(f->mmap, f->io_size, MADV_DONTNEED);
- else if (f->filetype == FIO_TYPE_FILE)
- ret = fadvise(f->fd, f->file_offset, f->io_size, POSIX_FADV_DONTNEED);
- else if (f->filetype == FIO_TYPE_BD) {
+ else if (f->filetype == FIO_TYPE_FILE) {
+ ret = fadvise(f->fd, f->file_offset, f->io_size,
+ POSIX_FADV_DONTNEED);
+ } else if (f->filetype == FIO_TYPE_BD) {
ret = blockdev_invalidate_cache(f->fd);
if (ret < 0 && errno == EACCES && geteuid()) {
if (!root_warn) {
- log_err("fio: only root may flush block devices. Cache flush bypassed!\n");
+ log_err("fio: only root may flush block "
+ "devices. Cache flush bypassed!\n");
root_warn = 1;
}
ret = 0;
@@ -356,7 +361,8 @@
err = td_io_open_file(td, f);
if (err) {
if (td->error == EMFILE) {
- log_err("fio: limited open files to: %d\n", td->nr_open_files);
+ log_err("fio: limited open files to: %d\n",
+ td->nr_open_files);
td->o.open_files = td->nr_open_files;
err = 0;
clear_error(td);
@@ -387,7 +393,8 @@
int err = 0;
for_each_file(td, f, i) {
- dprint(FD_FILE, "get file size for %p/%d/%p\n", f, i, f->file_name);
+ dprint(FD_FILE, "get file size for %p/%d/%p\n", f, i,
+ f->file_name);
if (td->io_ops->open_file(td, f)) {
if (td->error != ENOENT) {
@@ -475,16 +482,19 @@
f->io_size = f->real_file_size - f->file_offset;
} else if (f->real_file_size < td->o.file_size_low ||
f->real_file_size > td->o.file_size_high) {
- if (f->file_offset > td->o.file_size_low)
+ if (f->file_offset > td->o.file_size_low)
goto err_offset;
/*
* file size given. if it's fixed, use that. if it's a
* range, generate a random size in-between.
*/
- if (td->o.file_size_low == td->o.file_size_high)
- f->io_size = td->o.file_size_low - f->file_offset;
- else
- f->io_size = get_rand_file_size(td) - f->file_offset;
+ if (td->o.file_size_low == td->o.file_size_high) {
+ f->io_size = td->o.file_size_low
+ - f->file_offset;
+ } else {
+ f->io_size = get_rand_file_size(td)
+ - f->file_offset;
+ }
} else
f->io_size = f->real_file_size - f->file_offset;
@@ -499,7 +509,7 @@
need_extend++;
extend_size += (f->io_size + f->file_offset);
f->flags |= FIO_FILE_EXTEND;
- }
+ }
}
if (!td->o.size || td->o.size > total_size)
@@ -555,11 +565,15 @@
return 0;
for_each_file(td, f, i) {
- blocks = (f->real_file_size + td->o.rw_min_bs - 1) / (unsigned long long) td->o.rw_min_bs;
- num_maps = (blocks + BLOCKS_PER_MAP-1)/ (unsigned long long) BLOCKS_PER_MAP;
+ blocks = (f->real_file_size + td->o.rw_min_bs - 1) /
+ (unsigned long long) td->o.rw_min_bs;
+ num_maps = (blocks + BLOCKS_PER_MAP - 1) /
+ (unsigned long long) BLOCKS_PER_MAP;
f->file_map = smalloc(num_maps * sizeof(long));
if (!f->file_map) {
- log_err("fio: failed allocating random map. If running a large number of jobs, try the 'norandommap' option\n");
+ log_err("fio: failed allocating random map. If running"
+ " a large number of jobs, try the 'norandommap'"
+ " option\n");
return 1;
}
f->num_maps = num_maps;
@@ -675,7 +689,8 @@
if (f->filetype == FIO_TYPE_FILE)
td->nr_normal_files++;
- dprint(FD_FILE, "file %p \"%s\" added at %d\n", f, f->file_name, cur_files);
+ dprint(FD_FILE, "file %p \"%s\" added at %d\n", f, f->file_name,
+ cur_files);
return cur_files;
}
@@ -811,7 +826,8 @@
if (!S_ISDIR(sb.st_mode))
continue;
- if ((ret = recurse_dir(td, full_path)) != 0)
+ ret = recurse_dir(td, full_path);
+ if (ret)
break;
}
diff --git a/fio.c b/fio.c
index d28469e..c1894f5 100644
--- a/fio.c
+++ b/fio.c
@@ -76,8 +76,8 @@
for_each_td(td, i) {
if (group_id == TERMINATE_ALL || groupid == td->groupid) {
- dprint(FD_PROCESS, "setting terminate on %d\n",td->pid);
-
+ dprint(FD_PROCESS, "setting terminate on %d\n",
+ td->pid);
td->terminate = 1;
td->o.start_delay = 0;
@@ -99,16 +99,16 @@
static void sig_handler(int sig)
{
switch (sig) {
- case SIGALRM:
- update_io_ticks();
- disk_util_timer_arm();
- print_thread_status();
- break;
- default:
- printf("\nfio: terminating on signal %d\n", sig);
- fflush(stdout);
- terminate_threads(TERMINATE_ALL);
- break;
+ case SIGALRM:
+ update_io_ticks();
+ disk_util_timer_arm();
+ print_thread_status();
+ break;
+ default:
+ printf("\nfio: terminating on signal %d\n", sig);
+ fflush(stdout);
+ terminate_threads(TERMINATE_ALL);
+ break;
}
}
@@ -156,12 +156,16 @@
* check bandwidth specified rate
*/
if (bytes < td->rate_bytes) {
- log_err("%s: min rate %u not met\n", td->o.name, td->o.ratemin);
+ log_err("%s: min rate %u not met\n", td->o.name,
+ td->o.ratemin);
return 1;
} else {
rate = (bytes - td->rate_bytes) / spent;
- if (rate < td->o.ratemin || bytes < td->rate_bytes) {
- log_err("%s: min rate %u not met, got %luKiB/sec\n", td->o.name, td->o.ratemin, rate);
+ if (rate < td->o.ratemin ||
+ bytes < td->rate_bytes) {
+ log_err("%s: min rate %u not met, got"
+ " %luKiB/sec\n", td->o.name,
+ td->o.ratemin, rate);
return 1;
}
}
@@ -170,12 +174,17 @@
* checks iops specified rate
*/
if (iops < td->o.rate_iops) {
- log_err("%s: min iops rate %u not met\n", td->o.name, td->o.rate_iops);
+ log_err("%s: min iops rate %u not met\n",
+ td->o.name, td->o.rate_iops);
return 1;
} else {
rate = (iops - td->rate_blocks) / spent;
- if (rate < td->o.rate_iops_min || iops < td->rate_blocks) {
- log_err("%s: min iops rate %u not met, got %lu\n", td->o.name, td->o.rate_iops_min, rate);
+ if (rate < td->o.rate_iops_min ||
+ iops < td->rate_blocks) {
+ log_err("%s: min iops rate %u not met,"
+ " got %lu\n", td->o.name,
+ td->o.rate_iops_min,
+ rate);
}
}
}
@@ -539,7 +548,8 @@
min_evts = 1;
if (td->cur_depth > td->o.iodepth_low)
- min_evts = td->cur_depth - td->o.iodepth_low;
+ min_evts = td->cur_depth
+ - td->o.iodepth_low;
}
fio_gettime(&comp_time, NULL);
@@ -654,10 +664,15 @@
max_units = td->o.iodepth;
max_bs = max(td->o.max_bs[DDIR_READ], td->o.max_bs[DDIR_WRITE]);
- td->orig_buffer_size = (unsigned long long) max_bs * (unsigned long long) max_units;
+ td->orig_buffer_size = (unsigned long long) max_bs
+ * (unsigned long long) max_units;
- if (td->o.mem_type == MEM_SHMHUGE || td->o.mem_type == MEM_MMAPHUGE)
- td->orig_buffer_size = (td->orig_buffer_size + td->o.hugepage_size - 1) & ~(td->o.hugepage_size - 1);
+ if (td->o.mem_type == MEM_SHMHUGE || td->o.mem_type == MEM_MMAPHUGE) {
+ unsigned long bs;
+
+ bs = td->orig_buffer_size + td->o.hugepage_size - 1;
+ td->orig_buffer_size = bs & ~(td->o.hugepage_size - 1);
+ }
if (td->orig_buffer_size != (size_t) td->orig_buffer_size) {
log_err("fio: IO memory too large. Reduce max_bs or iodepth\n");
@@ -710,7 +725,8 @@
f = fopen(tmp, "r+");
if (!f) {
if (errno == ENOENT) {
- log_err("fio: os or kernel doesn't support IO scheduler switching\n");
+ log_err("fio: os or kernel doesn't support IO scheduler"
+ " switching\n");
return 0;
}
td_verror(td, errno, "fopen iosched");
@@ -764,7 +780,8 @@
return 1;
}
- io_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE] + td->io_skip_bytes;
+ io_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE]
+ + td->io_skip_bytes;
if (io_done < td->o.size)
return 1;
@@ -897,7 +914,8 @@
memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start));
if (td->o.ratemin)
- memcpy(&td->lastrate, &td->ts.stat_sample_time, sizeof(td->lastrate));
+ memcpy(&td->lastrate, &td->ts.stat_sample_time,
+ sizeof(td->lastrate));
if (clear_state && clear_io_state(td))
break;
@@ -910,7 +928,8 @@
if (td_read(td) && td->io_bytes[DDIR_READ]) {
if (td->rw_end_set[DDIR_READ])
- elapsed = utime_since(&td->start, &td->rw_end[DDIR_READ]);
+ elapsed = utime_since(&td->start,
+ &td->rw_end[DDIR_READ]);
else
elapsed = utime_since_now(&td->start);
@@ -918,13 +937,14 @@
}
if (td_write(td) && td->io_bytes[DDIR_WRITE]) {
if (td->rw_end_set[DDIR_WRITE])
- elapsed = utime_since(&td->start, &td->rw_end[DDIR_WRITE]);
+ elapsed = utime_since(&td->start,
+ &td->rw_end[DDIR_WRITE]);
else
elapsed = utime_since_now(&td->start);
runtime[DDIR_WRITE] += elapsed;
}
-
+
if (td->error || td->terminate)
break;
@@ -969,7 +989,8 @@
err:
if (td->error)
- printf("fio: pid=%d, err=%d/%s\n", td->pid, td->error, td->verror);
+ printf("fio: pid=%d, err=%d/%s\n", td->pid, td->error,
+ td->verror);
close_and_free_files(td);
close_ioengine(td);
cleanup_io_u(td);
@@ -1056,7 +1077,8 @@
ret = waitpid(td->pid, &status, flags);
if (ret < 0) {
if (errno == ECHILD) {
- log_err("fio: pid=%d disappeared %d\n", td->pid, td->runstate);
+ log_err("fio: pid=%d disappeared %d\n", td->pid,
+ td->runstate);
td_set_runstate(td, TD_REAPED);
goto reaped;
}
@@ -1066,7 +1088,8 @@
int sig = WTERMSIG(status);
if (sig != SIGQUIT)
- log_err("fio: pid=%d, got signal=%d\n", td->pid, sig);
+ log_err("fio: pid=%d, got signal=%d\n",
+ td->pid, sig);
td_set_runstate(td, TD_REAPED);
goto reaped;
}
@@ -1123,11 +1146,13 @@
if (!terse_output) {
printf("Starting ");
if (nr_thread)
- printf("%d thread%s", nr_thread, nr_thread > 1 ? "s" : "");
+ printf("%d thread%s", nr_thread,
+ nr_thread > 1 ? "s" : "");
if (nr_process) {
if (nr_thread)
printf(" and ");
- printf("%d process%s", nr_process, nr_process > 1 ? "es" : "");
+ printf("%d process%s", nr_process,
+ nr_process > 1 ? "es" : "");
}
printf("\n");
fflush(stdout);
@@ -1157,7 +1182,8 @@
if (setup_files(td)) {
exit_value++;
if (td->error)
- log_err("fio: pid=%d, err=%d/%s\n", td->pid, td->error, td->verror);
+ log_err("fio: pid=%d, err=%d/%s\n", td->pid,
+ td->error, td->verror);
td_set_runstate(td, TD_REAPED);
todo--;
} else {
@@ -1171,7 +1197,7 @@
*/
for_each_file(td, f, i)
td_io_close_file(td, f);
- }
+ }
init_disk_util(td);
}
@@ -1219,7 +1245,8 @@
if (td->o.use_thread) {
dprint(FD_PROCESS, "will pthread_create\n");
- if (pthread_create(&td->thread, NULL, thread_main, td)) {
+ if (pthread_create(&td->thread, NULL,
+ thread_main, td)) {
perror("thread_create");
nr_started--;
break;
@@ -1349,8 +1376,9 @@
if (!fio_abort) {
show_run_stats();
if (write_bw_log) {
- __finish_log(agg_io_log[DDIR_READ],"agg-read_bw.log");
- __finish_log(agg_io_log[DDIR_WRITE],"agg-write_bw.log");
+ __finish_log(agg_io_log[DDIR_READ], "agg-read_bw.log");
+ __finish_log(agg_io_log[DDIR_WRITE],
+ "agg-write_bw.log");
}
}
diff --git a/gettime.c b/gettime.c
index 136c02c..d78cf6d 100644
--- a/gettime.c
+++ b/gettime.c
@@ -9,7 +9,7 @@
#include "hash.h"
-static int clock_gettime_works = 0;
+static int clock_gettime_works;
#ifdef FIO_DEBUG_TIME
@@ -80,7 +80,8 @@
list_for_each(entry, &hash[i]) {
log = list_entry(entry, struct gtod_log, list);
- printf("function %p, calls %lu\n", log->caller, log->calls);
+ printf("function %p, calls %lu\n", log->caller,
+ log->calls);
total_calls += log->calls;
}
}
diff --git a/init.c b/init.c
index af1798e..3f0dfc6 100644
--- a/init.c
+++ b/init.c
@@ -41,8 +41,8 @@
int write_bw_log = 0;
int read_only = 0;
-static int def_timeout = 0;
-static int write_lat_log = 0;
+static int def_timeout;
+static int write_lat_log;
static int prev_group_jobs;
@@ -52,7 +52,7 @@
* Command line options. These will contain the above, plus a few
* extra that only pertain to fio itself and not jobs.
*/
-static struct option long_options[FIO_NR_OPTIONS] = {
+static struct option l_opts[FIO_NR_OPTIONS] = {
{
.name = "output",
.has_arg = required_argument,
@@ -208,10 +208,11 @@
struct thread_options *o = &td->o;
if (read_only && td_write(td)) {
- log_err("fio: job <%s> has write bit set, but fio is in read-only mode\n", td->o.name);
+ log_err("fio: job <%s> has write bit set, but fio is in"
+ " read-only mode\n", td->o.name);
return 1;
}
-
+
if (o->rwmix[DDIR_READ] + o->rwmix[DDIR_WRITE] > 100)
o->rwmix[DDIR_WRITE] = 100 - o->rwmix[DDIR_READ];
@@ -234,11 +235,11 @@
o->overwrite = 1;
if (!o->min_bs[DDIR_READ])
- o->min_bs[DDIR_READ]= o->bs[DDIR_READ];
+ o->min_bs[DDIR_READ] = o->bs[DDIR_READ];
if (!o->max_bs[DDIR_READ])
o->max_bs[DDIR_READ] = o->bs[DDIR_READ];
if (!o->min_bs[DDIR_WRITE])
- o->min_bs[DDIR_WRITE]= o->bs[DDIR_WRITE];
+ o->min_bs[DDIR_WRITE] = o->bs[DDIR_WRITE];
if (!o->max_bs[DDIR_WRITE])
o->max_bs[DDIR_WRITE] = o->bs[DDIR_WRITE];
@@ -303,7 +304,7 @@
if (o->fill_device && !o->size)
o->size = ULONG_LONG_MAX;
-
+
if (td_rw(td) && td->o.verify != VERIFY_NONE)
log_info("fio: mixed read/write workload with verify. May not "
"work as expected, unless you pre-populated the file\n");
@@ -452,7 +453,8 @@
add_file(td, jobname);
else {
for (i = 0; i < td->o.nr_files; i++) {
- sprintf(fname, "%s.%d.%d", jobname, td->thread_number, i);
+ sprintf(fname, "%s.%d.%d", jobname,
+ td->thread_number, i);
add_file(td, fname);
}
}
@@ -502,9 +504,12 @@
if (!terse_output) {
if (!job_add_num) {
- if (!strcmp(td->io_ops->name, "cpuio"))
- log_info("%s: ioengine=cpu, cpuload=%u, cpucycle=%u\n", td->o.name, td->o.cpuload, td->o.cpucycle);
- else {
+ if (!strcmp(td->io_ops->name, "cpuio")) {
+ log_info("%s: ioengine=cpu, cpuload=%u,"
+ " cpucycle=%u\n", td->o.name,
+ td->o.cpuload,
+ td->o.cpucycle);
+ } else {
char *c1, *c2, *c3, *c4;
c1 = to_kmg(td->o.min_bs[DDIR_READ]);
@@ -512,7 +517,13 @@
c3 = to_kmg(td->o.min_bs[DDIR_WRITE]);
c4 = to_kmg(td->o.max_bs[DDIR_WRITE]);
- log_info("%s: (g=%d): rw=%s, bs=%s-%s/%s-%s, ioengine=%s, iodepth=%u\n", td->o.name, td->groupid, ddir_str[td->o.td_ddir], c1, c2, c3, c4, td->io_ops->name, td->o.iodepth);
+ log_info("%s: (g=%d): rw=%s, bs=%s-%s/%s-%s,"
+ " ioengine=%s, iodepth=%u\n",
+ td->o.name, td->groupid,
+ ddir_str[td->o.td_ddir],
+ c1, c2, c3, c4,
+ td->io_ops->name,
+ td->o.iodepth);
free(c1);
free(c2);
@@ -636,7 +647,8 @@
if (sscanf(p, "[%255s]", name) != 1) {
if (inside_skip)
continue;
- log_err("fio: option <%s> outside of [] job section\n", p);
+ log_err("fio: option <%s> outside of [] job section\n",
+ p);
break;
}
@@ -806,11 +818,13 @@
printf("\t--minimal\tMinimal (terse) output\n");
printf("\t--version\tPrint version info and exit\n");
printf("\t--help\t\tPrint this page\n");
- printf("\t--cmdhelp=cmd\tPrint command help, \"all\" for all of them\n");
+ printf("\t--cmdhelp=cmd\tPrint command help, \"all\" for all of"
+ " them\n");
printf("\t--showcmd\tTurn a job file into command line options\n");
printf("\t--eta=when\tWhen ETA estimate should be printed\n");
printf("\t \tMay be \"always\", \"never\" or \"auto\"\n");
- printf("\t--readonly\tTurn on safety read-only checks, preventing writes\n");
+ printf("\t--readonly\tTurn on safety read-only checks, preventing"
+ " writes\n");
printf("\t--section=name\tOnly run specified section in job file\n");
}
@@ -880,7 +894,7 @@
struct thread_data *td = NULL;
int c, ini_idx = 0, lidx, ret = 0, do_exit = 0, exit_val = 0;
- while ((c = getopt_long_only(argc, argv, "", long_options, &lidx)) != -1) {
+ while ((c = getopt_long_only(argc, argv, "", l_opts, &lidx)) != -1) {
switch (c) {
case 't':
def_timeout = atoi(optarg);
@@ -928,7 +942,8 @@
break;
case 'x':
if (!strcmp(optarg, "global")) {
- log_err("fio: can't use global as only section\n");
+ log_err("fio: can't use global as only "
+ "section\n");
do_exit++;
exit_val = 1;
break;
@@ -938,7 +953,7 @@
job_section = strdup(optarg);
break;
case FIO_GETOPT_JOB: {
- const char *opt = long_options[lidx].name;
+ const char *opt = l_opts[lidx].name;
char *val = optarg;
if (!strncmp(opt, "name", 4) && td) {
@@ -1001,7 +1016,7 @@
f_out = stdout;
f_err = stderr;
- fio_options_dup_and_init(long_options);
+ fio_options_dup_and_init(l_opts);
if (setup_thread_area())
return 1;
diff --git a/io_u.c b/io_u.c
index 5a3157a..1e60eee 100644
--- a/io_u.c
+++ b/io_u.c
@@ -124,7 +124,8 @@
do {
r = os_random_long(&td->random_state);
dprint(FD_RANDOM, "off rand %llu\n", r);
- *b = (last_block(td, f, ddir) - 1) * (r / ((unsigned long long) RAND_MAX + 1.0));
+ *b = (last_block(td, f, ddir) - 1)
+ * (r / ((unsigned long long) RAND_MAX + 1.0));
/*
* if we are not maintaining a random map, we are done.
@@ -208,9 +209,11 @@
buflen = td->o.min_bs[ddir];
else {
r = os_random_long(&td->bsrange_state);
- if (!td->o.bssplit_nr)
- buflen = (unsigned int) (1 + (double) (td->o.max_bs[ddir] - 1) * r / (RAND_MAX + 1.0));
- else {
+ if (!td->o.bssplit_nr) {
+ buflen = (unsigned int)
+ (1 + (double) (td->o.max_bs[ddir] - 1)
+ * r / (RAND_MAX + 1.0));
+ } else {
long perc = 0;
unsigned int i;
@@ -223,8 +226,10 @@
break;
}
}
- if (!td->o.bs_unaligned)
- buflen = (buflen + td->o.min_bs[ddir] - 1) & ~(td->o.min_bs[ddir] - 1);
+ if (!td->o.bs_unaligned) {
+ buflen = (buflen + td->o.min_bs[ddir] - 1)
+ & ~(td->o.min_bs[ddir] - 1);
+ }
}
if (io_u->offset + buflen > io_u->file->real_file_size) {
@@ -249,7 +254,8 @@
rbytes = td->io_bytes[td->rwmix_ddir] - td->rwmix_bytes;
diff = td->o.rwmix[td->rwmix_ddir ^ 1];
- td->rwmix_bytes = td->io_bytes[td->rwmix_ddir] + (rbytes * ((100 - diff)) / diff);
+ td->rwmix_bytes = td->io_bytes[td->rwmix_ddir]
+ + (rbytes * ((100 - diff)) / diff);
}
static inline enum fio_ddir get_rand_ddir(struct thread_data *td)
@@ -278,7 +284,7 @@
unsigned int cycle;
fio_gettime(&now, NULL);
- elapsed = mtime_since_now(&td->rwmix_switch);
+ elapsed = mtime_since_now(&td->rwmix_switch);
/*
* if this is the first cycle, make it shorter
@@ -293,7 +299,7 @@
if (elapsed >= cycle ||
td->io_bytes[td->rwmix_ddir] >= td->rwmix_bytes) {
unsigned long long max_bytes;
- enum fio_ddir ddir;
+ enum fio_ddir ddir;
/*
* Put a top limit on how many bytes we do for
@@ -302,10 +308,12 @@
*/
ddir = get_rand_ddir(td);
max_bytes = td->this_io_bytes[ddir];
- if (max_bytes >= (td->o.size * td->o.rwmix[ddir] / 100)) {
+ if (max_bytes >=
+ (td->o.size * td->o.rwmix[ddir] / 100)) {
if (!td->rw_end_set[ddir]) {
td->rw_end_set[ddir] = 1;
- memcpy(&td->rw_end[ddir], &now, sizeof(now));
+ memcpy(&td->rw_end[ddir], &now,
+ sizeof(now));
}
ddir ^= 1;
}
@@ -348,7 +356,7 @@
__io_u->flags |= IO_U_F_FREE;
if ((__io_u->flags & IO_U_F_FLIGHT) && (__io_u->ddir != DDIR_SYNC))
td->io_issues[__io_u->ddir]--;
-
+
__io_u->flags &= ~IO_U_F_FLIGHT;
list_del(&__io_u->list);
@@ -560,7 +568,8 @@
do {
long r = os_random_long(&td->next_file_state);
- fno = (unsigned int) ((double) td->o.nr_files * (r / (RAND_MAX + 1.0)));
+ fno = (unsigned int) ((double) td->o.nr_files
+ * (r / (RAND_MAX + 1.0)));
f = td->files[fno];
if (f->flags & FIO_FILE_DONE)
continue;
@@ -610,7 +619,10 @@
assert(td->o.nr_files <= td->files_index);
if (!td->nr_open_files || td->nr_done_files >= td->o.nr_files) {
- dprint(FD_FILE, "get_next_file: nr_open=%d, nr_done=%d, nr_files=%d\n", td->nr_open_files, td->nr_done_files, td->o.nr_files);
+ dprint(FD_FILE, "get_next_file: nr_open=%d, nr_done=%d,"
+ " nr_files=%d\n", td->nr_open_files,
+ td->nr_done_files,
+ td->o.nr_files);
return NULL;
}
@@ -748,7 +760,7 @@
dprint(FD_IO, "io_u %p, setting file failed\n", io_u);
goto err_put;
}
-
+
f = io_u->file;
assert(f->flags & FIO_FILE_OPEN);
@@ -792,7 +804,8 @@
log_err(": %s\n", strerror(io_u->error));
- log_err(" %s offset=%llu, buflen=%lu\n", msg[io_u->ddir], io_u->offset, io_u->xfer_buflen);
+ log_err(" %s offset=%llu, buflen=%lu\n", msg[io_u->ddir],
+ io_u->offset, io_u->xfer_buflen);
if (!td->error)
td_verror(td, io_u->error, "io_u error");
@@ -951,7 +964,10 @@
unsigned long t_issue = mtime_since_now(&io_u->issue_time);
log_err("io_u=%p, t_start=%lu, t_issue=%lu\n", io_u, t_start, t_issue);
- log_err(" buf=%p/%p, len=%lu/%lu, offset=%llu\n", io_u->buf, io_u->xfer_buf, io_u->buflen, io_u->xfer_buflen, io_u->offset);
+ log_err(" buf=%p/%p, len=%lu/%lu, offset=%llu\n", io_u->buf,
+ io_u->xfer_buf, io_u->buflen,
+ io_u->xfer_buflen,
+ io_u->offset);
log_err(" ddir=%d, fname=%s\n", io_u->ddir, io_u->file->file_name);
}
#else
diff --git a/ioengines.c b/ioengines.c
index 87db11c..e44fce0 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -23,7 +23,8 @@
static int check_engine_ops(struct ioengine_ops *ops)
{
if (ops->version != FIO_IOOPS_VERSION) {
- log_err("bad ioops version %d (want %d)\n", ops->version, FIO_IOOPS_VERSION);
+ log_err("bad ioops version %d (want %d)\n", ops->version,
+ FIO_IOOPS_VERSION);
return 1;
}
@@ -37,7 +38,7 @@
*/
if (ops->flags & FIO_SYNCIO)
return 0;
-
+
if (!ops->event) {
log_err("%s: no event handler\n", ops->name);
return 1;
@@ -50,7 +51,7 @@
log_err("%s: no queue handler\n", ops->name);
return 1;
}
-
+
return 0;
}
@@ -218,12 +219,14 @@
if (td->io_ops->flags & FIO_SYNCIO) {
fio_gettime(&io_u->issue_time, NULL);
- memcpy(&td->last_issue, &io_u->issue_time, sizeof(struct timeval));
+ memcpy(&td->last_issue, &io_u->issue_time,
+ sizeof(struct timeval));
/*
* for a sync engine, set the timeout upfront
*/
- if (mtime_since(&td->timeout_end, &io_u->issue_time) < IO_U_TIMEOUT)
+ if (mtime_since(&td->timeout_end, &io_u->issue_time)
+ < IO_U_TIMEOUT)
io_u_set_timeout(td);
}
@@ -250,14 +253,17 @@
if ((td->io_ops->flags & FIO_SYNCIO) == 0) {
fio_gettime(&io_u->issue_time, NULL);
- memcpy(&td->last_issue, &io_u->issue_time, sizeof(struct timeval));
+ memcpy(&td->last_issue, &io_u->issue_time,
+ sizeof(struct timeval));
/*
* async engine, set the timeout here
*/
if (ret == FIO_Q_QUEUED &&
- mtime_since(&td->timeout_end, &io_u->issue_time) < IO_U_TIMEOUT)
+ (mtime_since(&td->timeout_end, &io_u->issue_time)
+ < IO_U_TIMEOUT)) {
io_u_set_timeout(td);
+ }
}
return ret;
@@ -269,8 +275,10 @@
if (td->io_ops->init) {
ret = td->io_ops->init(td);
- if (ret && td->o.iodepth > 1)
- log_err("fio: io engine init failed. Perhaps try reducing io depth?\n");
+ if (ret && td->o.iodepth > 1) {
+ log_err("fio: io engine init failed. Perhaps try"
+ " reducing io depth?\n");
+ }
}
return ret;
@@ -295,8 +303,11 @@
if (td->io_ops->open_file(td, f)) {
if (td->error == EINVAL && td->o.odirect)
log_err("fio: destination does not support O_DIRECT\n");
- if (td->error == EMFILE)
- log_err("fio: try reducing/setting openfiles (failed at %u of %u)\n", td->nr_open_files, td->o.nr_files);
+ if (td->error == EMFILE) {
+ log_err("fio: try reducing/setting openfiles (failed"
+ " at %u of %u)\n", td->nr_open_files,
+ td->o.nr_files);
+ }
return 1;
}
@@ -321,7 +332,6 @@
if (td->o.fadvise_hint &&
(f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
-
int flags;
if (td_random(td))
diff --git a/log.c b/log.c
index f6fbaeb..aea0398 100644
--- a/log.c
+++ b/log.c
@@ -19,7 +19,9 @@
if (!td->o.write_iolog_file)
return;
- fprintf(td->iolog_f, "%s %s %llu %lu\n", io_u->file->file_name, act[io_u->ddir], io_u->offset, io_u->buflen);
+ fprintf(td->iolog_f, "%s %s %llu %lu\n", io_u->file->file_name,
+ act[io_u->ddir], io_u->offset,
+ io_u->buflen);
}
void log_file(struct thread_data *td, struct fio_file *f,
@@ -202,7 +204,8 @@
struct io_piece *ipo;
int r;
- r = sscanf(p, "%256s %256s %llu %u", fname, act, &offset, &bytes);
+ r = sscanf(p, "%256s %256s %llu %u", fname, act, &offset,
+ &bytes);
if (r == 4) {
/*
* Check action first
@@ -214,7 +217,8 @@
else if (!strcmp(act, "sync"))
rw = DDIR_SYNC;
else {
- log_err("fio: bad iolog file action: %s\n",act);
+ log_err("fio: bad iolog file action: %s\n",
+ act);
continue;
}
} else if (r == 2) {
@@ -231,14 +235,15 @@
fileno = get_fileno(td, fname);
file_action = FIO_LOG_CLOSE_FILE;
} else {
- log_err("fio: bad iolog file action: %s\n",act);
+ log_err("fio: bad iolog file action: %s\n",
+ act);
continue;
}
} else {
log_err("bad iolog2: %s", p);
continue;
}
-
+
if (rw == DDIR_READ)
reads++;
else if (rw == DDIR_WRITE) {
@@ -277,7 +282,8 @@
free(fname);
if (writes && read_only) {
- log_err("fio: <%s> skips replay of %d writes due to read-only\n", td->o.name, writes);
+ log_err("fio: <%s> skips replay of %d writes due to"
+ " read-only\n", td->o.name, writes);
writes = 0;
}
@@ -346,7 +352,8 @@
free(str);
if (writes && read_only) {
- log_err("fio: <%s> skips replay of %d writes due to read-only\n", td->o.name, writes);
+ log_err("fio: <%s> skips replay of %d writes due to"
+ " read-only\n", td->o.name, writes);
writes = 0;
}
@@ -489,8 +496,10 @@
return;
}
- for (i = 0; i < log->nr_samples; i++)
- fprintf(f, "%lu, %lu, %u\n", log->log[i].time, log->log[i].val, log->log[i].ddir);
+ for (i = 0; i < log->nr_samples; i++) {
+ fprintf(f, "%lu, %lu, %u\n", log->log[i].time, log->log[i].val,
+ log->log[i].ddir);
+ }
fclose(f);
free(log->log);
diff --git a/memory.c b/memory.c
index be1fd24..257914b 100644
--- a/memory.c
+++ b/memory.c
@@ -36,11 +36,13 @@
if (phys_mem) {
if ((mlock_size + 128 * 1024 * 1024) > phys_mem) {
mlock_size = phys_mem - 128 * 1024 * 1024;
- log_info("fio: limiting mlocked memory to %lluMiB\n", mlock_size >> 20);
+ log_info("fio: limiting mlocked memory to %lluMiB\n",
+ mlock_size >> 20);
}
}
- pinned_mem = mmap(NULL, mlock_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | OS_MAP_ANON, 0, 0);
+ pinned_mem = mmap(NULL, mlock_size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | OS_MAP_ANON, 0, 0);
if (pinned_mem == MAP_FAILED) {
perror("malloc locked mem");
pinned_mem = NULL;
@@ -70,14 +72,19 @@
if (geteuid() != 0 && errno == ENOMEM)
log_err("fio: you may need to run this job as root\n");
if (td->o.mem_type == MEM_SHMHUGE) {
- if (errno == EINVAL)
- log_err("fio: check that you have free huge pages and that hugepage-size is correct.\n");
- else if (errno == ENOSYS)
- log_err("fio: your system does not appear to support huge pages.\n");
- else if (errno == ENOMEM)
- log_err("fio: no huge pages available, do you need to alocate some? See HOWTO.\n");
+ if (errno == EINVAL) {
+ log_err("fio: check that you have free huge"
+ " pages and that hugepage-size is"
+ " correct.\n");
+ } else if (errno == ENOSYS) {
+ log_err("fio: your system does not appear to"
+ " support huge pages.\n");
+ } else if (errno == ENOMEM) {
+ log_err("fio: no huge pages available, do you"
+ " need to alocate some? See HOWTO.\n");
+ }
}
-
+
return 1;
}
@@ -114,7 +121,8 @@
} else
flags |= OS_MAP_ANON;
- td->orig_buffer = mmap(NULL, td->orig_buffer_size, PROT_READ | PROT_WRITE, flags, td->mmapfd, 0);
+ td->orig_buffer = mmap(NULL, td->orig_buffer_size,
+ PROT_READ | PROT_WRITE, flags, td->mmapfd, 0);
dprint(FD_MEM, "mmap %zu/%d %p\n", td->orig_buffer_size, td->mmapfd,
td->orig_buffer);
if (td->orig_buffer == MAP_FAILED) {
@@ -124,7 +132,7 @@
close(td->mmapfd);
unlink(td->mmapfile);
}
-
+
return 1;
}
@@ -137,7 +145,7 @@
if (td->o.odirect)
bsize += page_mask;
-
+
td->orig_buffer = malloc(bsize);
dprint(FD_MEM, "malloc %u %p\n", bsize, td->orig_buffer);
if (td->orig_buffer)
@@ -181,7 +189,8 @@
} else if (td->o.mem_type == MEM_SHM || td->o.mem_type == MEM_SHMHUGE) {
struct shmid_ds sbuf;
- dprint(FD_MEM, "shmdt/ctl %d %p\n", td->shm_id,td->orig_buffer);
+ dprint(FD_MEM, "shmdt/ctl %d %p\n", td->shm_id,
+ td->orig_buffer);
shmdt(td->orig_buffer);
shmctl(td->shm_id, IPC_RMID, &sbuf);
} else if (td->o.mem_type == MEM_MMAP ||
diff --git a/options.c b/options.c
index bb77683..f05b786 100644
--- a/options.c
+++ b/options.c
@@ -66,7 +66,9 @@
*/
if (i == td->o.bssplit_nr) {
td->o.bssplit_nr <<= 1;
- td->o.bssplit = realloc(td->o.bssplit, td->o.bssplit_nr * sizeof(struct bssplit));
+ td->o.bssplit = realloc(td->o.bssplit,
+ td->o.bssplit_nr
+ * sizeof(struct bssplit));
}
perc_str = strstr(fname, "/");
@@ -852,7 +854,7 @@
.type = FIO_OPT_STR_VAL_INT,
.help = "Offset verify header location by N bytes",
.def = "0",
- .cb = str_verify_offset_cb,
+ .cb = str_verify_offset_cb,
.parent = "verify",
},
{
@@ -1050,7 +1052,8 @@
.name = "bwavgtime",
.type = FIO_OPT_INT,
.off1 = td_var_offset(bw_avg_time),
- .help = "Time window over which to calculate bandwidth (msec)",
+ .help = "Time window over which to calculate bandwidth"
+ " (msec)",
.def = "500",
},
{
diff --git a/parse.c b/parse.c
index f9e0ebe..8e29fab 100644
--- a/parse.c
+++ b/parse.c
@@ -70,37 +70,37 @@
static unsigned long get_mult_time(char c)
{
switch (c) {
- case 'm':
- case 'M':
- return 60;
- case 'h':
- case 'H':
- return 60 * 60;
- case 'd':
- case 'D':
- return 24 * 60 * 60;
- default:
- return 1;
+ case 'm':
+ case 'M':
+ return 60;
+ case 'h':
+ case 'H':
+ return 60 * 60;
+ case 'd':
+ case 'D':
+ return 24 * 60 * 60;
+ default:
+ return 1;
}
}
static unsigned long get_mult_bytes(char c)
{
switch (c) {
- case 'k':
- case 'K':
- return 1024;
- case 'm':
- case 'M':
- return 1024 * 1024;
- case 'g':
- case 'G':
- return 1024 * 1024 * 1024;
- case 'e':
- case 'E':
- return 1024 * 1024 * 1024 * 1024UL;
- default:
- return 1;
+ case 'k':
+ case 'K':
+ return 1024;
+ case 'm':
+ case 'M':
+ return 1024 * 1024;
+ case 'g':
+ case 'G':
+ return 1024 * 1024 * 1024;
+ case 'e':
+ case 'E':
+ return 1024 * 1024 * 1024 * 1024UL;
+ default:
+ return 1;
}
}
@@ -282,11 +282,13 @@
break;
if (o->maxval && ull > o->maxval) {
- fprintf(stderr, "max value out of range: %lld (%d max)\n", ull, o->maxval);
+ fprintf(stderr, "max value out of range: %lld"
+ " (%d max)\n", ull, o->maxval);
return 1;
}
if (o->minval && ull < o->minval) {
- fprintf(stderr, "min value out of range: %lld (%d min)\n", ull, o->minval);
+ fprintf(stderr, "min value out of range: %lld"
+ " (%d min)\n", ull, o->minval);
return 1;
}
@@ -341,7 +343,8 @@
p1 = tmp;
ret = 1;
- if (!check_range_bytes(p1, &ul1) && !check_range_bytes(p2, &ul2)) {
+ if (!check_range_bytes(p1, &ul1) &&
+ !check_range_bytes(p2, &ul2)) {
ret = 0;
if (ul1 > ul2) {
unsigned long foo = ul1;
@@ -371,11 +374,13 @@
break;
if (o->maxval && il > (int) o->maxval) {
- fprintf(stderr, "max value out of range: %d (%d max)\n", il, o->maxval);
+ fprintf(stderr, "max value out of range: %d (%d max)\n",
+ il, o->maxval);
return 1;
}
if (o->minval && il < o->minval) {
- fprintf(stderr, "min value out of range: %d (%d min)\n", il, o->minval);
+ fprintf(stderr, "min value out of range: %d (%d min)\n",
+ il, o->minval);
return 1;
}
@@ -589,7 +594,7 @@
return;
if (!org)
org = o;
-
+
p = name;
depth = level;
while (depth--)
@@ -714,13 +719,20 @@
o->minval = 0;
o->maxval = 1;
}
- if (o->type == FIO_OPT_STR_SET && o->def)
- fprintf(stderr, "Option %s: string set option with default will always be true\n", o->name);
- if (!o->cb && !o->off1)
- fprintf(stderr, "Option %s: neither cb nor offset given\n", o->name);
+ if (o->type == FIO_OPT_STR_SET && o->def) {
+ fprintf(stderr, "Option %s: string set option with"
+ " default will always be true\n",
+ o->name);
+ }
+ if (!o->cb && !o->off1) {
+ fprintf(stderr, "Option %s: neither cb nor offset"
+ " given\n", o->name);
+ }
if (o->type == FIO_OPT_STR || o->type == FIO_OPT_STR_STORE)
continue;
- if (o->cb && (o->off1 || o->off2 || o->off3 || o->off4))
- fprintf(stderr, "Option %s: both cb and offset given\n", o->name);
+ if (o->cb && (o->off1 || o->off2 || o->off3 || o->off4)) {
+ fprintf(stderr, "Option %s: both cb and offset given\n",
+ o->name);
+ }
}
}
diff --git a/smalloc.c b/smalloc.c
index 85da781..b7502dc 100644
--- a/smalloc.c
+++ b/smalloc.c
@@ -364,7 +364,7 @@
do {
if (combine(pool, prv, hdr))
hdr = prv;
-
+
if (hdr_free(hdr) && hdr_size(hdr) >= size)
break;
diff --git a/stat.c b/stat.c
index 604c235..e3e084e 100644
--- a/stat.c
+++ b/stat.c
@@ -58,12 +58,15 @@
getrusage(RUSAGE_SELF, &ts->ru_end);
- ts->usr_time += mtime_since(&ts->ru_start.ru_utime, &ts->ru_end.ru_utime);
- ts->sys_time += mtime_since(&ts->ru_start.ru_stime, &ts->ru_end.ru_stime);
- ts->ctx += ts->ru_end.ru_nvcsw + ts->ru_end.ru_nivcsw - (ts->ru_start.ru_nvcsw + ts->ru_start.ru_nivcsw);
+ ts->usr_time += mtime_since(&ts->ru_start.ru_utime,
+ &ts->ru_end.ru_utime);
+ ts->sys_time += mtime_since(&ts->ru_start.ru_stime,
+ &ts->ru_end.ru_stime);
+ ts->ctx += ts->ru_end.ru_nvcsw + ts->ru_end.ru_nivcsw
+ - (ts->ru_start.ru_nvcsw + ts->ru_start.ru_nivcsw);
ts->minf += ts->ru_end.ru_minflt - ts->ru_start.ru_minflt;
ts->majf += ts->ru_end.ru_majflt - ts->ru_start.ru_majflt;
-
+
memcpy(&ts->ru_start, &ts->ru_end, sizeof(ts->ru_end));
}
@@ -106,7 +109,10 @@
p3 = num2str(rs->min_bw[i], 6, 1000, 1);
p4 = num2str(rs->max_bw[i], 6, 1000, 1);
- log_info("%s: io=%siB, aggrb=%siB/s, minb=%siB/s, maxb=%siB/s, mint=%llumsec, maxt=%llumsec\n", ddir_str[i], p1, p2, p3, p4, rs->min_run[i], rs->max_run[i]);
+ log_info("%s: io=%siB, aggrb=%siB/s, minb=%siB/s, maxb=%siB/s,"
+ " mint=%llumsec, maxt=%llumsec\n", ddir_str[i], p1, p2,
+ p3, p4, rs->min_run[i],
+ rs->max_run[i]);
free(p1);
free(p2);
@@ -126,7 +132,8 @@
* Do depth distribution calculations
*/
for (i = 0; i < FIO_IO_U_MAP_NR; i++) {
- io_u_dist[i] = (double) ts->io_u_map[i] / (double) ts_total_io_u(ts);
+ io_u_dist[i] = (double) ts->io_u_map[i]
+ / (double) ts_total_io_u(ts);
io_u_dist[i] *= 100.0;
if (io_u_dist[i] < 0.1 && ts->io_u_map[i])
io_u_dist[i] = 0.1;
@@ -191,7 +198,9 @@
bw_p = num2str(bw, 6, 1000, 1);
iops_p = num2str(iops, 6, 1, 0);
- log_info(" %s: io=%siB, bw=%siB/s, iops=%s, runt=%6lumsec\n", ddir_str[ddir], io_p, bw_p, iops_p, ts->runtime[ddir]);
+ log_info(" %s: io=%siB, bw=%siB/s, iops=%s, runt=%6lumsec\n",
+ ddir_str[ddir], io_p, bw_p, iops_p,
+ ts->runtime[ddir]);
free(io_p);
free(bw_p);
@@ -207,7 +216,8 @@
minp = num2str(min, 6, 1, 0);
maxp = num2str(max, 6, 1, 0);
- log_info(" slat %s: min=%s, max=%s, avg=%5.02f, stdev=%5.02f\n", base, minp, maxp, mean, dev);
+ log_info(" slat %s: min=%s, max=%s, avg=%5.02f,"
+ " stdev=%5.02f\n", base, minp, maxp, mean, dev);
free(minp);
free(maxp);
@@ -221,8 +231,9 @@
minp = num2str(min, 6, 1, 0);
maxp = num2str(max, 6, 1, 0);
-
- log_info(" clat %s: min=%s, max=%s, avg=%5.02f, stdev=%5.02f\n", base, minp, maxp, mean, dev);
+
+ log_info(" clat %s: min=%s, max=%s, avg=%5.02f,"
+ " stdev=%5.02f\n", base, minp, maxp, mean, dev);
free(minp);
free(maxp);
@@ -231,7 +242,9 @@
double p_of_agg;
p_of_agg = mean * 100 / (double) rs->agg[ddir];
- log_info(" bw (KiB/s) : min=%5lu, max=%5lu, per=%3.2f%%, avg=%5.02f, stdev=%5.02f\n", min, max, p_of_agg, mean, dev);
+ log_info(" bw (KiB/s) : min=%5lu, max=%5lu, per=%3.2f%%,"
+ " avg=%5.02f, stdev=%5.02f\n", min, max, p_of_agg,
+ mean, dev);
}
}
@@ -297,10 +310,15 @@
!(ts->total_io_u[0] + ts->total_io_u[1]))
return;
- if (!ts->error)
- log_info("%s: (groupid=%d, jobs=%d): err=%2d: pid=%d\n", ts->name, ts->groupid, ts->members, ts->error, ts->pid);
- else
- log_info("%s: (groupid=%d, jobs=%d): err=%2d (%s): pid=%d\n", ts->name, ts->groupid, ts->members, ts->error, ts->verror, ts->pid);
+ if (!ts->error) {
+ log_info("%s: (groupid=%d, jobs=%d): err=%2d: pid=%d\n",
+ ts->name, ts->groupid, ts->members,
+ ts->error, ts->pid);
+ } else {
+ log_info("%s: (groupid=%d, jobs=%d): err=%2d (%s): pid=%d\n",
+ ts->name, ts->groupid, ts->members,
+ ts->error, ts->verror, ts->pid);
+ }
if (ts->description)
log_info(" Description : [%s]\n", ts->description);
@@ -321,14 +339,21 @@
sys_cpu = 0;
}
- log_info(" cpu : usr=%3.2f%%, sys=%3.2f%%, ctx=%lu, majf=%lu, minf=%lu\n", usr_cpu, sys_cpu, ts->ctx, ts->majf, ts->minf);
+ log_info(" cpu : usr=%3.2f%%, sys=%3.2f%%, ctx=%lu, majf=%lu,"
+ " minf=%lu\n", usr_cpu, sys_cpu, ts->ctx, ts->majf, ts->minf);
stat_calc_dist(ts, io_u_dist);
stat_calc_lat_u(ts, io_u_lat_u);
stat_calc_lat_m(ts, io_u_lat_m);
- log_info(" IO depths : 1=%3.1f%%, 2=%3.1f%%, 4=%3.1f%%, 8=%3.1f%%, 16=%3.1f%%, 32=%3.1f%%, >=64=%3.1f%%\n", io_u_dist[0], io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]);
- log_info(" issued r/w: total=%lu/%lu, short=%lu/%lu\n", ts->total_io_u[0], ts->total_io_u[1], ts->short_io_u[0], ts->short_io_u[1]);
+ log_info(" IO depths : 1=%3.1f%%, 2=%3.1f%%, 4=%3.1f%%, 8=%3.1f%%,"
+ " 16=%3.1f%%, 32=%3.1f%%, >=64=%3.1f%%\n", io_u_dist[0],
+ io_u_dist[1], io_u_dist[2],
+ io_u_dist[3], io_u_dist[4],
+ io_u_dist[5], io_u_dist[6]);
+ log_info(" issued r/w: total=%lu/%lu, short=%lu/%lu\n",
+ ts->total_io_u[0], ts->total_io_u[1],
+ ts->short_io_u[0], ts->short_io_u[1]);
show_latencies(io_u_lat_u, io_u_lat_m);
}
@@ -344,7 +369,8 @@
if (ts->runtime[ddir])
bw = ts->io_bytes[ddir] / ts->runtime[ddir];
- log_info(";%llu;%llu;%lu", ts->io_bytes[ddir] >> 10, bw, ts->runtime[ddir]);
+ log_info(";%llu;%llu;%lu", ts->io_bytes[ddir] >> 10, bw,
+ ts->runtime[ddir]);
if (calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev))
log_info(";%lu;%lu;%f;%f", min, max, mean, dev);
@@ -390,13 +416,16 @@
sys_cpu = 0;
}
- log_info(";%f%%;%f%%;%lu;%lu;%lu", usr_cpu, sys_cpu, ts->ctx, ts->majf, ts->minf);
+ log_info(";%f%%;%f%%;%lu;%lu;%lu", usr_cpu, sys_cpu, ts->ctx, ts->majf,
+ ts->minf);
stat_calc_dist(ts, io_u_dist);
stat_calc_lat_u(ts, io_u_lat_u);
stat_calc_lat_m(ts, io_u_lat_m);
- log_info(";%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%", io_u_dist[0], io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]);
+ log_info(";%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%",
+ io_u_dist[0], io_u_dist[1], io_u_dist[2], io_u_dist[3],
+ io_u_dist[4], io_u_dist[5], io_u_dist[6]);
for (i = 0; i < FIO_IO_U_LAT_U_NR; i++)
log_info(";%3.2f%%", io_u_lat_u[i]);
@@ -426,7 +455,8 @@
mean = src->mean;
S = src->S;
} else {
- mean = ((src->mean * (double) (nr - 1)) + dst->mean) / ((double) nr);
+ mean = ((src->mean * (double) (nr - 1))
+ + dst->mean) / ((double) nr);
S = ((src->S * (double) (nr - 1)) + dst->S) / ((double) nr);
}
@@ -569,7 +599,8 @@
bw = 0;
if (ts->runtime[j])
- bw = ts->io_bytes[j] / (unsigned long long) ts->runtime[j];
+ bw = ts->io_bytes[j]
+ / (unsigned long long) ts->runtime[j];
if (bw < rs->min_bw[j])
rs->min_bw[j] = bw;
if (bw > rs->max_bw[j])
diff --git a/time.c b/time.c
index 6d79ecd..505058f 100644
--- a/time.c
+++ b/time.c
@@ -10,7 +10,7 @@
{
long sec, usec;
unsigned long long ret;
-
+
sec = e->tv_sec - s->tv_sec;
usec = e->tv_usec - s->tv_usec;
if (sec > 0 && usec < 0) {
@@ -23,9 +23,9 @@
*/
if (sec < 0 || (sec == 0 && usec < 0))
return 0;
-
+
ret = sec * 1000000ULL + usec;
-
+
return ret;
}
diff --git a/verify.c b/verify.c
index c9f2374..0bb348f 100644
--- a/verify.c
+++ b/verify.c
@@ -167,14 +167,13 @@
* Return data area 'header_num'
*/
static inline void *io_u_verify_off(struct verify_header *hdr,
- struct io_u *io_u,
- unsigned char header_num)
+ struct io_u *io_u, unsigned char header_num)
{
return io_u->buf + header_num * hdr->len + hdr_size(hdr);
}
static int verify_io_u_meta(struct verify_header *hdr, struct thread_data *td,
- struct io_u *io_u, unsigned int header_num)
+ struct io_u *io_u, unsigned int header_num)
{
struct vhdr_meta *vh = hdr_priv(hdr);
@@ -182,8 +181,7 @@
if (vh->offset != io_u->offset + header_num * td->o.verify_interval) {
log_err("meta: verify failed at %llu/%u\n",
- io_u->offset + header_num * hdr->len,
- hdr->len);
+ io_u->offset + header_num * hdr->len, hdr->len);
return EIO;
}
@@ -207,8 +205,7 @@
if (memcmp(vh->sha512, sha512_ctx.buf, sizeof(sha512))) {
log_err("sha512: verify failed at %llu/%u\n",
- io_u->offset + header_num * hdr->len,
- hdr->len);
+ io_u->offset + header_num * hdr->len, hdr->len);
hexdump(vh->sha512, sizeof(vh->sha512));
hexdump(sha512_ctx.buf, sizeof(sha512));
return EIO;
@@ -234,8 +231,7 @@
if (memcmp(vh->sha256, sha256_ctx.buf, sizeof(sha256))) {
log_err("sha256: verify failed at %llu/%u\n",
- io_u->offset + header_num * hdr->len,
- hdr->len);
+ io_u->offset + header_num * hdr->len, hdr->len);
hexdump(vh->sha256, sizeof(vh->sha256));
hexdump(sha256_ctx.buf, sizeof(sha256));
return EIO;
@@ -245,7 +241,7 @@
}
static int verify_io_u_crc7(struct verify_header *hdr, struct io_u *io_u,
- unsigned char header_num)
+ unsigned char header_num)
{
void *p = io_u_verify_off(hdr, io_u, header_num);
struct vhdr_crc7 *vh = hdr_priv(hdr);
@@ -257,8 +253,7 @@
if (c != vh->crc7) {
log_err("crc7: verify failed at %llu/%u\n",
- io_u->offset + header_num * hdr->len,
- hdr->len);
+ io_u->offset + header_num * hdr->len, hdr->len);
log_err("crc7: wanted %x, got %x\n", vh->crc7, c);
return EIO;
}
@@ -267,7 +262,7 @@
}
static int verify_io_u_crc16(struct verify_header *hdr, struct io_u *io_u,
- unsigned int header_num)
+ unsigned int header_num)
{
void *p = io_u_verify_off(hdr, io_u, header_num);
struct vhdr_crc16 *vh = hdr_priv(hdr);
@@ -279,8 +274,7 @@
if (c != vh->crc16) {
log_err("crc16: verify failed at %llu/%u\n",
- io_u->offset + header_num * hdr->len,
- hdr->len);
+ io_u->offset + header_num * hdr->len, hdr->len);
log_err("crc16: wanted %x, got %x\n", vh->crc16, c);
return EIO;
}
@@ -289,7 +283,7 @@
}
static int verify_io_u_crc64(struct verify_header *hdr, struct io_u *io_u,
- unsigned int header_num)
+ unsigned int header_num)
{
void *p = io_u_verify_off(hdr, io_u, header_num);
struct vhdr_crc64 *vh = hdr_priv(hdr);
@@ -303,7 +297,8 @@
log_err("crc64: verify failed at %llu/%u\n",
io_u->offset + header_num * hdr->len,
hdr->len);
- log_err("crc64: wanted %llx, got %llx\n", (unsigned long long) vh->crc64, c);
+ log_err("crc64: wanted %llx, got %llx\n",
+ (unsigned long long) vh->crc64, c);
return EIO;
}
@@ -311,7 +306,7 @@
}
static int verify_io_u_crc32(struct verify_header *hdr, struct io_u *io_u,
- unsigned int header_num)
+ unsigned int header_num)
{
void *p = io_u_verify_off(hdr, io_u, header_num);
struct vhdr_crc32 *vh = hdr_priv(hdr);
@@ -323,8 +318,7 @@
if (c != vh->crc32) {
log_err("crc32: verify failed at %llu/%u\n",
- io_u->offset + header_num * hdr->len,
- hdr->len);
+ io_u->offset + header_num * hdr->len, hdr->len);
log_err("crc32: wanted %x, got %x\n", vh->crc32, c);
return EIO;
}
@@ -333,7 +327,7 @@
}
static int verify_io_u_md5(struct verify_header *hdr, struct io_u *io_u,
- unsigned int header_num)
+ unsigned int header_num)
{
void *p = io_u_verify_off(hdr, io_u, header_num);
struct vhdr_md5 *vh = hdr_priv(hdr);
@@ -349,8 +343,7 @@
if (memcmp(vh->md5_digest, md5_ctx.hash, sizeof(hash))) {
log_err("md5: verify failed at %llu/%u\n",
- io_u->offset + header_num * hdr->len,
- hdr->len);
+ io_u->offset + header_num * hdr->len, hdr->len);
hexdump(vh->md5_digest, sizeof(vh->md5_digest));
hexdump(md5_ctx.hash, sizeof(hash));
return EIO;
@@ -368,7 +361,7 @@
}
int verify_io_u_pattern(unsigned long pattern, unsigned long pattern_size,
- char *buf, unsigned int len, unsigned int mod)
+ char *buf, unsigned int len, unsigned int mod)
{
unsigned int i;
char split_pattern[4];
@@ -411,7 +404,8 @@
hdr_inc = td->o.verify_interval;
ret = 0;
- for (p = io_u->buf; p < io_u->buf + io_u->buflen; p += hdr_inc, hdr_num++) {
+ for (p = io_u->buf; p < io_u->buf + io_u->buflen;
+ p += hdr_inc, hdr_num++) {
if (ret && td->o.verify_fatal) {
td->terminate = 1;
break;
@@ -430,10 +424,10 @@
dprint(FD_VERIFY, "pattern verify io_u %p, len %u\n",
io_u, hdr->len);
ret = verify_io_u_pattern(td->o.verify_pattern,
- td->o.verify_pattern_bytes,
- p + hdr_size,
- hdr_inc - hdr_size,
- hdr_size % 4);
+ td->o.verify_pattern_bytes,
+ p + hdr_size,
+ hdr_inc - hdr_size,
+ hdr_size % 4);
if (ret)
log_err("fio: verify failed at %llu/%u\n",
io_u->offset + hdr_num * hdr->len,
@@ -476,7 +470,7 @@
}
static void fill_meta(struct verify_header *hdr, struct thread_data *td,
- struct io_u *io_u, unsigned int header_num)
+ struct io_u *io_u, unsigned int header_num)
{
struct vhdr_meta *vh = hdr_priv(hdr);
@@ -570,7 +564,7 @@
if (td->o.verify_interval)
hdr_inc = td->o.verify_interval;
- for (;p < io_u->buf + io_u->buflen; p += hdr_inc) {
+ for (; p < io_u->buf + io_u->buflen; p += hdr_inc) {
hdr = p;
hdr->fio_magic = FIO_HDR_MAGIC;