Update cpus_allowed_policy=split documentation
[fio.git] / filesetup.c
index f0e3b34fd8ae1e90424c04a37ec1cba4b71e4a38..2744d4fce0f9597166a3a749445c530594ff33b7 100644 (file)
@@ -1010,7 +1010,7 @@ int init_random_map(struct thread_data *td)
 
                        seed = td->rand_seeds[FIO_RAND_BLOCK_OFF];
                        
-                       if (!lfsr_init(&f->lfsr, blocks, seed, seed & 0xF))
+                       if (!lfsr_init(&f->lfsr, blocks, seed, 0))
                                continue;
                } else if (!td->o.norandommap) {
                        f->io_axmap = axmap_new(blocks);
@@ -1145,7 +1145,7 @@ static void free_already_allocated() {
        }
 }
 
-int add_file(struct thread_data *td, const char *fname, int numjob)
+int add_file(struct thread_data *td, const char *fname, int numjob, int inc)
 {
        int cur_files = td->files_index;
        char file_name[PATH_MAX];
@@ -1230,6 +1230,16 @@ int add_file(struct thread_data *td, const char *fname, int numjob)
 
        set_already_allocated(file_name);
 
+       /*
+        * For adding files after the fact - if openfiles= isn't
+        * given as an option, ensure we allow at least one file open
+        */
+       if (!td->o.open_files)
+               td->o.open_files = 1;
+
+       if (inc)
+               td->o.nr_files++;
+
        dprint(FD_FILE, "file %p \"%s\" added at %d\n", f, f->file_name,
                                                        cur_files);
 
@@ -1246,7 +1256,7 @@ int add_file_exclusive(struct thread_data *td, const char *fname)
                        return i;
        }
 
-       return add_file(td, fname, 0);
+       return add_file(td, fname, 0, 1);
 }
 
 void get_file(struct fio_file *f)
@@ -1355,8 +1365,7 @@ static int recurse_dir(struct thread_data *td, const char *dirname)
                }
 
                if (S_ISREG(sb.st_mode)) {
-                       add_file(td, full_path, 0);
-                       td->o.nr_files++;
+                       add_file(td, full_path, 0, 1);
                        continue;
                }
                if (!S_ISDIR(sb.st_mode))