[PATCH] Add support for unlinking io files
[fio.git] / init.c
diff --git a/init.c b/init.c
index 967f0b50589d1fe431599fba7f6a6c1e35645012..91a1d507892e80f82dca9647c7be8eb0e266a7b6 100644 (file)
--- a/init.c
+++ b/init.c
@@ -47,6 +47,7 @@
 #define DEF_RWMIX_READ         (50)
 #define DEF_NICE               (0)
 #define DEF_NR_FILES           (1)
+#define DEF_UNLINK             (0)
 
 static int def_timeout = DEF_TIMEOUT;
 
@@ -163,6 +164,9 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                        td->filetype = FIO_TYPE_CHAR;
        }
 
+       if (td->odirect)
+               td->io_ops->flags |= FIO_RAWIO;
+
        if (td->filetype == FIO_TYPE_FILE) {
                char tmp[PATH_MAX];
                int len = 0;
@@ -176,6 +180,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                for_each_file(td, f, i) {
                        memset(f, 0, sizeof(*f));
                        f->fd = -1;
+                       f->fileno = i;
 
                        sprintf(tmp + len, "%s.%d.%d", jobname, td->thread_number, i);
                        f->file_name = strdup(tmp);
@@ -933,6 +938,11 @@ int parse_jobs_ini(char *file, int stonewall_flag)
                                fgetpos(f, &off);
                                continue;
                        }
+                       if (!check_strset(p, "unlink")) {
+                               td->unlink = 1;
+                               fgetpos(f, &off);
+                               continue;
+                       }
                        if (!check_strstore(p, "iolog", tmpbuf)) {
                                if (td->write_iolog) {
                                        log_err("fio: read iolog overrides given write_iolog\n");
@@ -1038,6 +1048,7 @@ static int fill_def_thread(void)
        def_thread.nice = DEF_NICE;
        def_thread.rand_repeatable = DEF_RAND_REPEAT;
        def_thread.nr_files = DEF_NR_FILES;
+       def_thread.unlink = DEF_UNLINK;
 #ifdef FIO_HAVE_DISK_UTIL
        def_thread.do_disk_util = 1;
 #endif