[linux-lvm] Does LVM have any plan/schedule to support btrfs in fsadm

Chris Murphy lists at colorremedies.com
Mon Jun 28 23:00:18 UTC 2021

On Mon, Jun 28, 2021 at 1:33 AM Gionatan Danti <g.danti at assyoma.it> wrote:
> Il 2021-06-28 05:28 Stuart D Gathman ha scritto:
> > Yes.  I like the checksums in metadata feature for enhanced integrity
> > checking.
> Until recently btrfs has issue when a LVM snapshot was mounted. It is
> now solved?

Pretty sure it's fixed since 4.14.

> That said, for rewrite-heavy workload (virtual machines, databases, etc)
> btrfs is very slow (and disabling CoW is not a solution for me, as it
> also disables checksum, compression, etc).

It's not inherently slow, it's a tracking cost problem as very large
numbers of extents accumulate. And it also depends on the write
pattern of the guest file system. If you use Btrfs in a guest on a
host using Btrfs, it's a lot more competitive. There's certainly room
for improvement, possibly with some hinting to avoid writing out a
metric ton of 4KiB blocks as other file systems are prone to doing,
where btrfs can turn these into  largely sequential writes, they lose
any locality optimization the guest file system expects for subsequent
reads. A lot of the locality issue is a factor on rotational devices.
When talking about hundreds of thousands of extents per VM file, this
has a noticeable impact on even SSDs, but the much reduced latency
makes it tolerable for some scenarios.

But I've seen similar problems with VM's on LVM thinp when making many
snapshots and incurring cow, however temporary (like a btrfs nodatacow
file that's subject to snapshots or reflink copies; or a backing file
on xfs likewise reflink copied). There really isn't much better we can
do than LVM thick in this regard. And if that's the standard bearer,
it's not much different if you fallocate a nodatacow file.

Some databases are cow friendly, notably rocksdb. And sqlite with wal
enabled is at least not cow unfriendly. The worst offender seems to be
postgresql but I haven't seen any benchmarking since the multiple
kernel series of fsync work done on btrfs to improve the performance
of databases in general; that was kernel 5.8 through 5.11.

Chris Murphy

More information about the linux-lvm mailing list