Found a few issues, actually.
Signed-off-by: Jens Axboe <axboe@fb.com>
/* numa node setup */
if (o->numa_cpumask_set || o->numa_memmask_set) {
struct bitmask *mask;
- int ret;
if (numa_available() < 0) {
td_verror(td, errno, "Does not support NUMA API\n");
cgroup_shutdown(td, &cgroup_mnt);
if (o->cpumask_set) {
- int ret = fio_cpuset_exit(&o->cpumask);
-
- td_verror(td, ret, "fio_cpuset_exit");
+ ret = fio_cpuset_exit(&o->cpumask);
+ if (ret)
+ td_verror(td, ret, "fio_cpuset_exit");
}
/*
if (!fio_abort) {
__show_run_stats();
if (write_bw_log) {
- int i;
-
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
struct io_log *log = agg_io_log[i];
fd = open(filename, O_RDONLY);
if (fd < 0) {
- int ret = -errno;
-
+ ret = -errno;
log_err("fio: job file <%s> open: %s\n", filename, strerror(errno));
return ret;
}
if (fstat(fd, &sb) < 0) {
- int ret = -errno;
-
+ ret = -errno;
log_err("fio: job file stat: %s\n", strerror(errno));
close(fd);
return ret;
}
if (!o->inplace) {
- long long len = td->o.file_size_high - td->o.start_offset;
- r = fallocate(ed->donor_fd, 0, td->o.start_offset, len);
+ long long __len = td->o.file_size_high - td->o.start_offset;
+ r = fallocate(ed->donor_fd, 0, td->o.start_offset, __len);
if (r)
goto err;
}
static char __run_str[REAL_MAX_JOBS + 1];
static char run_str[__THREAD_RUNSTR_SZ(REAL_MAX_JOBS)];
-static void update_condensed_str(char *run_str, char *run_str_condensed)
+static void update_condensed_str(char *rstr, char *run_str_condensed)
{
- if (*run_str) {
- while (*run_str) {
+ if (*rstr) {
+ while (*rstr) {
int nr = 1;
- *run_str_condensed++ = *run_str++;
- while (*(run_str - 1) == *run_str) {
- run_str++;
+ *run_str_condensed++ = *rstr++;
+ while (*(rstr - 1) == *rstr) {
+ rstr++;
nr++;
}
run_str_condensed += sprintf(run_str_condensed, "(%u),", nr);
* if given, otherwise assume it'll run at the specified rate.
*/
if (td->o.timeout) {
- uint64_t timeout = td->o.timeout;
+ uint64_t __timeout = td->o.timeout;
uint64_t start_delay = td->o.start_delay;
uint64_t ramp_time = td->o.ramp_time;
- t_eta = timeout + start_delay + ramp_time;
+ t_eta = __timeout + start_delay + ramp_time;
t_eta /= 1000000ULL;
if (in_ramp_time(td)) {
int fio_monotonic_clocktest(void)
{
- struct clock_thread *threads;
+ struct clock_thread *cthreads;
unsigned int nr_cpus = cpus_online();
struct clock_entry *entries;
unsigned long tentries, failed = 0;
fio_debug &= ~(1U << FD_TIME);
#endif
- threads = malloc(nr_cpus * sizeof(struct clock_thread));
+ cthreads = malloc(nr_cpus * sizeof(struct clock_thread));
tentries = CLOCK_ENTRIES * nr_cpus;
entries = malloc(tentries * sizeof(struct clock_entry));
log_info("cs: Testing %u CPUs\n", nr_cpus);
for (i = 0; i < nr_cpus; i++) {
- struct clock_thread *t = &threads[i];
+ struct clock_thread *t = &cthreads[i];
t->cpu = i;
t->seq = &seq;
}
for (i = 0; i < nr_cpus; i++) {
- struct clock_thread *t = &threads[i];
+ struct clock_thread *t = &cthreads[i];
pthread_mutex_lock(&t->started);
}
for (i = 0; i < nr_cpus; i++) {
- struct clock_thread *t = &threads[i];
+ struct clock_thread *t = &cthreads[i];
pthread_mutex_unlock(&t->lock);
}
for (i = 0; i < nr_cpus; i++) {
- struct clock_thread *t = &threads[i];
+ struct clock_thread *t = &cthreads[i];
void *ret;
pthread_join(t->thread, &ret);
if (ret)
failed++;
}
- free(threads);
+ free(cthreads);
if (failed) {
log_err("Clocksource test: %lu threads failed\n", failed);
return get_off_from_method(td, f, ddir, b);
if (!flist_empty(&td->next_rand_list)) {
- struct rand_off *r;
fetch:
r = flist_first_entry(&td->next_rand_list, struct rand_off, list);
flist_del(&r->list);
*/
total = ic.len;
do {
- size_t ret;
+ size_t iret;
- ret = inflate_chunk(&ic, 1, stdout, &stream, &iter);
- total -= ret;
+ iret = inflate_chunk(&ic, 1, stdout, &stream, &iter);
+ total -= iret;
if (!total)
break;
if (iter.err)
break;
ic.seq++;
- ic.len -= ret;
- ic.buf += ret;
+ ic.len -= iret;
+ ic.buf += iret;
} while (1);
if (iter.seq) {
* The memory overhead of the following tap table should be relatively small,
* no more than 400 bytes.
*/
-static uint8_t taps[64][FIO_MAX_TAPS] =
+static uint8_t lfsr_taps[64][FIO_MAX_TAPS] =
{
{0}, {0}, {0}, //LFSRs with less that 3-bits cannot exist
{3, 2}, //Tap position for 3-bit LFSR
/*
* For an LFSR, there is always a prohibited state (all ones).
- * Thus, if we need to find the proper LFSR for our size, we must take that
- * into account.
+ * Thus, if we need to find the proper LFSR for our size, we must
+ * take that into account.
*/
for (i = 3; i < 64; i++)
if ((1UL << i) > size)
- return taps[i];
+ return lfsr_taps[i];
return NULL;
}
int lfsr_init(struct fio_lfsr *fl, uint64_t nums, unsigned long seed,
unsigned int spin)
{
- uint8_t *lfsr_taps;
+ uint8_t *taps;
- lfsr_taps = find_lfsr(nums);
- if (!lfsr_taps)
+ taps = find_lfsr(nums);
+ if (!taps)
return 1;
fl->max_val = nums - 1;
- fl->xormask = lfsr_create_xormask(lfsr_taps);
- fl->cached_bit = 1UL << (lfsr_taps[0] - 1);
+ fl->xormask = lfsr_create_xormask(taps);
+ fl->cached_bit = 1UL << (taps[0] - 1);
if (prepare_spin(fl, spin))
return 1;
q[0] = p[0] + 1;
for (j = 1; j <= s2_len; j++) {
unsigned int sub = p[j - 1];
+ unsigned int pmin;
if (s1[i - 1] != s2[j - 1])
sub++;
- q[j] = min(p[j] + 1, min(q[j - 1] + 1, sub));
+ pmin = min(q[j - 1] + 1, sub);
+ q[j] = min(p[j] + 1, pmin);
}
r = p;
p = q;
/* zero-terminate text input */
if (cmdret->pdu_len) {
if (cmdret->opcode == FIO_NET_CMD_TEXT) {
- struct cmd_text_pdu *pdu = (struct cmd_text_pdu *) cmdret->payload;
- char *buf = (char *) pdu->buf;
+ struct cmd_text_pdu *__pdu = (struct cmd_text_pdu *) cmdret->payload;
+ char *buf = (char *) __pdu->buf;
- buf[pdu->buf_len] = '\0';
+ buf[__pdu->buf_len] = '\0';
} else if (cmdret->opcode == FIO_NET_CMD_JOB) {
- struct cmd_job_pdu *pdu = (struct cmd_job_pdu *) cmdret->payload;
- char *buf = (char *) pdu->buf;
- int len = le32_to_cpu(pdu->buf_len);
+ struct cmd_job_pdu *__pdu = (struct cmd_job_pdu *) cmdret->payload;
+ char *buf = (char *) __pdu->buf;
+ int len = le32_to_cpu(__pdu->buf_len);
buf[len] = '\0';
}
do {
unsigned int this_len, flags = 0;
- int ret;
stream.avail_out = FIO_SERVER_MAX_FRAGMENT_PDU;
stream.next_out = out_pdu;
free(pidfile);
return -1;
} else if (pid) {
- int ret = write_pid(pid, pidfile);
-
+ ret = write_pid(pid, pidfile);
free(pidfile);
_exit(ret);
}
* Load a blktrace file by reading all the blk_io_trace entries, and storing
* them as io_pieces like the fio text version would do.
*/
-static int load_blktrace(const char *filename, int need_swap)
+static int load_blktrace(const char *fname, int need_swap)
{
struct btrace_pid *p;
unsigned long traces;
struct fifo *fifo;
int fd, ret = 0;
- fd = open(filename, O_RDONLY);
+ fd = open(fname, O_RDONLY);
if (fd < 0) {
perror("open trace file\n");
return 1;
traces = 0;
do {
- int ret = trace_fifo_get(fifo, fd, &t, sizeof(t));
-
+ ret = trace_fifo_get(fifo, fd, &t, sizeof(t));
if (ret < 0)
goto err;
else if (!ret)