From dcaeb6060f2c7aef184cca5699e12c264ef0b834 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 8 Mar 2012 19:45:37 +0100 Subject: [PATCH] client/server: pass back packed thread_options in add_job() Now the client can see the parsed options. As it turns out, we need to parse locally since the client and server can be vastly different operating systems and architectures. Pass back the options, allowing the client to change them before starting the job. Signed-off-by: Jens Axboe --- gfio.c | 25 ++++++++++--------------- server.c | 15 +-------------- server.h | 9 +-------- 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/gfio.c b/gfio.c index 04c841d9..4521f75d 100644 --- a/gfio.c +++ b/gfio.c @@ -124,6 +124,8 @@ struct gfio_client { GtkWidget *results_widget; GtkWidget *disk_util_frame; GtkWidget *err_entry; + unsigned int job_added; + struct thread_options o; }; static void setup_iops_graph(struct gui *ui) @@ -1206,30 +1208,23 @@ static void gfio_add_job_op(struct fio_client *client, struct fio_net_cmd *cmd) { struct cmd_add_job_pdu *p = (struct cmd_add_job_pdu *) cmd->payload; struct gfio_client *gc = client->client_data; + struct thread_options *o = &gc->o; struct gui *ui = gc->ui; char tmp[8]; - int i; - - p->iodepth = le32_to_cpu(p->iodepth); - p->rw = le32_to_cpu(p->rw); - for (i = 0; i < 2; i++) { - p->min_bs[i] = le32_to_cpu(p->min_bs[i]); - p->max_bs[i] = le32_to_cpu(p->max_bs[i]); - } - - p->numjobs = le32_to_cpu(p->numjobs); - p->group_reporting = le32_to_cpu(p->group_reporting); + convert_thread_options_to_cpu(o, &p->top); gdk_threads_enter(); - gtk_entry_set_text(GTK_ENTRY(ui->eta.name), (gchar *) p->jobname); - gtk_entry_set_text(GTK_ENTRY(ui->eta.iotype), ddir_str(p->rw)); - gtk_entry_set_text(GTK_ENTRY(ui->eta.ioengine), (gchar *) p->ioengine); + gtk_entry_set_text(GTK_ENTRY(ui->eta.name), (gchar *) o->name); + gtk_entry_set_text(GTK_ENTRY(ui->eta.iotype), ddir_str(o->td_ddir)); + gtk_entry_set_text(GTK_ENTRY(ui->eta.ioengine), (gchar *) o->ioengine); - sprintf(tmp, "%u", p->iodepth); + sprintf(tmp, "%u", o->iodepth); gtk_entry_set_text(GTK_ENTRY(ui->eta.iodepth), tmp); + gc->job_added++; + gdk_threads_leave(); } diff --git a/server.c b/server.c index c504e872..b048a6c7 100644 --- a/server.c +++ b/server.c @@ -833,21 +833,8 @@ void fio_server_send_du(void) void fio_server_send_add_job(struct thread_options *o, const char *ioengine) { struct cmd_add_job_pdu pdu; - int i; - - strcpy((char *) pdu.jobname, o->name); - strcpy((char *) pdu.ioengine, ioengine); - - pdu.iodepth = cpu_to_le32(o->iodepth); - pdu.rw = cpu_to_le32(o->td_ddir); - - for (i = 0; i < 2; i++) { - pdu.min_bs[i] = cpu_to_le32(o->min_bs[i]); - pdu.max_bs[i] = cpu_to_le32(o->max_bs[i]); - } - pdu.numjobs = cpu_to_le32(o->numjobs); - pdu.group_reporting = cpu_to_le32(o->group_reporting); + convert_thread_options_to_net(&pdu.top, o); fio_net_send_cmd(server_fd, FIO_NET_CMD_ADD_JOB, &pdu, sizeof(pdu), 0); } diff --git a/server.h b/server.h index 299c7a03..f8ba81a8 100644 --- a/server.h +++ b/server.h @@ -108,14 +108,7 @@ struct cmd_end_pdu { }; struct cmd_add_job_pdu { - uint8_t jobname[32]; - uint8_t ioengine[32]; - uint32_t iodepth; - uint32_t rw; - uint32_t min_bs[2]; - uint32_t max_bs[2]; - uint32_t numjobs; - uint32_t group_reporting; + struct thread_options_pack top; }; struct cmd_text_pdu { -- 2.25.1