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/HOWTO b/HOWTO
index 5df2607..24beeb8 100644
--- a/HOWTO
+++ b/HOWTO
@@ -205,7 +205,7 @@
 		files between threads in a job or several jobs, specify
 		a filename for each of them to override the default. If
 		the ioengine used is 'net', the filename is the host and
-		port to connect to in the format of =host:port. If the
+		port to connect to in the format of =host/port. If the
 		ioengine is file based, you can specify a number of files
 		by seperating the names with a ':' colon. So if you wanted
 		a job to open /dev/sda and /dev/sdb as the two working files,
@@ -306,7 +306,7 @@
 
 			net	Transfer over the network to given host:port.
 				'filename' must be set appropriately to
-				filename=host:port regardless of send
+				filename=host/port regardless of send
 				or receive, if the latter only the port
 				argument is used.
 
diff --git a/engines/net.c b/engines/net.c
index c2f45e5..cd1fda9 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -239,9 +239,9 @@
 
 	strcpy(buf, td->filename);
 
-	sep = strchr(buf, ':');
+	sep = strchr(buf, '/');
 	if (!sep) {
-		log_err("fio: bad network host:port <<%s>>\n", td->filename);
+		log_err("fio: bad network host/port <<%s>>\n", td->filename);
 		return 1;
 	}
 
diff --git a/examples/netio b/examples/netio
index 00ca4fd..d173a9f 100644
--- a/examples/netio
+++ b/examples/netio
@@ -1,7 +1,7 @@
 # Example network job, just defines two clients that send/recv data
 [global]
 ioengine=net
-filename=localhost:8888
+filename=localhost/8888
 size=4k
 size=10g
 
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);