Subject: Multiple-remove?
To: None <tech-kern@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: tech-kern
Date: 07/19/1996 20:52:08
Jukka Marin <jmarin@pyy.jmp.fi> sent this to current-users, and it
reminded me of something I'd been thinking about:

> I'm having problems with inn (its 'fastrm' program complains about
> long command lines).

What was thinking about is fastrm.

The reason unlink() is so slow is that it has to lock the directory,
edit it, synchronously write it, and unlock it...repeated for every
entry being unlinked.  Cacheing helps some, otherwise fastrm wouldn't
be the win it is, but there's lots more that could be done.

What do people think of a syscall that takes a path to a directory, and
a list of names in that directory, and unlinks them all?  The win, of
course, is that it can do only one lock/unlock and one synchronous
write for the whole batch.

Obviously, this would be somewhat ugly to fit into the framework we
have, where unlink passes DELETE to namei (okay, to NDINIT), but it
seems to me it ought to make expire go like a bat out of hell compared
to the current situation.  This could be useful ammunition for those
needing ammunition to support running NetBSD. :-)

Comments?  Is there any way to get comparably good behavior without
ripping namei apart?  (Short of mounting the filesystem -o async, of
course, which would get much of the same benefit, but is significantly
more dangerous.)  How hard would it be?  Based on my fairly limited
acquaintance with namei, it would be fairly easy but would mean
duplication of significant amounts of code; does anyone with better
knowledge of that piece of the kernel have remarks to add?

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu
		    01 EE 31 F6 BB 0C 34 36  00 F3 7C 5A C1 A0 67 1D