Whamcloud - gitweb
b=18994
[fs/lustre-release.git] / lustre / tests / mdsrate.c
index 930541f..097d4a8 100644 (file)
@@ -60,6 +60,7 @@ enum {
         RANDOM   = 'A',
         READDIR  = 'B',
         RECREATE = 'C',
+        IGNORE   = 'E',
         VERBOSE  = 'V',
         DEBUG    = 'v',
         HELP     = 'h',
@@ -86,6 +87,7 @@ struct option longOpts[] = {
         {"random_order",  0, NULL, RANDOM     },
         {"readdir_order", 0, NULL, READDIR    },
         {"recreate",      0, NULL, RECREATE   },
+        {"ignore",        0, NULL, IGNORE     },
         {"verbose",       0, NULL, VERBOSE    },
         {"debug",         0, NULL, DEBUG      },
         {"help",          0, NULL, HELP       },
@@ -124,6 +126,7 @@ struct sigaction act;
 int    order = RANDOM;
 int    seed;
 int    recreate;
+int    ignore;
 int    verbose;
 int    debug;
 struct stat statbuf;
@@ -150,7 +153,7 @@ struct stat statbuf;
 
 char *usage_msg = "usage: %s\n"
                   "    { --create [ --noexcl ] | --lookup | --mknod |\n"
-                  "      --open | --stat | --unlink  [ --recreate ] }\n"
+                  "      --open | --stat | --unlink  [ --recreate ] [ --ignore ] }\n"
                   "    [ --help ] [ --verbose ] [ --debug ]\n"
                   "    { [ --begin <num> ] --nfiles <num> }\n"
                   "    [ --iters <num> ] [ --time <secs> ]\n"
@@ -403,6 +406,9 @@ process_args(int argc, char *argv[])
                         }
                         order = c;
                         break;
+                case IGNORE:
+                        ++ignore;
+                        break;
                 case DEBUG:
                         ++debug;
                 case VERBOSE:
@@ -567,7 +573,7 @@ main(int argc, char *argv[])
 
         /* if we're not measuring creation rates then precreate
          * the files we're operating on. */
-        if ((mode != CREATE) && (mode != MKNOD)) {
+        if ((mode != CREATE) && (mode != MKNOD) && !ignore) {
                 /* create the files in reverse order. When we encounter
                  * a file that already exists, assume the remainder of 
                  * the files exist to save time. The timed performance
@@ -723,6 +729,8 @@ main(int argc, char *argv[])
                         if (rc) {
                                 if (((rc = errno) == EINTR) && alarm_caught)
                                         break;
+                                if (((rc = errno) == ENOENT) && ignore)
+                                        continue;
                                 fatal(myrank, "unlink(%s) error: %s\n",
                                       filename, strerror(rc));
                         }