The following changes since commit a57251532f088ef372f317f89695678691e3e095: json: fix off-by-one in memory alloc (2012-11-13 05:55:38 -0700) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (4): e4defrag: fix always true comparison Fix wrong return type on td_error_type() Get rid of uninitialized_var() client/server: fixup "All clients" reporting backend.c | 1 + client.c | 23 +++++++++++++++++------ compiler/compiler.h | 2 -- engines/e4defrag.c | 2 +- engines/splice.c | 2 +- fio.h | 3 ++- init.c | 4 ++++ io_u.c | 9 ++------- server.c | 3 +++ server.h | 3 ++- 10 files changed, 33 insertions(+), 19 deletions(-) --- Diff of recent changes: diff --git a/backend.c b/backend.c index fd73eda..b80c903 100644 --- a/backend.c +++ b/backend.c @@ -62,6 +62,7 @@ struct io_log *agg_io_log[DDIR_RWDIR_CNT]; int groupid = 0; unsigned int thread_number = 0; +unsigned int stat_number = 0; unsigned int nr_process = 0; unsigned int nr_thread = 0; int shm_id = 0; diff --git a/client.c b/client.c index bf09d7e..a483913 100644 --- a/client.c +++ b/client.c @@ -47,9 +47,11 @@ struct fio_client { int is_sock; int disk_stats_shown; unsigned int jobs; + unsigned int nr_stat; int error; int ipv6; int sent_job; + int did_stat; struct flist_head eta_list; struct client_eta *eta_in_flight; @@ -81,8 +83,9 @@ static FLIST_HEAD(arg_list); static struct thread_stat client_ts; static struct group_run_stats client_gs; -static int sum_stat_clients; +static int sum_stat_clients = 0; static int sum_stat_nr; +static int do_output_all_clients; #define FIO_CLIENT_HASH_BITS 7 #define FIO_CLIENT_HASH_SZ (1 << FIO_CLIENT_HASH_BITS) @@ -159,9 +162,11 @@ static void remove_client(struct fio_client *client) if (client->ini_file) free(client->ini_file); + if (!client->did_stat) + sum_stat_clients -= client->nr_stat; + free(client); nr_clients--; - sum_stat_clients--; } static void put_client(struct fio_client *client) @@ -664,7 +669,7 @@ static void convert_gs(struct group_run_stats *dst, struct group_run_stats *src) dst->groupid = le32_to_cpu(src->groupid); } -static void handle_ts(struct fio_net_cmd *cmd) +static void handle_ts(struct fio_client *client, struct fio_net_cmd *cmd) { struct cmd_ts_pdu *p = (struct cmd_ts_pdu *) cmd->payload; @@ -672,8 +677,9 @@ static void handle_ts(struct fio_net_cmd *cmd) convert_gs(&p->rs, &p->rs); show_thread_status(&p->ts, &p->rs); + client->did_stat = 1; - if (sum_stat_clients == 1) + if (!do_output_all_clients) return; sum_thread_stats(&client_ts, &p->ts, sum_stat_nr); @@ -870,6 +876,12 @@ static void handle_start(struct fio_client *client, struct fio_net_cmd *cmd) client->state = Client_started; client->jobs = le32_to_cpu(pdu->jobs); + client->nr_stat = le32_to_cpu(pdu->stat_outputs); + + if (sum_stat_clients > 1) + do_output_all_clients = 1; + + sum_stat_clients += client->nr_stat; } static void handle_stop(struct fio_client *client, struct fio_net_cmd *cmd) @@ -921,7 +933,7 @@ static int handle_client(struct fio_client *client) free(cmd); break; case FIO_NET_CMD_TS: - handle_ts(cmd); + handle_ts(client, cmd); free(cmd); break; case FIO_NET_CMD_GS: @@ -1053,7 +1065,6 @@ int fio_handle_clients(void) pfds = malloc(nr_clients * sizeof(struct pollfd)); - sum_stat_clients = nr_clients; init_thread_stat(&client_ts); init_group_run_stat(&client_gs); diff --git a/compiler/compiler.h b/compiler/compiler.h index 8dec350..8923f9a 100644 --- a/compiler/compiler.h +++ b/compiler/compiler.h @@ -13,8 +13,6 @@ #define __must_check #endif -#define uninitialized_var(x) x = x - #ifndef _weak #ifndef __CYGWIN__ #define _weak __attribute__((weak)) diff --git a/engines/e4defrag.c b/engines/e4defrag.c index cc88493..e10cf36 100644 --- a/engines/e4defrag.c +++ b/engines/e4defrag.c @@ -161,7 +161,7 @@ static int fio_e4defrag_queue(struct thread_data *td, struct io_u *io_u) ret = ioctl(f->fd, EXT4_IOC_MOVE_EXT, &me); len = me.moved_len * ed->bsz; - if (io_u->file && len >= 0 && ddir_rw(io_u->ddir)) + if (io_u->file && len && ddir_rw(io_u->ddir)) io_u->file->file_pos = io_u->offset + len; if (len > io_u->xfer_buflen) diff --git a/engines/splice.c b/engines/splice.c index aa00234..ca7997b 100644 --- a/engines/splice.c +++ b/engines/splice.c @@ -204,7 +204,7 @@ static int fio_splice_write(struct thread_data *td, struct io_u *io_u) static int fio_spliceio_queue(struct thread_data *td, struct io_u *io_u) { struct spliceio_data *sd = td->io_ops->data; - int uninitialized_var(ret); + int ret = 0; fio_ro_check(td, io_u); diff --git a/fio.h b/fio.h index 1526d19..f69de0d 100644 --- a/fio.h +++ b/fio.h @@ -558,6 +558,7 @@ enum { extern int exitall_on_terminate; extern unsigned int thread_number; +extern unsigned int stat_number; extern unsigned int nr_process, nr_thread; extern int shm_id; extern int groupid; @@ -594,7 +595,7 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u) #define REAL_MAX_JOBS 2048 -static inline enum error_type td_error_type(enum fio_ddir ddir, int err) +static inline enum error_type_bit td_error_type(enum fio_ddir ddir, int err) { if (err == EILSEQ) return ERROR_TYPE_VERIFY_BIT; diff --git a/init.c b/init.c index 23be863..a682423 100644 --- a/init.c +++ b/init.c @@ -317,6 +317,10 @@ static struct thread_data *get_new_job(int global, struct thread_data *parent, profile_add_hooks(td); td->thread_number = thread_number; + + if (!parent || !parent->o.group_reporting) + stat_number++; + return td; } diff --git a/io_u.c b/io_u.c index 119dd65..d81fefd 100644 --- a/io_u.c +++ b/io_u.c @@ -413,7 +413,7 @@ static inline int io_u_fits(struct thread_data *td, struct io_u *io_u, static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u) { const int ddir = io_u->ddir; - unsigned int uninitialized_var(buflen); + unsigned int buflen = 0; unsigned int minbs, maxbs; unsigned long r, rand_max; @@ -1345,7 +1345,7 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u, struct io_completion_data *icd, const enum fio_ddir idx, unsigned int bytes) { - unsigned long uninitialized_var(lusec); + unsigned long lusec = 0; if (!td->o.disable_clat || !td->o.disable_bw) lusec = utime_since(&io_u->issue_time, &icd->time); @@ -1388,11 +1388,6 @@ static long long usec_for_io(struct thread_data *td, enum fio_ddir ddir) static void io_completed(struct thread_data *td, struct io_u *io_u, struct io_completion_data *icd) { - /* - * Older gcc's are too dumb to realize that usec is always used - * initialized, silence that warning. - */ - unsigned long uninitialized_var(usec); struct fio_file *f; dprint_io_u(io_u, "io complete"); diff --git a/server.c b/server.c index 72def7e..33b80d6 100644 --- a/server.c +++ b/server.c @@ -336,12 +336,15 @@ static int handle_job_cmd(struct fio_net_cmd *cmd) struct cmd_end_pdu epdu; int ret; + stat_number = 0; + if (parse_jobs_ini(buf, 1, 0)) { fio_server_send_quit_cmd(); return -1; } spdu.jobs = cpu_to_le32(thread_number); + spdu.stat_outputs = cpu_to_le32(stat_number); fio_net_send_cmd(server_fd, FIO_NET_CMD_START, &spdu, sizeof(spdu), 0); ret = fio_backend(); diff --git a/server.h b/server.h index 9bf8907..624e4c0 100644 --- a/server.h +++ b/server.h @@ -36,7 +36,7 @@ struct fio_net_int_cmd { }; enum { - FIO_SERVER_VER = 8, + FIO_SERVER_VER = 9, FIO_SERVER_MAX_PDU = 1024, @@ -96,6 +96,7 @@ struct cmd_line_pdu { struct cmd_start_pdu { uint32_t jobs; + uint32_t stat_outputs; }; struct cmd_end_pdu { -- 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