[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mkfile -- create large files efficiently

From: Pádraig Brady
Subject: Re: mkfile -- create large files efficiently
Date: Fri, 6 Feb 2009 23:37:55 +0000
User-agent: Thunderbird (X11/20071008)

Matej Cepl wrote:
> Hi,
> I wanted to write this utility which exists on other Unices for
> some time, but with introduction of posix_fallocate this actually
> seems make sense now.
> Eagerly waiting for comments and critcism -- this is my first
> serious program in C which I make public, so I expect a lot of
> both ;-).

Thanks Matěj.

Just to be clear, I think the raison d'être of fallocate is not really
for _creating_ large files efficiently, but for _preallocating_
them efficiently, so that subsequent writes will not get ENOSPC.
ftruncate is a more standard and efficient way of merely creating a file.

Rather than creating a new utility, prehaps a --preallocate
option to the existing truncate utility would be better?
Especially considering you added a --sparse option to mkfile
which does much the same thing (although not allowing shrinking?).

BTW, I think the fallocate syscall is a relatively new addition
to linux, and linux filesystems like ext3 don't support it yet.
I would print an error rather than failing back to ftruncate in
those cases.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]