What is Btrfs's disk space caching?

Short and to the point:

if enabled, Kernel will have available FS free space block addresses in memory, thus when you create a new file it will immediately start writing data to disk.

More details:

the mount option space_cache now is the default on recent kernels. It provides better performance, when creating new files or writing new data to disk. Please see link. You can disable it by adding nospace_cache mount option.

nospace_cache since: 3.2, space_cache=v1 and space_cache=v2 since 4.5, default: space_cache=v1


This space_cache option will be selected while mounting a mount point which has Btrfs file system. This will store the free space cache on the disk to make the caching of a block much faster. Without this, Btrfs has to scan the entire tree every time looking for the free space that can be allocated.