7 print "Usage: $0 <mount point prefix> <iterations>\n";
8 print "example: $0 --count=2 /mnt/lustre 50\n";
9 print " will test in /mnt/lustre1 and /mnt/lustre2\n";
10 print " $0 --count=0 /mnt/lustre 50\n";
11 print " will test in /mnt/lustre only\n";
14 my ($j, $k, $d, $f1, $f2, $path, $silent);
18 GetOptions("silent!"=> \$silent,
20 "create=i" => \$create);
22 my $mtpt = shift || usage();
23 my $i = shift || usage();
27 my $mcreate = 0; # should we use mcreate or open?
31 $which = int(rand() * $count) + 1;
39 $path = "$mtpt$which/$k";
40 my $rc = mkdir $path, 0755;
41 print "mkdir $path failed: $!\n" if !$rc;
51 $which = int(rand() * $count) + 1;
53 $d = int(rand() * $dirs);
54 $f1 = int(rand() * $files);
55 $f2 = int(rand() * $files);
56 print "[$$] $mtpt$which/$d/$f1 $mtpt$which/$d/$f2 ...\n" if !$silent;
57 my $rc = rename "$mtpt$which/$d/$f1", "$mtpt$which/$d/$f2";
58 print "[$$] done: $rc\n" if !$silent;
59 if (($total - $i) % 100 == 0) {
60 print STDERR "[" . $$ . "]" . ($total - $i) . " operations\n";
69 $path = "$mtpt$which/$k";
75 print "rmdir $path failed: $!\n" if !$rc;