posix_fallocate

From: Ulrich Drepper (drepper@redhat.com)
Date: Fri Apr 14 2000 - 02:23:06 EST


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.

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   `------------------------

- 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:23 EST