sticky bit (really, unfragmenting files)

Colin Plumb w-colinp at microsoft.UUCP
Wed Jan 18 10:23:09 AEST 1989


zeeff at b-tech.ann-arbor.mi.us (Jon Zeeff) wrote:
> Actually, I've never understood why the kernel didn't have some 
> locking support that would allow a daemon to unfragment the disk 
> during idle times.  

Actually, you don't ever need to lock the file.  Basically, you
find the oldest file that hasn't been unfragged (although adding an
unsettable last-mod-time helps here), allocate a new inode, copy it
to contiguous storage, and then make one magic call, that swaps the
two and deletes the old file if it hasn't been changed since the copy
started, and deletes the new copy if it has changed.

I've been (in the past) involved in writing an FS that provides a background-
cleanup daemon, and this is basically how it works.  Every now and then,
you'll waste effort, but if you start with old files, it's very rare.  And
not locking the files increases the transparency of the operation.

For minumum impact, you need a way to prioritise disk I/O, which I don't
think Unix currently has, but can be hacked into an elevator algorithm.
And you can live without.
-- 
	-Colin (uunet!microsof!w-colinp)



More information about the Comp.unix.wizards mailing list