Re: new database files not compressed

A L
2020-09-02T09:57:56Z

---- From: Nikolay Borisov <nborisov@suse.com> -- Sent: 2020-09-02 - 07:57 ----
>>
>> I've been able to reproduce this with a trivial test program which
>> mimics the I/O behaviour of Firebird.
>>
>> It is calling fallocate() to set up a bunch of blocks and then writing
>> them with pwrite(). It seems to be the fallocate() step which is
>> preventing compression.
>>
>> Here is my trivial test program which just writes zeroes to a file. The
>> output file does not get compressed by btrfs.
>
> Ag yes, this makes sense, because fallocate creates PREALLOC extents
> which are NOCOW (since they are essentially empty so it makes no sense
> to CoW them) hence they go through a different path which doesn't
> perform compression.
>

Hi,

This is interesting. I think that a lot of applications use fallocate in their normal operations. This is probably why we see weird compsize results every now and then.

A file that is nocow will also not have checksums. Is this true for these fallocated files (that has data written to them) too?

I would really like to see that Btrfs was corrected so that writes to an fallocated area will be compressed (if one is using compression that is).

Thanks.