Whamcloud - gitweb
b=14901
[fs/lustre-release.git] / lustre / tests / multiop.c
index 389e26f..3bd2128 100755 (executable)
@@ -14,6 +14,7 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <lustre/liblustreapi.h>
 
 #define T1 "write data before unlink\n"
 #define T2 "write data after unlink\n"
@@ -26,6 +27,7 @@ char usage[] =
 "Usage: %s filename command-sequence\n"
 "    command-sequence items:\n"
 "        c  close\n"
+"        C[num] create with optional stripes\n"
 "        d  mkdir\n"
 "        D  open(O_DIRECTORY)\n"
 "        L  link\n"
@@ -143,6 +145,7 @@ int main(int argc, char **argv)
         int rc, len, fd = -1;
         int flags;
         int save_errno;
+        int verbose = 0;
 
         if (argc < 3) {
                 fprintf(stderr, usage, argv[0]);
@@ -156,8 +159,13 @@ int main(int argc, char **argv)
         for (commands = argv[2]; *commands; commands++) {
                 switch (*commands) {
                 case '_':
-                        if (usr1_received == 0)
+                        if (usr1_received == 0) {
+                                if (verbose) {
+                                        printf("PAUSING\n");
+                                        fflush(stdout);
+                                }
                                 pause();
+                        }
                         usr1_received = 0;
                         signal(SIGUSR1, usr1_handler);
                         break;
@@ -169,6 +177,16 @@ int main(int argc, char **argv)
                         }
                         fd = -1;
                         break;
+                case 'C':
+                        len = atoi(commands+1);
+                        fd = llapi_file_open(fname, O_CREAT | O_WRONLY, 0644,
+                                             0, 0, len, 0);
+                        if (fd == -1) {
+                                save_errno = errno;
+                                perror("create stripe file");
+                                exit(save_errno);
+                        }
+                        break;
                 case 'd':
                         if (mkdir(fname, 0755) == -1) {
                                 save_errno = errno;
@@ -325,6 +343,9 @@ int main(int argc, char **argv)
                                 exit(save_errno);
                         }
                         break;
+                case 'v':
+                        verbose = 1;
+                        break;
                 case 'w':
                         len = atoi(commands+1);
                         if (len <= 0)