[PATCH] First cut syslet async io support
[fio.git] / init.c
diff --git a/init.c b/init.c
index 5d6b0a904f8348af3ccd649054b24132e29de20d..f4125b13c5f05c1064d07d5e12bf72d5295a034e 100644 (file)
--- a/init.c
+++ b/init.c
@@ -41,6 +41,12 @@ static int str_cpumask_cb(void *, unsigned int *);
  * Map of job/command line options
  */
 static struct fio_option options[] = {
+       {
+               .name   = "description",
+               .type   = FIO_OPT_STR_STORE,
+               .off1   = td_var_offset(description),
+               .help   = "Text job description",
+       },
        {
                .name   = "name",
                .type   = FIO_OPT_STR_STORE,
@@ -75,7 +81,7 @@ static struct fio_option options[] = {
                .help   = "IO engine to use",
                .def    = "sync",
                .posval = { "sync", "libaio", "posixaio", "mmap", "splice",
-                               "sg", "null", },
+                               "sg", "null", "net", "syslet-rw" },
        },
        {
                .name   = "iodepth",
@@ -321,7 +327,7 @@ static struct fio_option options[] = {
                .name   = "thinktime",
                .type   = FIO_OPT_INT,
                .off1   = td_var_offset(thinktime),
-               .help   = "Idle time between IO buffers",
+               .help   = "Idle time between IO buffers (usec)",
                .def    = "0",
        },
        {
@@ -417,7 +423,7 @@ static struct fio_option options[] = {
                .type   = FIO_OPT_BOOL,
                .off1   = td_var_offset(unlink),
                .help   = "Unlink created files after job has completed",
-               .def    = "1",
+               .def    = "0",
        },
        {
                .name   = "exitall",
@@ -532,7 +538,7 @@ FILE *f_out = NULL;
 FILE *f_err = NULL;
 
 static int write_lat_log = 0;
-static int write_bw_log = 0;
+int write_bw_log = 0;
 
 /*
  * Return a free job structure.
@@ -558,6 +564,9 @@ static void put_job(struct thread_data *td)
        if (td == &def_thread)
                return;
 
+       if (td->error)
+               fprintf(f_out, "fio: %s\n", td->verror);
+
        memset(&threads[td->thread_number - 1], 0, sizeof(*td));
        thread_number--;
 }
@@ -688,8 +697,18 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                char tmp[PATH_MAX];
                int len = 0;
 
-               if (td->directory && td->directory[0] != '\0')
+               if (td->directory && td->directory[0] != '\0') {
+                       if (lstat(td->directory, &sb) < 0) {
+                               log_err("fio: %s is not a directory\n", td->directory);
+                               td_verror(td, errno);
+                               return 1;
+                       }
+                       if (!S_ISDIR(sb.st_mode)) {
+                               log_err("fio: %s is not a directory\n", td->directory);
+                               return 1;
+                       }
                        len = sprintf(tmp, "%s/", td->directory);
+               }
 
                td->files = malloc(sizeof(struct fio_file) * td->nr_files);
 
@@ -756,7 +775,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                                c3 = to_kmg(td->min_bs[DDIR_WRITE]);
                                c4 = to_kmg(td->max_bs[DDIR_WRITE]);
 
-                               fprintf(f_out, "%s: (g=%d): rw=%s, odir=%u, bs=%s-%s/%s-%s, rate=%u, ioengine=%s, iodepth=%u\n", td->name, td->groupid, ddir_str[ddir], td->odirect, c1, c2, c3, c4, td->rate, td->io_ops->name, td->iodepth);
+                               fprintf(f_out, "%s: (g=%d): rw=%s, bs=%s-%s/%s-%s, ioengine=%s, iodepth=%u\n", td->name, td->groupid, ddir_str[ddir], c1, c2, c3, c4, td->io_ops->name, td->iodepth);
 
                                free(c1);
                                free(c2);
@@ -830,7 +849,7 @@ int init_random_state(struct thread_data *td)
 
        if (!td->norandommap) {
                for_each_file(td, f, i) {
-                       blocks = (f->file_size + td->rw_min_bs - 1) / td->rw_min_bs;
+                       blocks = (f->real_file_size + td->rw_min_bs - 1) / td->rw_min_bs;
                        num_maps = (blocks + BLOCKS_PER_MAP-1)/ BLOCKS_PER_MAP;
                        f->file_map = malloc(num_maps * sizeof(long));
                        f->num_maps = num_maps;