From: Jens Axboe Date: Tue, 5 Jun 2018 19:44:47 +0000 (-0600) Subject: Fix variable shadowing X-Git-Tag: fio-3.8~40 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=a43f4461d5716c4c46018dd45cecf0a896d05dbd Fix variable shadowing Signed-off-by: Jens Axboe --- diff --git a/backend.c b/backend.c index 151210a4..c52eba58 100644 --- a/backend.c +++ b/backend.c @@ -1034,7 +1034,7 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done) if (td->o.io_submit_mode == IO_MODE_OFFLOAD) { const unsigned long blen = io_u->xfer_buflen; - const enum fio_ddir ddir = acct_ddir(io_u); + const enum fio_ddir __ddir = acct_ddir(io_u); if (td->error) break; @@ -1042,14 +1042,14 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done) workqueue_enqueue(&td->io_wq, &io_u->work); ret = FIO_Q_QUEUED; - if (ddir_rw(ddir)) { - td->io_issues[ddir]++; - td->io_issue_bytes[ddir] += blen; - td->rate_io_issue_bytes[ddir] += blen; + if (ddir_rw(__ddir)) { + td->io_issues[__ddir]++; + td->io_issue_bytes[__ddir] += blen; + td->rate_io_issue_bytes[__ddir] += blen; } if (should_check_rate(td)) - td->rate_next_io_time[ddir] = usec_for_io(td, ddir); + td->rate_next_io_time[__ddir] = usec_for_io(td, __ddir); } else { ret = io_u_submit(td, io_u); diff --git a/iolog.c b/iolog.c index d7474724..5be3e84b 100644 --- a/iolog.c +++ b/iolog.c @@ -619,12 +619,12 @@ void setup_log(struct io_log **log, struct log_params *p, } if (l->td && l->td->o.io_submit_mode != IO_MODE_OFFLOAD) { - struct io_logs *p; + struct io_logs *__p; - p = calloc(1, sizeof(*l->pending)); - p->max_samples = DEF_LOG_ENTRIES; - p->log = calloc(p->max_samples, log_entry_sz(l)); - l->pending = p; + __p = calloc(1, sizeof(*l->pending)); + __p->max_samples = DEF_LOG_ENTRIES; + __p->log = calloc(__p->max_samples, log_entry_sz(l)); + l->pending = __p; } if (l->log_offset) diff --git a/options.c b/options.c index 445f3d45..9fbcd96d 100644 --- a/options.c +++ b/options.c @@ -1046,8 +1046,6 @@ static int parse_zoned_distribution(struct thread_data *td, const char *input, } if (parse_dryrun()) { - int i; - for (i = 0; i < DDIR_RWDIR_CNT; i++) { free(td->o.zone_split[i]); td->o.zone_split[i] = NULL; diff --git a/server.c b/server.c index 12c8d684..7e7ffedc 100644 --- a/server.c +++ b/server.c @@ -1594,7 +1594,7 @@ void fio_server_send_gs(struct group_run_stats *rs) } void fio_server_send_job_options(struct flist_head *opt_list, - unsigned int groupid) + unsigned int gid) { struct cmd_job_option pdu; struct flist_head *entry; @@ -1609,12 +1609,12 @@ void fio_server_send_job_options(struct flist_head *opt_list, p = flist_entry(entry, struct print_option, list); memset(&pdu, 0, sizeof(pdu)); - if (groupid == -1U) { + if (gid == -1U) { pdu.global = __cpu_to_le16(1); pdu.groupid = 0; } else { pdu.global = 0; - pdu.groupid = cpu_to_le32(groupid); + pdu.groupid = cpu_to_le32(gid); } len = strlen(p->name); if (len >= sizeof(pdu.name)) { diff --git a/stat.c b/stat.c index 1effbfe9..5b49dddb 100644 --- a/stat.c +++ b/stat.c @@ -1398,7 +1398,7 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts, if (ts->ss_dur) { struct json_object *data; struct json_array *iops, *bw; - int i, j, k; + int j, k, l; char ss_buf[64]; snprintf(ss_buf, sizeof(ss_buf), "%s%s:%f%s", @@ -1434,8 +1434,8 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts, j = ts->ss_head; else j = ts->ss_head == 0 ? ts->ss_dur - 1 : ts->ss_head - 1; - for (i = 0; i < ts->ss_dur; i++) { - k = (j + i) % ts->ss_dur; + for (l = 0; l < ts->ss_dur; l++) { + k = (j + l) % ts->ss_dur; json_array_add_value_int(bw, ts->ss_bw_data[k]); json_array_add_value_int(iops, ts->ss_iops_data[k]); }