public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Hamish Moffatt <hamish-btrfs@moffatt.email>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: new database files not compressed
Date: Wed, 2 Sep 2020 09:10:15 +0300	[thread overview]
Message-ID: <fa2933db-3349-421e-2bdb-92ffa28795c3@suse.com> (raw)
In-Reply-To: <99c84e4e-0055-1e6d-7e89-ffa708551708@moffatt.email>



On 2.09.20 г. 9:05 ч., Hamish Moffatt wrote:
> On 2/9/20 3:57 pm, Nikolay Borisov wrote:
>>
>> On 2.09.20 г. 3:32 ч., Hamish Moffatt wrote:
>>>
>>> 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.
> 
>>>      for (int count = 0; count < 256; ++count) {
>>>          if (count % 8 == 0)
>>>              fallocate(fd, 0, count * BLOCK_SIZE, 8 * BLOCK_SIZE);
>>>          pwrite(fd, buf, BLOCK_SIZE, count * BLOCK_SIZE);
>>>      }
> 
> 
> OK, and they can't be compressed when data is written to those extents
> afterwards?

Yes, compression entails creating NEW extents. But with falloc extents
are created during the fallloc operation so when you issue subsequent
writes into the prealloc range you simply write the data to disk and not
bother with metadata management.

> 
> 
> Thanks, it's good to understand why it's not working for Firebird.
> 
> 
> Hamish
> 

  reply	other threads:[~2020-09-02  6:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30  9:35 new database files not compressed Hamish Moffatt
2020-08-31  2:20 ` Eric Wong
2020-08-31  2:44   ` Hamish Moffatt
2020-08-31  3:15   ` A L
2020-08-31  3:47 ` Zygo Blaxell
2020-08-31  8:53   ` Hamish Moffatt
2020-08-31  9:25     ` Nikolay Borisov
2020-08-31 10:40       ` Hamish Moffatt
2020-08-31 10:47         ` Nikolay Borisov
2020-08-31 12:56           ` Hamish Moffatt
2020-08-31 11:15     ` Roman Mamedov
2020-08-31 12:54       ` Hamish Moffatt
2020-08-31 12:57         ` Nikolay Borisov
2020-08-31 23:50           ` Hamish Moffatt
2020-09-01  5:15             ` Nikolay Borisov
2020-09-01  8:55               ` Hamish Moffatt
2020-09-02  0:32                 ` Hamish Moffatt
2020-09-02  5:57                   ` Nikolay Borisov
2020-09-02  6:05                     ` Hamish Moffatt
2020-09-02  6:10                       ` Nikolay Borisov [this message]
2020-09-02  9:57                     ` A L
2020-09-02 10:09                       ` Nikolay Borisov
2020-09-03 15:04                         ` A L
2020-09-02 16:16                       ` Zygo Blaxell
2020-09-03 12:53                         ` Hamish Moffatt
2020-09-03 19:44                           ` Zygo Blaxell
2020-09-04  8:07                             ` Hamish Moffatt
2020-09-05  4:07                               ` Zygo Blaxell
2020-09-03 15:03                         ` A L
2020-09-03 21:52                           ` Zygo Blaxell
2020-09-01  1:43 ` Chris Murphy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa2933db-3349-421e-2bdb-92ffa28795c3@suse.com \
    --to=nborisov@suse.com \
    --cc=hamish-btrfs@moffatt.email \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox