Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
b=19702
[fs/lustre-release.git]
/
lustre
/
tests
/
rename.pl
diff --git
a/lustre/tests/rename.pl
b/lustre/tests/rename.pl
index
4ea020f
..
dd6b5dc
100644
(file)
--- a/
lustre/tests/rename.pl
+++ b/
lustre/tests/rename.pl
@@
-12,11
+12,14
@@
use POSIX ":sys_wait_h";
use vars qw(
$MAX_THREADS
use vars qw(
$MAX_THREADS
+ $SCRIPT_NAME
);
# Don't try to run more than this many threads concurrently.
$MAX_THREADS = 16;
);
# Don't try to run more than this many threads concurrently.
$MAX_THREADS = 16;
+$SCRIPT_NAME = "rename.pl";
+
# Initialize variables
my $silent = 0;
my $create_files = 1; # should we create files or not?
# Initialize variables
my $silent = 0;
my $create_files = 1; # should we create files or not?
@@
-90,7
+93,7
@@
for (my $i=1; $i<=$num_threads; $i++) {
# Wait for all our threads to finish.
my $child = 0;
do {
# Wait for all our threads to finish.
my $child = 0;
do {
- $child = waitpid(-1,
WNOHANG
);
+ $child = waitpid(-1,
0
);
} until $child > 0;
sleep 1;
} until $child > 0;
sleep 1;
@@
-104,7
+107,7
@@
if ($create_files) {
unlink("$filepath") if (-e $filepath);
}
my $rc = rmdir $path;
unlink("$filepath") if (-e $filepath);
}
my $rc = rmdir $path;
- print "
rmdir $path failed: $!\n" if !$rc;
+ print "
$SCRIPT_NAME - rmdir $path failed: $!\n" if !$rc;
}
}
}
}
}
}
@@
-137,6
+140,11
@@
sub usage () {
sub create_file ($) {
my ($path) = @_;;
sub create_file ($) {
my ($path) = @_;;
+ if (-e $path) {
+ warn "$path already exists!\n";
+ return 1;
+ }
+
if ($use_mcreate) {
my $tmp = `./mcreate $path`;
if ($tmp =~ /.*error: (.*)\n/) {
if ($use_mcreate) {
my $tmp = `./mcreate $path`;
if ($tmp =~ /.*error: (.*)\n/) {
@@
-174,18
+182,18
@@
sub fork_and_rename ($) {
my $path_f1 = "${mountpt}${which}/${thread_num}.${d}/${f1}";
my $path_f2 = "${mountpt}${which}/${thread_num}.${d}/${f2}";
my $path_f1 = "${mountpt}${which}/${thread_num}.${d}/${f1}";
my $path_f2 = "${mountpt}${which}/${thread_num}.${d}/${f2}";
- print "Thread $thread_num: [$$] $path_f1 $path_f2 ...\n" if !$silent;
+ print "
$SCRIPT_NAME -
Thread $thread_num: [$$] $path_f1 $path_f2 ...\n" if !$silent;
my $rc = rename $path_f1, $path_f2;
my $rc = rename $path_f1, $path_f2;
- print "Thread $thread_num: [$$] done: $rc\n" if !$silent;
+ print "
$SCRIPT_NAME -
Thread $thread_num: [$$] done: $rc\n" if !$silent;
}
if (($current_iteration) % 100 == 0) {
}
if (($current_iteration) % 100 == 0) {
- print
STDERR "
Thread $thread_num: " . $current_iteration . " operations [" . $$ . "]\n";
+ print
"$SCRIPT_NAME -
Thread $thread_num: " . $current_iteration . " operations [" . $$ . "]\n";
}
$current_iteration++;
}
}
$current_iteration++;
}
- print "Thread $thread_num: Done.\n";
+ print "
$SCRIPT_NAME -
Thread $thread_num: Done.\n";
exit 0;
exit 0;