$OSTS = 0; # Number of OSTS we will loop over
$BSIZE = 1024 * 1024; # Size of i/o block
$MNT = "/mnt/lustre"; # Location of Lustre file system
-$CNT = 0;
$FSIZE = 30; # Number of i/o blocks
# Usage
# Also fills 1 for active OST indexes in ACTIVEOST_INX array.
sub ost_count () {
# numobd gives number of ost's and activeobd gives number of active ost's
- my $tempfile = glob ("/proc/fs/lustre/lov/lustre-clilov-*/activeobd");
+ my $tempfile = glob ("/proc/fs/lustre/lov/*-clilov-*/activeobd");
open(PTR, $tempfile) || die "Cannot open $tempfile: $!\n";
$OSTS = <PTR>;
close PTR;
print "Number of Active OST devices : $OSTS";
- my $tempfile = glob ("/proc/fs/lustre/lov/lustre-clilov-*/numobd");
+ my $tempfile = glob ("/proc/fs/lustre/lov/*-clilov-*/numobd");
open(PTR, $tempfile) || die "Cannot open $tempfile: $!\n";
$numost = <PTR>;
close PTR;
printf "Number of non active ots(s): %d\n", ( $numost - $OSTS );
$OSTS = $numost;
}
- my $tempfile = glob ("/proc/fs/lustre/lov/lustre-clilov-*/target_obd");
+ my $tempfile = glob ("/proc/fs/lustre/lov/*-clilov-*/target_obd");
open(PTR, $tempfile) || die "Cannot open $tempfile: $!\n";
my $count = 0;
my $temp;
}
}
+sub cache_off () {
+ $CACHEFILE = glob ("/proc/fs/lustre/llite/*/max_cached_mb");
+ open(PTR, $CACHEFILE) || die "Cannot open $tempfile: $!\n";
+ $CACHESZ = 0 + <PTR>;
+ close PTR;
+ system("echo 0 >> $CACHEFILE");
+}
+
+sub cache_on () {
+ system("echo $CACHESZ >> $CACHEFILE");
+}
+
# make_dummy subroutine creates a dummy file that will be used for read operation.
sub make_dummy () {
my $SIZE = $_[0];
if ( !(-f $tempfile) && $ACTION eq "read" ) {
&make_dummy($SIZE, $tempfile);
}
- my $LoadTimeHiRes = "use Time::HiRes qw(gettimeofday)";
- eval ($LoadTimeHiRes);
system("sync");
my ($ts0, $tu0) = gettimeofday();
$tu0 = $ts0 + ($tu0 / 1000000);
$sd = sqrt($total/$OSTS);
printf "Worst %s OST indx: %d speed: %f\n", $op, $worst_OST, $min_mb;
printf "Best %s OST indx: %d speed: %f\n", $op, $best_OST, $max_mb;
- printf "%s Avrage: %f +/- %f MB/s\n", $op, $avg, $sd;
+ printf "%s Average: %f +/- %f MB/s\n", $op, $avg, $sd;
}
# output_all_data subroutine displays speed and time information
#Check for Time::HiRes module
my $CheckTimeHiRes = "require Time::HiRes";
eval ($CheckTimeHiRes) or die "You need to install the perl-Time-HiRes package to use this script\n";
+my $LoadTimeHiRes = "use Time::HiRes qw(gettimeofday)";
+eval ($LoadTimeHiRes);
use POSIX qw(strftime);
my $time_v = time();
# get OST count
ost_count ();
+# turn off local cache
+cache_off ();
+
+$dirpath = "$MNT/ost_survey_tmp";
+eval { mkpath($dirpath) };
+if ($@) {
+ print "Couldn't create $dirpath: $@";
+ exit 1;
+}
use File::Path;
+$CNT = 0;
while ($CNT < $OSTS) {
- $dirpath = "$MNT/tmpdir$CNT";
- eval { mkpath($dirpath) };
- if ($@) {
- print "Couldn't create $dirpath: $@";
- exit 1;
- }
$filename = "$dirpath/file$CNT";
if ( $ACTIVEOST_INX[$CNT] ) {
# set stripe for OST number $CNT
system ("lfs setstripe $filename 0 $CNT 1");
# Perform write for OST number $CNT
&run_test($FSIZE,$CNT,"write",$filename);
+ $flag++;
+ }
+ $CNT = $CNT + 1;
+}
+$CNT = 0;
+while ($CNT < $OSTS) {
+ $filename = "$dirpath/file$CNT";
+ if ( $ACTIVEOST_INX[$CNT] ) {
# Perform read for OST number $CNT
&run_test($FSIZE,$CNT,"read",$filename);
$flag++;
}
- eval { rmtree($dirpath) };
- if ($@) {
- print "Warning: Couldn't $dirpath: $@";
- }
$CNT = $CNT + 1;
}
+
# if read or write performed on any OST then display information.
if ( $flag ) {
if ( $flag > 1 ) {
} else {
print "There is no active OST's found\n";
}
+
+cache_on ();
+
+eval { rmtree($dirpath) };
+if ($@) {
+ print "Warning: Couldn't remove $dirpath: $@";
+}