Re: posix_fallocate

Jamie Lokier (lk@tantalophile.demon.co.uk)
Fri, 14 Apr 2000 10:59:23 +0200


Ulrich Drepper wrote:
> 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.

You could try using sendfile from /dev/zero -- that gives the kernel or
fs a chance to optimise that path in future.

-- Jamie

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