qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH] block: posix: Always allocate the first block


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH] block: posix: Always allocate the first block
Date: Fri, 23 Aug 2019 19:41:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 23.08.19 18:30, Nir Soffer wrote:
> On Fri, Aug 23, 2019 at 4:58 PM Max Reitz <address@hidden
> <mailto:address@hidden>> wrote:
> 

[...]

>     Exactly.  But if posix_fallocate() works, it should have allocated the
>     first block.
> 
> 
> Only if the file system does not support fallocate(). posix_fallocate()
> first try
> fallocate(), and fall back to manual preallocation:
> https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/posix_fallocate.c.html#27

I still don’t understand.  Your example does show that the first block
is not allocated by fallocate(), but I still don’t understand the
connection to not having fallocate() support.

If it doesn’t have fallocate() support and posix_fallocate() does fall
back, the result should be that posix_fallocate() manually allocates
data, which should be completely sufficient.

So in fact, it seems to me that the opposite is true: It seems that when
allocating blocks on XFS with fallocate(), that simply won’t be enough
to cause alignment errors.  So it doesn’t seem to be about fallback
code, but precisely the normal XFS code that fully supports fallocate.

(Just running your example on a local file on XFS shows the same result.)

So that seems to me why the additional allocation is necessary.  I think
that should be noted in a comment – if I’m right (I may well not be).

Max

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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