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);
}
}
-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];
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);
return i;
}
- return add_file(td, fname, 0);
+ return add_file(td, fname, 0, 1);
}
void get_file(struct fio_file *f)
}
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))