Make nr_thread/nr_process private to backend
authorJens Axboe <axboe@kernel.dk>
Thu, 11 Apr 2013 10:04:38 +0000 (12:04 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 11 Apr 2013 10:04:38 +0000 (12:04 +0200)
No need export that knowledge. Merge from gfio.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
fio.h
init.c
libfio.c

index 5f862abeead5ba6fc16c82a4112a33e0f32fc7d5..9438ffd3b7a8161084547ff5584e6c21d34e99a9 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -61,14 +61,14 @@ static struct flist_head *cgroup_list;
 static char *cgroup_mnt;
 static int exit_value;
 static volatile int fio_abort;
+static unsigned int nr_process = 0;
+static unsigned int nr_thread = 0;
 
 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;
 int temp_stall_ts;
 unsigned long done_secs = 0;
@@ -1558,6 +1558,14 @@ static void run_threads(void)
 
        set_sig_handlers();
 
+       nr_thread = nr_process = 0;
+       for_each_td(td, i) {
+               if (td->o.use_thread)
+                       nr_thread++;
+               else
+                       nr_process++;
+       }
+
        if (output_format == FIO_OUTPUT_NORMAL) {
                log_info("Starting ");
                if (nr_thread)
diff --git a/fio.h b/fio.h
index 04a9a9ac113067403c4a3e186657e8690c82e20f..67d13c261f98cd1a55854ba212f26777ce58756d 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -345,7 +345,6 @@ 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;
 extern int output_format;
diff --git a/init.c b/init.c
index 9e2d1131d276637983094c1cbdf5afbb9172225a..7a9284299a6099a69134155f7d9e914de4831b14 100644 (file)
--- a/init.c
+++ b/init.c
@@ -919,11 +919,6 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
        if (ioengine_load(td))
                goto err;
 
-       if (o->use_thread)
-               nr_thread++;
-       else
-               nr_process++;
-
        if (o->odirect)
                td->io_ops->flags |= FIO_RAWIO;
 
index f7f13268ec3c5ad97ed80165acb1c8406dfb4a3c..c26d6a3aaa0964b6bb2b5fecda1fd93355d578d2 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -140,8 +140,6 @@ void reset_fio_state(void)
        groupid = 0;
        thread_number = 0;
        stat_number = 0;
-       nr_process = 0;
-       nr_thread = 0;
        done_secs = 0;
 }