All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* nodatacow mount option is disregarded when mounting subvolume into same filesystem
@ 2021-01-17 21:05 Damian Höster
  2021-01-18  2:12 ` Chris Murphy
  0 siblings, 1 reply; 2+ messages in thread
From: Damian Höster @ 2021-01-17 21:05 UTC (permalink / raw
  To: linux-btrfs

The nodatacow mount option seems to have no effect when mounting a 
subvolume into the same filesystem.

I did some testing:

sudo mount -o compress=zstd /dev/sda /mnt -> compression enabled
sudo mount -o compress=zstd,nodatacow /dev/sda /mnt -> compression disabled
sudo mount -o nodatacow,compress=zstd /dev/sda /mnt -> compression enabled
All as I would expect, setting compress or nodatacow disables the other.

Compression gets enabled without problems when mounting a subvolume into 
the same filesystem:
sudo mount /dev/sda /mnt; sudo mount -o subvol=@test,compress=zstd 
/dev/sda /mnt/test -> compression enabled
sudo mount /dev/sda /mnt; sudo mount -o subvol=@/testsub,compress=zstd 
/dev/sda /mnt/testsub -> compression enabled

But nodatacow apparently doesn't:
sudo mount -o compress=zstd /dev/sda /mnt; sudo mount -o 
subvol=@test,nodatacow /dev/sda /mnt/test -> compression enabled
sudo mount -o compress=zstd /dev/sda /mnt; sudo mount -o 
subvol=@/testsub,nodatacow /dev/sda /mnt/testsub -> compression enabled

And I don't think it's because of the compress mount option, some 
benchmarks I did indicate that nodatacow never gets set when mounting a 
subvolume into the same filesystem.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: nodatacow mount option is disregarded when mounting subvolume into same filesystem
  2021-01-17 21:05 nodatacow mount option is disregarded when mounting subvolume into same filesystem Damian Höster
@ 2021-01-18  2:12 ` Chris Murphy
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Murphy @ 2021-01-18  2:12 UTC (permalink / raw
  To: Damian Höster; +Cc: Btrfs BTRFS

On Sun, Jan 17, 2021 at 2:07 PM Damian Höster <damian.hoester@posteo.de> wrote:
>
> The nodatacow mount option seems to have no effect when mounting a
> subvolume into the same filesystem.
>
> I did some testing:
>
> sudo mount -o compress=zstd /dev/sda /mnt -> compression enabled
> sudo mount -o compress=zstd,nodatacow /dev/sda /mnt -> compression disabled
> sudo mount -o nodatacow,compress=zstd /dev/sda /mnt -> compression enabled
> All as I would expect, setting compress or nodatacow disables the other.
>
> Compression gets enabled without problems when mounting a subvolume into
> the same filesystem:
> sudo mount /dev/sda /mnt; sudo mount -o subvol=@test,compress=zstd
> /dev/sda /mnt/test -> compression enabled
> sudo mount /dev/sda /mnt; sudo mount -o subvol=@/testsub,compress=zstd
> /dev/sda /mnt/testsub -> compression enabled
>
> But nodatacow apparently doesn't:
> sudo mount -o compress=zstd /dev/sda /mnt; sudo mount -o
> subvol=@test,nodatacow /dev/sda /mnt/test -> compression enabled
> sudo mount -o compress=zstd /dev/sda /mnt; sudo mount -o
> subvol=@/testsub,nodatacow /dev/sda /mnt/testsub -> compression enabled
>
> And I don't think it's because of the compress mount option, some
> benchmarks I did indicate that nodatacow never gets set when mounting a
> subvolume into the same filesystem.
>

Most btrfs mount options are file system wide, they're not per
subvolume options. In case of conflict, the most recent option is
what's used. i.e. the mount options have an order and are followed in
order, with the latest one having precedence in a conflict:

compress,nodatacow   means nodatacow
nodatacow,compress   means compress

nodatacow implies nodatasum and no compress.

If you want per subvolume options then you need to use 'chattr +C' per
subvolume or directory for nodatacow. And for compression you can use
+c (small c) which implies zlib, or use 'btrfs property set
/path/to/sub-dir-file compression zstd'



-- 
Chris Murphy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-18  2:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-17 21:05 nodatacow mount option is disregarded when mounting subvolume into same filesystem Damian Höster
2021-01-18  2:12 ` Chris Murphy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.