Subject: Re: Defragmenting a NetBSD drive
To: Todd Whitesel <>
From: Greg A. Woods <>
List: netbsd-ports
Date: 09/18/1999 11:10:04
[ On Friday, September 17, 1999 at 22:24:45 (-0700), Todd Whitesel wrote: ]
> Subject: Re: Defragmenting a NetBSD drive
> How about requiring the garbage collector userland thingy to readdir()
> each directory, and request for each name encountered that it be packed
> forward in the directory? The packing syscall would fail gracefully if
> it would have to move the directory slot across any other readdir()
> pointers. At the end of the directory, another request could be issued
> to truncate off any unused space at the end of the directory.
> This would clean up what it can, without fouling up any other processes
> that might be using the tree.

Yes, but it's nowhere near as simple as having the user-land directory
garbage collector just move all the files in the directory to be cleaned
into a new directory and then renaming that new and clean directory back
to the old name.  The only kernel support that should be necessary is
the ability to do those operations, of course, as well as optionally the
ability to lock a directory during those operations.

Why is this discussion in netbsd-ports, BTW.  I forget how this thread
started, but why hasn't it been moved long ago to netbsd-user or even

							Greg A. Woods

+1 416 218-0098      VE3TCP      <>      <robohack!woods>
Planix, Inc. <>; Secrets of the Weird <>