nr_files conflict with filename

If nr_files is larger than the given number of files, it has
to be lowered. Assume that if the user gives a set of filenames
that this is the number he wants, otherwise he should use not
use a filename setting.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/init.c b/init.c
index a3d1d5a..1cb3845 100644
--- a/init.c
+++ b/init.c
@@ -753,8 +753,11 @@
 		td->iodepth_batch = td->iodepth;
 
 	if (!td->nr_files)
-		td->nr_files = td->open_files;
-	else if (td->open_files > td->nr_files || !td->open_files)
+		td->nr_files = td->files_index;
+	else if (td->nr_files > td->files_index)
+		td->nr_files = td->files_index;
+
+	if (td->open_files > td->nr_files || !td->open_files)
 		td->open_files = td->nr_files;
 }
 
@@ -1106,9 +1109,6 @@
 	struct thread_data *td = data;
 	char *fname, *str, *p;
 
-	if (!td->filename)
-		td->nr_files = 0;
-
 	p = str = strdup(input);
 
 	strip_blank_front(&str);
@@ -1118,7 +1118,6 @@
 		if (!strlen(fname))
 			break;
 		add_file(td, fname);
-		td->nr_files++;
 	}
 
 	free(p);