client: don't setup shared mem area for just the frontend
[fio.git] / init.c
diff --git a/init.c b/init.c
index 8efd7a4ef6777e429a9ee6d6d1b303f67d0e6e64..40a699c56f81df1fb12e402c6e808123d5319672 100644 (file)
--- a/init.c
+++ b/init.c
@@ -664,12 +664,12 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                goto err;
 
        if (td->o.write_lat_log) {
-               setup_log(&td->ts.lat_log);
-               setup_log(&td->ts.slat_log);
-               setup_log(&td->ts.clat_log);
+               setup_log(&td->lat_log);
+               setup_log(&td->slat_log);
+               setup_log(&td->clat_log);
        }
        if (td->o.write_bw_log)
-               setup_log(&td->ts.bw_log);
+               setup_log(&td->bw_log);
 
        if (!td->o.name)
                td->o.name = strdup(jobname);
@@ -1021,6 +1021,9 @@ static int setup_thread_area(void)
 {
        void *hash;
 
+       if (threads)
+               return 0;
+
        /*
         * 1024 is too much on some machines, scale max_jobs if
         * we get a failure that looks like too large a shm segment
@@ -1279,6 +1282,12 @@ static int parse_cmd_line(int argc, char *argv[])
                        const char *opt = l_opts[lidx].name;
                        char *val = optarg;
 
+                       if (setup_thread_area()) {
+                               do_exit++;
+                               exit_val = 1;
+                               break;
+                       }
+
                        if (!strncmp(opt, "name", 4) && td) {
                                ret = add_job(td, td->o.name ?: "fio", 0);
                                if (ret)
@@ -1343,6 +1352,8 @@ static int parse_cmd_line(int argc, char *argv[])
                        exit_val = 1;
                        break;
                }
+               if (do_exit)
+                       break;
        }
 
        if (do_exit)
@@ -1382,13 +1393,17 @@ int parse_options(int argc, char *argv[])
        fio_options_fill_optstring();
        fio_options_dup_and_init(l_opts);
 
-       if (setup_thread_area())
-               return 1;
        if (fill_def_thread())
                return 1;
 
        job_files = parse_cmd_line(argc, argv);
 
+       /*
+        * Don't setup shared memory for the frontend
+        */
+       if (!nr_clients && setup_thread_area())
+               return 1;
+
        for (i = 0; i < job_files; i++) {
                if (fill_def_thread())
                        return 1;