BTRFS warning (device dm-0): space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2

I have just noticed this warning in the journal.

What is a user/administrator supposed to do about this warning?

I do not have a -o space_cache option in by /etc/fstab file to change.

Will v2 be use automatically at some point or must I add the option?
What happens if I don’t add the option?

In the past btrfs filesystems were created with space_cache=v1, by default.
Thus, with such old filesystems that setting is recorded in some header and picked up during mount time, iff it’s not explicitly overwritten by space_cache=v2 or even nospace_cache.

You can look up the effective set of options on currently mounted btrfs filesystems like this:

findmnt -t btrfs

If you want to reduce the noise in your log messages you have two options:

  1. switch to v2 space cache
  2. disable space cache

One way to switch to v2 is to temporarily add space_cache=v2 to your fstab listed filesystems and then they are converted on the next boot, e.g. during the next boot.
After that you can remove that option again from /etc/fstab.
This is the simplest way in case you have a btrfs / root filesystem.

Of course, for other filesystems that aren’t in use, you can simple umount and mount -o space_cache=v2 ... again for the conversion.

NB: the space_cache change is NOT supported via mount -o remount,space_cache=v2 ... on a rw mounted btrfs filesystem.

In contrast, simply disabling the space cache (persistently) works via mount -o remount,nospace_cache ....

NB: disabling the space cache likely negatively impacts the performance, unless perhaps it’s a very small filesystem.

Will v2 be use automatically at some point or must I add the option?
What happens if I don’t add the option?

Hard to say what will happen exactly, since so far the btrfs team only has announced the deprecation but hasn’t communicated any plans on how the removal will play out.

We should be able to assume common sense, i.e. kernels with only v2 support likely are able to mount old space cache v1 btrfs filesystems.
Likely strategies they will implement:

  1. print some warning and simply run with disabled space cache (possibly keeping the v1 structures around, for a few releases, wasting a few bits that way), or
  2. throw away space cache v1 structures and auto-create space cache v2 and run with it active
1 Like

You don’t need to do anything at the present time.

More information is in this tracking issue:
https://pagure.io/fedora-btrfs/project/issue/68

I did the dance with /etc/fstab option to update the v2 two days ago.
Warning is now gone and everything working well.

1 Like

Great.

Optionally remove it from fstab. On initial mount with this feature enabled, a feature flag is added to the super blocks making it persistent for all subsequent mounts. You do not need to request it with every mount.

1 Like