Re: [RFC] fallocate utility

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

 



Pádraig Brady wrote:
> Eric Sandeen wrote:
>> Attached is a first stab at an fallocate utility, which will preallocate
>> blocks to a file.  This can be useful for virtual images, database
>> files, testing, etc.  Normally we'd hope that various tools will start
>> using preallocation internally, but until then such a utility may be
>> useful, and could be scripted as well.
> 
> FYI here is how we're thinking of adding
> fallocate() and posix_fallocate() to coreutils:
> http://www.pixelbeat.org/patches/coreutils/inbox_may_2009.html

Ah ok, sorry for being behind.  :)

Actually I guess I saw some of that fly by, too, and forgot...

>> I put a fallback in the attached tool so that if fallocate() fails, it
>> goes to posix_fallocate.  On recent (not bleeding) glibc,
>> posix_fallocate tries to call sys_fallocate, and resorts to writing 0s
>> if that fails.  On even older glibc, it goes straight to 0-writing.  The
>> user won't know which one happened, unless they allocate a few gigabytes
>> and notice the delay.
> 
> You'd get most of the functionality by just calling posix_fallocate().
> Calling fallocate() explicitly allows you to support the -n option.
> I.E. this tool you're proposing would be equivalent to `truncate --allocate`
> which we're going to add to coreutils, with the additional functionality
> of the -n option. Is that worth a separate tool? Should we add -n
> functionality to `truncate`?

It's probably not that critical, though some people may wish it were
there.  They can always RFE if they need it I guess.

Having the ability to allocate at a given offset may be nice too.

For usefulness in test scripts, exposing all of fallocate's interfaces
would be nice.

TBH I think "truncate --allocate" sounds a little odd.  (Now that I
think back, I think I mentioned this before).  truncate(1) and
truncate(2) specifically refer to i_size, which to fs people like me,
has nothing to do with the actual blocks allocated to a file.

IOW i_size & i_blocks are independent.  So adding "allocate" to
"truncate" feels a little orthogonal, like "cp --mv" but I (as I think I
said before ;) could live with it.

Thanks,
-Eric



> cheers,
> Pádraig.
> 

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux