@@ -308,7 +308,7 @@ _scratch_xfs_populate() {
# Fill up the root inode chunk
echo "+ fill root ino chunk"
- $here/src/popdir.pl --dir "${SCRATCH_MNT}" --start 1 --end 64 --format "dummy%u" --file-mult 1
+ $here/src/popdir.pl --dir "${SCRATCH_MNT}" --start 1 --end 64 --format "dummy%u" --file-pct 100
# Regular files
# - FMT_EXTENTS
@@ -422,7 +422,7 @@ _scratch_xfs_populate() {
local rec_per_btblock=16
local nr="$(( 2 * (blksz / rec_per_btblock) * ino_per_rec ))"
local dir="${SCRATCH_MNT}/INOBT"
- __populate_create_dir "${dir}" "${nr}" true --file-mult 1
+ __populate_create_dir "${dir}" "${nr}" true --file-pct 100
# Reverse-mapping btree
is_rmapbt="$(_xfs_has_feature "$SCRATCH_MNT" rmapbt -v)"
@@ -11,7 +11,7 @@ use File::Basename;
$progname=$0;
GetOptions("start=i" => \$start,
"end=i" => \$end,
- "file-mult=i" => \$file_mult,
+ "file-pct=i" => \$file_pct,
"incr=i" => \$incr,
"format=s" => \$format,
"dir=s" => \$dir,
@@ -30,8 +30,7 @@ Options:
--start=num create names starting with this number (0)
--incr=num increment file number by this much (1)
--end=num stop at this file number (100)
- --file-mult create a regular file when file number is a multiple
- of this quantity (20)
+ --file-pct create this percentage of regular files (90 percent)
--remove remove instead of creating
--format=str printf formatting string for file name ("%08d")
--verbose verbose output
@@ -47,17 +46,23 @@ if (defined $dir) {
}
$start = 0 if (!defined $start);
$end = 100 if (!defined $end);
-$file_mult = 20 if (!defined $file_mult);
+$file_pct = 90 if (!defined $file_pct);
$format = "%08d" if (!defined $format);
$incr = 1 if (!defined $incr);
+if ($file_pct < 0) {
+ $file_pct = 0;
+} elsif ($file_pct > 100) {
+ $file_pct = 100;
+}
+
for ($i = $start; $i <= $end; $i += $incr) {
$fname = sprintf($format, $i);
if ($remove) {
$verbose && print "rm $fname\n";
unlink($fname) or rmdir($fname) or die("unlink $fname");
- } elsif ($file_mult == 0 or ($i % $file_mult) == 0) {
+ } elsif (($i % 100) < $file_pct) {
# create a file
$verbose && print "touch $fname\n";
open(DONTCARE, ">$fname") or die("touch $fname");