filesetup: change random file init to be bool based
[fio.git] / backend.c
index 029d0054d01ded07fab0aa5fecfac3436eb33973..d3e9bf8160615b64ae714b47f4524403df272f44 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -18,7 +18,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
 #include <unistd.h>
@@ -1692,16 +1692,14 @@ static void *thread_main(void *data)
        if (td_io_init(td))
                goto err;
 
-       if (init_random_map(td))
+       if (!init_random_map(td))
                goto err;
 
        if (o->exec_prerun && exec_string(o, o->exec_prerun, (const char *)"prerun"))
                goto err;
 
-       if (o->pre_read) {
-               if (pre_read_files(td) < 0)
-                       goto err;
-       }
+       if (o->pre_read && !pre_read_files(td))
+               goto err;
 
        fio_verify_init(td);
 
@@ -1833,7 +1831,7 @@ static void *thread_main(void *data)
         * (Are we not missing other flags that can be ignored ?)
         */
        if ((td->o.size || td->o.io_size) && !ddir_rw_sum(bytes_done) &&
-           !did_some_io &&
+           !did_some_io && !td->o.create_only &&
            !(td_ioengine_flagged(td, FIO_NOIO) ||
              td_ioengine_flagged(td, FIO_DISKLESSIO)))
                log_err("%s: No I/O performed by %s, "
@@ -1929,11 +1927,7 @@ static void reap_threads(unsigned int *nr_running, uint64_t *t_rate,
        for_each_td(td, i) {
                int flags = 0;
 
-               /*
-                * ->io_ops is NULL for a thread that has closed its
-                * io engine
-                */
-               if (td->io_ops && !strcmp(td->io_ops->name, "cpuio"))
+                if (!strcmp(td->o.ioengine, "cpuio"))
                        cputhreads++;
                else
                        realthreads++;
@@ -2346,6 +2340,7 @@ reap:
                                fio_terminate_threads(TERMINATE_ALL);
                                fio_abort = 1;
                                nr_started--;
+                               free(fd);
                                break;
                        }
                        dprint(FD_MUTEX, "done waiting on startup_mutex\n");