Better check for not doing a file twice

Mark it as done when we close it, so we don't open the same
one again.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/io_u.c b/io_u.c
index f71856f..5f51a00 100644
--- a/io_u.c
+++ b/io_u.c
@@ -422,6 +422,8 @@
 
 		fno = (unsigned int) ((double) td->o.nr_files * (r / (RAND_MAX + 1.0)));
 		f = &td->files[fno];
+		if (f->flags & FIO_FILE_DONE)
+			continue;
 
 		if ((!goodf || (f->flags & goodf)) && !(f->flags & badf))
 			return f;
@@ -444,6 +446,9 @@
 		if (td->next_file >= td->o.nr_files)
 			td->next_file = 0;
 
+		if (f->flags & FIO_FILE_DONE)
+			continue;
+
 		if ((!goodf || (f->flags & goodf)) && !(f->flags & badf))
 			break;
 
@@ -554,6 +559,7 @@
 		 */
 		io_u->file = NULL;
 		td_io_close_file(td, f);
+		f->flags |= FIO_FILE_DONE;
 
 		/*
 		 * probably not the right place to do this, but see