Add -N to skip cleanup of temp and results files

Signed-off-by: Chris Mason <clm@fb.com>
diff --git a/simoop.c b/simoop.c
index 6c25bb8..9536dc8 100644
--- a/simoop.c
+++ b/simoop.c
@@ -105,6 +105,9 @@
 /* should we use fallocate instead of writing initial file contents */
 static int zallocate = 0;
 
+/* should we delete the .tmp and .results files? */
+static int nocleanup = 0;
+
 static uint64_t global_rand_seed = 0x89ABCEF;
 
 /*
@@ -422,7 +425,7 @@
 	return ret;
 }
 
-char *option_string = "t:s:C:c:r:n:f:FR:T:m:W:M:w:i:D:oaOVz";
+char *option_string = "t:s:C:c:r:n:f:FR:T:m:W:M:w:i:D:oaOVzN";
 static struct option long_options[] = {
 	{"appendmode", required_argument, 0, 'a'},
 	{"mmapsize", required_argument, 0, 'M'},
@@ -445,6 +448,7 @@
 	{"odirect", no_argument, 0, 'O'},
 	{"verifystartup", no_argument, 0, 'V'},
 	{"zallocate", no_argument, 0, 'z'},
+	{"nocleanup", no_argument, 0, 'N'},
 	{"help", no_argument, 0, HELP_LONG_OPT},
 	{0, 0, 0, 0}
 };
@@ -473,6 +477,7 @@
 		"\t-o (--oddsizes): randomize sizes to unaligned values\n"
 		"\t-O (--odirect): use O_DIRECT sometimes\n"
 		"\t-z (--zallocate): use fallocate for initial file creation\n"
+		"\t-N (--nocleanup): don't cleanup temp files from the last run\n"
 		"\t dir1 [dir2 ... dirN]\n"
 		"\nall sizes are in bytes k,m,g,t modifiers can be used\n"
 	       );
@@ -906,6 +911,9 @@
 	char name[NAME_LEN];
 	int ret;
 
+	if (nocleanup)
+		return;
+
 	join_path(name, path, seq, RESULT_FILE);
 	if (check_initial_files)
 		read_whole_file(path, seq, RESULT_FILE, buf, buf_size);