public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland <devzero@web.de>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>, linux-btrfs@vger.kernel.org
Subject: Re: apply different compress/compress-force settings on different subvolumes ?
Date: Wed, 21 Feb 2024 14:15:40 +0100	[thread overview]
Message-ID: <2790f277-fc10-43fc-b7d3-9a3cef1eced2@web.de> (raw)
In-Reply-To: <1597160e-0b54-403b-8e9d-9435425f14f3@gmx.com>

Am 21.02.24 um 10:33 schrieb Qu Wenruo:

> 在 2024/2/21 19:19, Roland 写道:
>> hello,
>>
>> what can be the reason , that multiple compress mount option do not work
>> on subvolume level , i.e. it's always the first that wins ?
> In that case, you may want to use "btrfs prop" subcommand to setup
> compression for each subvolume.
>
> The mount option one is really affecting the whole filesystem.
>>
>> and why is compress-force silently ignored? (see below)
> Compress-force has no coresponding per-inode prop option though.
>
> But I don't think compress-force would cause much difference against
> regular compress.

apparently, force-compress can make a big difference (and compress only
can lead to no compression at all):

https://bugzilla.proxmox.com/show_bug.cgi?id=5250#c6


>> regarding compress mount option, it seems that this can be overriden via
>> subvolume property, which can work around the problem and have multiple
>> compression settings.
>>
>> but how to fix compress-force in the same way, i.e. how can we have
>> differenty compress-force settings with one btrfs fs ?
>>
>> wouldn't it make sense to introduce compress-force property for this ?
>>
>> what about replacing compress with compress-force (i.e. make it the
>> default), as there is not much overhead with modern/fast cpu ?
>>
>> i think compress-force / compress is VERY confusing from and end user
>> perspective - and even worse, i have set "compress" on a subvolume used
>> for virtual machines and they do not get compressed at all (not a single
>> bit) . so i think, compress option is pretty short-sighted and not, what
>> an average user would expect (
>> https://marc.info/?l=linux-btrfs&m=154523409314147&w=2 )
>
> IIRC compress prop needs to be set to all inodes.
> If you set it on a directory, only new inodes would inherit the prop,
> the existing ones won't get the new prop.


that's clear, and no different from zfs.

the big advantage of btrfs is, that we have btrfs filesystem defragment
to recompress everything
in place, whereas in zfs we need to move it forth and back to a
different dataset.

regards
Roland

>
> Thanks,
> Qu
>>
>> i'd be happy on some feedback. not subscribed to this list, so please
>> CC.
>>
>> roland
>>
>>
>> zstd compression applied to all subvolumes, though specified otherwise:
>>
>> cat /etc/fstab|grep btrfs
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/zstd btrfs
>> subvol=zstd,compress=zstd,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/lzo  btrfs
>> subvol=lzo,compress=lzo,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/none btrfs
>> subvol=none,compress=none,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/zstd-force btrfs
>> subvol=zstd-force,compress-force=zstd,defaults 0 1
>>
>> mount|grep btrfs
>> /dev/sdb1 on /btrfs/zstd type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/zstd)
>>
>> /dev/sdb1 on /btrfs/lzo type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/lzo)
>>
>> /dev/sdb1 on /btrfs/none type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/none)
>>
>> /dev/sdb1 on /btrfs/zstd-force type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/zstd-force)
>>
>>
>>
>> different order in fstab has different result - first wins:
>>
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/lzo  btrfs
>> subvol=lzo,compress=lzo,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/zstd btrfs
>> subvol=zstd,compress=zstd,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/none btrfs
>> subvol=none,compress=none,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/zstd-force btrfs
>> subvol=zstd-force,compress-force=zstd,defaults 0 1
>>
>> /dev/sdb1 on /btrfs/lzo type btrfs
>> (rw,relatime,compress=lzo,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/lzo)
>>
>> /dev/sdb1 on /btrfs/zstd type btrfs
>> (rw,relatime,compress=lzo,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/zstd)
>>
>> /dev/sdb1 on /btrfs/none type btrfs
>> (rw,relatime,compress=lzo,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/none)
>>
>> /dev/sdb1 on /btrfs/zstd-force type btrfs
>> (rw,relatime,compress=lzo,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/zstd-force)
>>
>>
>>
>> compress-force silently ignored:
>>
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/zstd btrfs
>> subvol=zstd,compress=zstd,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/lzo  btrfs
>> subvol=lzo,compress=lzo,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/none btrfs
>> subvol=none,compress=none,defaults 0 1
>> UUID=da0fadf1-5db4-4f5b-a77e-2f0730f4e872 /btrfs/zstd-force btrfs
>> subvol=zstd-force,compress-force=zstd,defaults 0 1
>>
>> /dev/sdb1 on /btrfs/zstd type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/zstd)
>>
>> /dev/sdb1 on /btrfs/lzo type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/lzo)
>>
>> /dev/sdb1 on /btrfs/none type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/none)
>>
>> /dev/sdb1 on /btrfs/zstd-force type btrfs
>> (rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/zstd-force)
>>
>>
>>
>>
>> this is the write speed i get with compress-force=zstd on i7-7700
>>
>> # dd if=/dev/zero of=test.dat bs=1024k count=10240 ;time sync
>> 10240+0 records in
>> 10240+0 records out
>> 10737418240 bytes (11 GB, 10 GiB) copied, 3.76111 s, 2.9 GB/s
>>
>> real    0m0.224s
>> user    0m0.000s
>> sys    0m0.081s
>>
>>
>>

  reply	other threads:[~2024-02-21 13:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  8:49 apply different compress/compress-force settings on different subvolumes ? Roland
2024-02-21  9:33 ` Qu Wenruo
2024-02-21 13:15   ` Roland [this message]
2024-02-21 17:45     ` Austin S. Hemmelgarn
2024-02-22  3:25     ` Qu Wenruo
2024-02-23  1:06       ` Chris Murphy
2024-02-22  8:33     ` Roland

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=2790f277-fc10-43fc-b7d3-9a3cef1eced2@web.de \
    --to=devzero@web.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /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