Add version 2 of the iolog format

The old format had some short comings - notably not supporting > 1
file workloads. So add a new format that defines adding/open/close
of files. Fio will still load the older format iologs, but the new
ones wont work on older fio versions.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 6e0dae2..16e19c8 100644
--- a/fio.c
+++ b/fio.c
@@ -921,8 +921,6 @@
 		finish_log(td, td->ts.slat_log, "slat");
 	if (td->ts.clat_log)
 		finish_log(td, td->ts.clat_log, "clat");
-	if (td->o.write_iolog_file)
-		write_iolog_close(td);
 	if (td->o.exec_postrun) {
 		if (system(td->o.exec_postrun) < 0)
 			log_err("fio: postrun %s failed\n", td->o.exec_postrun);
@@ -937,6 +935,13 @@
 	close_files(td);
 	close_ioengine(td);
 	cleanup_io_u(td);
+
+	/*
+	 * do this very late, it will log file closing as well
+	 */
+	if (td->o.write_iolog_file)
+		write_iolog_close(td);
+
 	options_mem_free(td);
 	td_set_runstate(td, TD_EXITED);
 	return (void *) (unsigned long) td->error;