Why is btrfs using "space_cache v1"

With journalctl -b i got:

Okt 04 09:01:50 manjaro kernel: BTRFS info (device sda2): using crc32c (crc32c-x86) checksum algorithm
Okt 04 09:01:50 manjaro kernel: BTRFS warning (device sda2): space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2

That alone surprised me because I didn’t explicitly specify space cache v1

According to the documentation I’ve read so far, the btrfs utilities use spacecache=v2 by default since version 5.xxx.
But either that’s not correct, or it only applies to creating a new btrfs filesystem.

So I looked at the options in the fstab and added ,space_cache=v2. Nevertheless, v1 seems to still be used.

mount -t btrfs
/dev/sda2 on / type btrfs (rw,noatime,compress=zstd:9,ssd,discard=async,space_cache,subvolid=83648,subvol=/@)
...
cat /etc/fstab|grep 'subvol=@[^a-z]'
UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx	/			btrfs	rw,noatime,space_cache=v2,compress=zstd:9,subvol=@			0 0

And now I have another warning from btrfs:

Okt 04 10:29:17 manjaro kernel: BTRFS info (device sda2): using crc32c (crc32c-x86) checksum algorithm
Okt 04 10:29:17 manjaro kernel: BTRFS warning (device sda2): space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2
...
Okt 04 10:29:17 manjaro kernel: BTRFS info (device sda2): enabling disk space caching
Okt 04 10:29:20 manjaro18 kernel: BTRFS warning (device sda2 state M): remount supports changing free space tree only from RO to RW

Apparently, “/” is mounted RO with the space_cache=v1 option. And that can’t be changed when remounting RW via the fstab later.

Yes, I ran mkinitcpio -P and rebooted.

What should I make of this?

I have migrated to v2 (as it is used by default by newer kernels), but forgot how I did it:

$ mount | grep "space_cache=v2"
/dev/mapper/cryptroot on / type btrfs (rw,noatime,compress=zstd:3,ssd,space_cache=v2,commit=120,subvolid=3219,subvol=/@)
/dev/mapper/cryptroot on /home type btrfs (rw,noatime,compress=zstd:3,ssd,space_cache=v2,commit=120,subvolid=3218,subvol=/@home)
/dev/sda1 on /mnt/Daten type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,commit=120,subvolid=257,subvol=/@data)

It seems the file system needs to be changed manually.
This requires running btrfstune while the drive is unmounted. I’d rather make a backup first. :footprints:

The space_cache format is set in the filesystem itself and will not change automagically — see my own thread here, which you partook in.

In order to change the space_cache from version 1 to version 2, you must do so while the filesystem isn’t mounted — in other words, from the live USB.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.