From: Jens Axboe Date: Tue, 6 Dec 2005 20:32:39 +0000 (+0100) Subject: [PATCH] fio: misc fixes X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2572cf2ab8d86803882fa52802b091702512777f;p=disktools.git [PATCH] fio: misc fixes - Only use threads for > 1 thread - Don't clear ->iodepth for SYNCIO def_thread - Only use setsid() for forked threads --- diff --git a/fio-ini.c b/fio-ini.c index e1d4523..d35909d 100644 --- a/fio-ini.c +++ b/fio-ini.c @@ -160,13 +160,6 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass, struct stat sb; int numjobs; - if (td->io_engine & FIO_SYNCIO) - td->iodepth = 1; - else { - if (!td->iodepth) - td->iodepth = 1; - } - #ifndef FIO_HAVE_LIBAIO if (td->io_engine == FIO_LIBAIO) { fprintf(stderr, "Linux libaio not available\n"); @@ -189,6 +182,13 @@ static int add_job(struct thread_data *td, const char *jobname, int prioclass, if (td == &def_thread) return 0; + if (td->io_engine & FIO_SYNCIO) + td->iodepth = 1; + else { + if (!td->iodepth) + td->iodepth = 1; + } + td->filetype = FIO_TYPE_FILE; if (!stat(jobname, &sb) && S_ISBLK(sb.st_mode)) td->filetype = FIO_TYPE_BD; diff --git a/fio-io.c b/fio-io.c index e198e64..3792a9b 100644 --- a/fio-io.c +++ b/fio-io.c @@ -4,6 +4,10 @@ * * sync io is implemented on top of aio. * + * This is not really specific to fio, if the get_io_u/put_io_u and + * structures was pulled into this as well it would be a perfectly + * generic io engine that could be used for other projects. + * */ #include #include diff --git a/fio.c b/fio.c index 52ad7a6..cc5a9da 100644 --- a/fio.c +++ b/fio.c @@ -1605,7 +1605,9 @@ static void *thread_main(void *data) struct thread_data *td = data; int ret = 1; - setsid(); + if (!td->use_thread) + setsid(); + td->pid = getpid(); if (init_io_u(td)) @@ -1858,7 +1860,7 @@ static void run_threads(void) unsigned long spent; int i, todo, nr_running, m_rate, t_rate, nr_started; - printf("Starting %d threads\n", thread_number); + printf("Starting %d thread%s\n", thread_number, thread_number > 1 ? "s" : ""); fflush(stdout); signal(SIGINT, sig_handler);