Add backend related data
[fio.git] / backend.c
index e37fffb7b183e36d0b0d6a05f9db73603e700479..c8554bc1a102ec721b9f1d33b7e508680c0c094f 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2117,7 +2117,7 @@ reap:
                                        *fio_debug_jobp = pid;
                        }
                        dprint(FD_MUTEX, "wait on startup_mutex\n");
-                       if (fio_mutex_down_timeout(startup_mutex, 10)) {
+                       if (fio_mutex_down_timeout(startup_mutex, 10000)) {
                                log_err("fio: job startup hung? exiting.\n");
                                fio_terminate_threads(TERMINATE_ALL);
                                fio_abort = 1;
@@ -2220,8 +2220,12 @@ static void free_disk_util(void)
 
 static void *helper_thread_main(void *data)
 {
+       struct backend_data *d = data;
        int ret = 0;
 
+       if (d)
+               pthread_setspecific(d->key, d->ptr);
+
        fio_mutex_up(startup_mutex);
 
        while (!ret) {
@@ -2255,7 +2259,7 @@ static void *helper_thread_main(void *data)
        return NULL;
 }
 
-static int create_helper_thread(void)
+static int create_helper_thread(struct backend_data *data)
 {
        int ret;
 
@@ -2264,7 +2268,7 @@ static int create_helper_thread(void)
        pthread_cond_init(&helper_cond, NULL);
        pthread_mutex_init(&helper_lock, NULL);
 
-       ret = pthread_create(&helper_thread, NULL, helper_thread_main, NULL);
+       ret = pthread_create(&helper_thread, NULL, helper_thread_main, data);
        if (ret) {
                log_err("Can't create helper thread: %s\n", strerror(ret));
                return 1;
@@ -2276,7 +2280,7 @@ static int create_helper_thread(void)
        return 0;
 }
 
-int fio_backend(void)
+int fio_backend(struct backend_data *data)
 {
        struct thread_data *td;
        int i;
@@ -2306,7 +2310,7 @@ int fio_backend(void)
 
        set_genesis_time();
        stat_init();
-       create_helper_thread();
+       create_helper_thread(data);
 
        cgroup_list = smalloc(sizeof(*cgroup_list));
        INIT_FLIST_HEAD(cgroup_list);