[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Large directories on Minix partitions.



Thierry Bousch writes:
> Hello Michael,
> 
> > There were about 1100 files left at that point, and it took a good
> > couple hours to delete them all.  This is on a TT, with an admittedly
> > rather slow disk (70M MFM running RLL on an Adaptec 4070), but even so,
> > five seconds per file is a bit sluggish.  This also totally spammed
> > the machine, but the progress indicator gave me faith.
> 
> I have also encountered this problem with a minixfs directory containing
> ~500 files. Apparently, thrashing occurs when the directory contents is
> too big to fit in the cache.

 yup!

>  You should increase the cache sizes in
> minixfs (default is 10 Kb) and recompile.

 i think default 10K is the inode cache...  i had the same thrashing
when rebuilding mintlib (dir gets > 20K), since dir blocks go in syscache
i patched _scache_size to 30 and make was as fast as before.

 so just make sure _scache_size is always bigger than the largest
directory you want to access...  here is how i do it, another perlscript :)

#! /usr/bin/perl
# xsetl [-x0xhex] symbol file -- patch executable long const
#
$val = 'L';

while ($_ = $ARGV[0], /^-/) {
	shift;
	last if /^--$/;
	if (/^-x(.*)/) {
		if ($1) {
			$x = $1;
		} else {
			$x = shift;
			next;
		}
	}
}
$sym = shift;
$f = $ARGV[0];
($npid = open (NM, "cnm $f|")) || die "nm failed";
$search = << ;
while (<NM>) {
	if (/^$sym\\s+([0-9a-fA-F]+)\\s/) {
		\$off = hex (\$1) + 0x1c;
		chop;
		print;
		break;
	}
}

eval $search;
close (NM);
die "not found" if (!defined ($off));

foreach (@ARGV) {
	print $_, ":\t" if ($f ne $_);
	open (F, "+< $_") || die "Can't open";
	seek (F, $off, 0) || die "Can't lseek";
	sysread (F, $d, length (pack ($val, 0))) || die "Can't read $sym";
	($valx) = unpack ($val, $d);
	seek (F, $off, 0) || die "Can't lseek back";
	printf "\n\t= 0x%08lx %d", $valx, $valx;

	if (defined ($x)) {
		$x = oct ($x) if $x =~ /^0/;
		$valx = $x;
	}
	$newd = pack ($val, $valx);
	if ($newd ne $d) {
		printf "\t -> 0x%08lx %d", $valx, $valx;
		syswrite (F, $newd, length ($newd)) == length ($newd)
			|| die "\nCan't write back $sym";
	}
	print "\n";
	close F || die "Can't close";
}
-- 
J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
								...ohne Gewehr
PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA