Fixup ->open_files if not given
authorJens Axboe <axboe@fb.com>
Tue, 25 Feb 2014 22:01:26 +0000 (14:01 -0800)
committerJens Axboe <axboe@fb.com>
Tue, 25 Feb 2014 22:01:26 +0000 (14:01 -0800)
For engines/users that add files with add_file() after the
job has been initialized, ensure that we bump the allowed
number of open files if it wasn't explicitly given as
an option.

This unbreaks the net engine after commit 002fe73409d1e made
fio more strict wrt open files.

Signed-off-by: Jens Axboe <axboe@fb.com>
filesetup.c

index f0e3b34fd8ae1e90424c04a37ec1cba4b71e4a38..7669d704663d52bf2d1d8ffeefeb5a45fd155861 100644 (file)
@@ -1230,6 +1230,13 @@ int add_file(struct thread_data *td, const char *fname, int numjob)
 
        set_already_allocated(file_name);
 
 
        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;
+
        dprint(FD_FILE, "file %p \"%s\" added at %d\n", f, f->file_name,
                                                        cur_files);
 
        dprint(FD_FILE, "file %p \"%s\" added at %d\n", f, f->file_name,
                                                        cur_files);