Re: posix_fallocate

From: Matti Aarnio (matti.aarnio@sonera.fi)
Date: Fri Apr 14 2000 - 04:14:27 EST


On Fri, Apr 14, 2000 at 12:23:06AM -0700, Ulrich Drepper wrote:
> One of the recent POSIX standards defines a function with the prototype
> int posix_fallocate (int fd, off_t offset, size_t len)
>
> The purpose of the function is to allocate enough storage so that
> future writes to the file in the range [offset,offset+len] cannot fail
> because the storage device has no room.
>
> I'm currently emulating this function in a ugly way in glibc: I write
> to every single block on the file. But this is by far not the best
> way. This function belongs into the kernel.

        Ack. Without adding any new syscalls, I think this, and
        fadvice should be implemented as FCNTL things.

        fallocate() will need support at per inode (inode_operations),
        fadvice() propably per file (file_operations).

        The mechanisms shall use 64-bit file sizes and offsets, naturally.

> The background for this function is that, for databases or multimedia
> files etc, you can preallocate the amount of storage you need and then
> don't have to fear running out of memory and as a sideeffect also
> probably have a faster running application since the kernel does not
> have to hunt for empty blocks while writing.
>
> Maybe somebody can take a shot at it. I can provide more information.
>
> --
> ---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
> Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
> Red Hat `--' drepper at redhat.com `------------------------

/Matti Aarnio <matti.aarnio@sonera.fi>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:24 EST