Add exitall_on_error option
authorJens Axboe <axboe@fb.com>
Thu, 10 Dec 2015 18:15:52 +0000 (11:15 -0700)
committerJens Axboe <axboe@fb.com>
Thu, 10 Dec 2015 18:15:52 +0000 (11:15 -0700)
Like exitall, but only if a job exits due to erroring out.

Signed-off-by: Jens Axboe <axboe@fb.com>
HOWTO
backend.c
cconv.c
fio.1
init.c
options.c
thread_options.h

diff --git a/HOWTO b/HOWTO
index eb9c8245d4e3253bd311756cafc0708f9538ef83..b21d27e3b15fb74325703a60de6455cef6960596 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -1227,6 +1227,9 @@ exitall           When one job finishes, terminate the rest. The default is
                to wait for each job to finish, sometimes that is not the
                desired action.
 
+exitall_on_error       When one job finishes in error, terminate the rest. The
+               default is to wait for each job to finish.
+
 bwavgtime=int  Average the calculated bandwidth over the given time. Value
                is specified in milliseconds.
 
index 425b0ee94c370ab373cc245361cf60a635b0b2f1..e37fffb7b183e36d0b0d6a05f9db73603e700479 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -974,7 +974,7 @@ reap:
 
                if (!in_ramp_time(td) && should_check_rate(td)) {
                        if (check_min_rate(td, &comp_time)) {
-                               if (exitall_on_terminate)
+                               if (exitall_on_terminate || td->o.exitall_error)
                                        fio_terminate_threads(td->groupid);
                                td_verror(td, EIO, "check_min_rate");
                                break;
@@ -1662,7 +1662,7 @@ static void *thread_main(void *data)
        if (o->exec_postrun)
                exec_string(o, o->exec_postrun, (const char *)"postrun");
 
-       if (exitall_on_terminate)
+       if (exitall_on_terminate || (o->exitall_error && td->error))
                fio_terminate_threads(td->groupid);
 
 err:
diff --git a/cconv.c b/cconv.c
index c0168c47d7ddad0f3c9dfee1cf1d5e2e392084cf..a476aad6376a41c20f94a37f90a87e9d7dff5933 100644 (file)
--- a/cconv.c
+++ b/cconv.c
@@ -167,6 +167,7 @@ void convert_thread_options_to_cpu(struct thread_options *o,
        o->fsync_on_close = le32_to_cpu(top->fsync_on_close);
        o->bs_is_seq_rand = le32_to_cpu(top->bs_is_seq_rand);
        o->random_distribution = le32_to_cpu(top->random_distribution);
+       o->exitall_error = le32_to_cpu(top->exitall_error);
        o->zipf_theta.u.f = fio_uint64_to_double(le64_to_cpu(top->zipf_theta.u.i));
        o->pareto_h.u.f = fio_uint64_to_double(le64_to_cpu(top->pareto_h.u.i));
        o->gauss_dev.u.f = fio_uint64_to_double(le64_to_cpu(top->gauss_dev.u.i));
@@ -353,6 +354,7 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
        top->fsync_on_close = cpu_to_le32(o->fsync_on_close);
        top->bs_is_seq_rand = cpu_to_le32(o->bs_is_seq_rand);
        top->random_distribution = cpu_to_le32(o->random_distribution);
+       top->exitall_error = cpu_to_le32(o->exitall_error);
        top->zipf_theta.u.i = __cpu_to_le64(fio_double_to_uint64(o->zipf_theta.u.f));
        top->pareto_h.u.i = __cpu_to_le64(fio_double_to_uint64(o->pareto_h.u.f));
        top->gauss_dev.u.i = __cpu_to_le64(fio_double_to_uint64(o->gauss_dev.u.f));
diff --git a/fio.1 b/fio.1
index eab20d779e35d034e94cf54dfc70e6a1f28eec15..4fe1be27c31cceb3fcf1184fab49c384080b5901 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -1126,6 +1126,10 @@ Should be a multiple of 1MB. Default: 4MB.
 .B exitall
 Terminate all jobs when one finishes.  Default: wait for each job to finish.
 .TP
+.B exitall_on_error \fR=\fPbool
+Terminate all jobs if one job finishes in error.  Default: wait for each job
+to finish.
+.TP
 .BI bwavgtime \fR=\fPint
 Average bandwidth calculations over the given time in milliseconds.  Default:
 500ms.
diff --git a/init.c b/init.c
index 0100da213a2420db2487b24979895b4c68468455..63ba32481b9ba87943d320e0b6daa7f2ae31965b 100644 (file)
--- a/init.c
+++ b/init.c
@@ -47,6 +47,7 @@ static char **job_sections;
 static int nr_job_sections;
 
 int exitall_on_terminate = 0;
+int exitall_on_terminate_error = 0;
 int output_format = FIO_OUTPUT_NORMAL;
 int eta_print = FIO_ETA_AUTO;
 int eta_new_line = 0;
index 627029cd732ccba701079e3ec1d7f6d5c3a35b15..46d5fb92ea982e64aca4671105ed2128a5042278 100644 (file)
--- a/options.c
+++ b/options.c
@@ -3140,6 +3140,15 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
                .category = FIO_OPT_C_GENERAL,
                .group  = FIO_OPT_G_PROCESS,
        },
+       {
+               .name   = "exitall_on_error",
+               .lname  = "Exit-all on terminate in error",
+               .type   = FIO_OPT_BOOL,
+               .off1   = td_var_offset(unlink),
+               .help   = "Terminate all jobs when one exits in error",
+               .category = FIO_OPT_C_GENERAL,
+               .group  = FIO_OPT_G_PROCESS,
+       },
        {
                .name   = "stonewall",
                .lname  = "Wait for previous",
index 02c867f319361f1f7f3574ce0aa92a52ec7bb513..6ae0335698c1de41ed60f8b69394106e004e9190 100644 (file)
@@ -131,6 +131,7 @@ struct thread_options {
        unsigned int verify_only;
 
        unsigned int random_distribution;
+       unsigned int exitall_error;
 
        fio_fp64_t zipf_theta;
        fio_fp64_t pareto_h;
@@ -376,7 +377,7 @@ struct thread_options_pack {
        uint32_t bs_is_seq_rand;
 
        uint32_t random_distribution;
-       uint32_t pad;
+       uint32_t exitall_error;
 
        fio_fp64_t zipf_theta;
        fio_fp64_t pareto_h;