Reserving Space on Disk

Istvan Mohos istvan at hhb.UUCP
Mon Jul 16 01:00:57 AEST 1990



markd at silogic.UUCP (Mark DiVecchio @ Silogic Systems) writes:
>An associate has an application where he wants to reserve 4Mb of disk
>space.  The unix file system does not support this since opening the
>file, seeking to 4Mb and writing one byte does not do the trick. 
>Besides writing out 4Mb of filler, is there any other way to do this?

Because disk I/O optimizations are kernel tasks, there is very little
you can do unless you're willing to rewrite the buffer cache routines,
forcing the system to pop a few free blocks and reassign them to your
inode.  (Consult Chap. 3 of "The Design Of The UNIX Operating System"
by Maurice J. Bach for details.)

Personally, I can't blame a philosophy of having to actually write to
the disk if one wants to take up space on it; in spite that

    if (write (fd, malloc(FOURMEG), FOURMEG) != FOURMEG)
        perror("malloc or write error"), exit (1);

does take a few seconds to execute, "delayed-write" or not.  Maybe
you should just fork off this task and go on to something else.

-- 
        Istvan Mohos
        ...uunet!pyrdc!pyrnj!hhb!istvan
        RACAL-REDAC/HHB 1000 Wyckoff Ave. Mahwah NJ 07430 201-848-8000
======================================================================



More information about the Comp.unix.wizards mailing list