On 23.08.19 18:30, Nir Soffer wrote:
> On Fri, Aug 23, 2019 at 4:58 PM Max Reitz <mre...@redhat.com
> <mailto:mre...@redhat.com>> 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