ino_t top_ino;
int verbose = 0;
sig_atomic_t should_stop = 0;
+char *execute_cmd = NULL;
+int execute_freq = 1;
void add_to_flist(int, int, int);
void append_pathname(pathname_t *, char *);
int nousage = 0;
xfs_error_injection_t err_inj;
struct sigaction action;
+ const char *allopts = "d:e:f:i:m:M:n:o:p:rs:S:vwx:X:zH";
errrange = errtag = 0;
umask(0);
nops = sizeof(ops) / sizeof(ops[0]);
ops_end = &ops[nops];
myprog = argv[0];
- while ((c = getopt(argc, argv, "d:e:f:i:m:M:n:o:p:rs:S:vwzH")) != -1) {
+ while ((c = getopt(argc, argv, allopts)) != -1) {
switch (c) {
case 'd':
dirname = optarg;
case 'w':
write_freq();
break;
+ case 'x':
+ execute_cmd = optarg;
+ break;
case 'z':
zero_freq();
break;
printf("\n");
nousage=1;
break;
+ case 'X':
+ execute_freq = strtoul(optarg, NULL, 0);
+ break;
case '?':
fprintf(stderr, "%s - invalid parameters\n",
myprog);
int opno;
int rval;
opdesc_t *p;
+ int dividend;
+ dividend = (operations + execute_freq) / (execute_freq + 1);
sprintf(buf, "p%x", procid);
(void)mkdir(buf, 0777);
if (chdir(buf) < 0 || stat64(".", &statbuf) < 0) {
if (namerand)
namerand = random();
for (opno = 0; opno < operations; opno++) {
+ if (execute_cmd && opno && opno % dividend == 0) {
+ if (verbose)
+ printf("%d: execute command %s\n", opno,
+ execute_cmd);
+ rval = system(execute_cmd);
+ if (rval)
+ fprintf(stderr, "execute command failed with "
+ "%d\n", rval);
+ }
p = &ops[freq_table[random() % freq_table_size]];
p->func(opno, random());
/*
printf("Usage: %s -H or\n", myprog);
printf(" %s [-d dir][-e errtg][-f op_name=freq][-n nops]\n",
myprog);
- printf(" [-p nproc][-r len][-s seed][-v][-w][-z][-S]\n");
+ printf(" [-p nproc][-r len][-s seed][-v][-w][-x cmd][-z][-S][-X ncmd]\n");
printf("where\n");
printf(" -d dir specifies the base directory for operations\n");
printf(" -e errtg specifies error injection stuff\n");
printf(" -s seed specifies the seed for the random generator (default random)\n");
printf(" -v specifies verbose mode\n");
printf(" -w zeros frequencies of non-write operations\n");
+ printf(" -x cmd execute command in the middle of operations\n");
printf(" -z zeros frequencies of all operations\n");
printf(" -S [c,t] prints the list of operations (omitting zero frequency) in command line or table style\n");
+ printf(" -X ncmd number of calls to the -x command (default 1)\n");
printf(" -H prints usage and exits\n");
}