Skip to content

Commit e8a471c

Browse files
committed
btrfs-progs: docs: improve space_cache mount option description
Strcturise the details more clearly by: - What it does/implications. - The different versions an their details. - What happens if both versions are present. - What happens with kernels that cannot use v2. - How each version can be disabled, cleared or removed. - Make it more clear that the default of "space cache v2" applies also if the option isn't given at all. Signed-off-by: Christoph Anton Mitterer <[email protected]>
1 parent d6d4e6f commit e8a471c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

Documentation/ch-mount-options.rst

+19-17
Original file line numberDiff line numberDiff line change
@@ -355,27 +355,29 @@ space_cache, space_cache=<version>, nospace_cache
355355
the space cache consumes some resources, including a small amount of disk
356356
space.
357357

358-
There are two implementations of the free space cache. The original
359-
one, referred to as *v1*, used to be a safe default but has been
360-
superseded by *v2*. The *v1* space cache can be disabled at mount time
361-
with *nospace_cache* without clearing.
362-
363-
On very large filesystems (many terabytes) and certain workloads, the
364-
performance of the *v1* space cache may degrade drastically. The *v2*
365-
implementation, which adds a new b-tree called the free space tree, addresses
366-
this issue. Once enabled, the *v2* space cache will always be used and cannot
367-
be disabled unless it is cleared. Use *clear_cache,space_cache=v1* or
368-
*clear_cache,nospace_cache* to do so. If *v2* is enabled, and *v1* space
369-
cache will be cleared (at the first mount) and kernels without *v2*
370-
support will only be able to mount the filesystem in read-only mode.
371-
On an unmounted filesystem the caches (both versions) can be cleared by
372-
"btrfs check --clear-space-cache".
358+
There are two implementations of the free space cache:
359+
* *v1*, the original one, whose performance may degrade drastically on very
360+
large filesystems (many terabytes) and certain workloads.
361+
* *v2*, the newer one, which addresses the above issue and uses a new b-tree
362+
called "free space tree".
363+
364+
When *v2* is enabled, a *v1* space cache will be cleared (at the first mount).
365+
366+
Kernels without *v2* support will only be able to mount filesystems with *v2*
367+
space cache in read-only mode.
368+
369+
The *v1* space cache can be disabled at mount time with *nospace_cache* without
370+
clearing it.
371+
The *v2* space cache, once enabled, cannot be disabled and will always be used
372+
if present, unless it is cleared and the space cache is either disabled (via
373+
*clear_cache,nospace_cache*) or changed to *v1* (via *clear_cache,space_cache=v1*).
374+
Both versions can be removed, see :command:`btrfs check --clear-space-cache v2`.
373375

374376
The :doc:`btrfs-check(8)<btrfs-check>` and `:doc:`mkfs.btrfs(8)<mkfs.btrfs>` commands have full *v2* free space
375377
cache support since v4.19.
376378

377-
If a version is not explicitly specified, the default implementation will be
378-
chosen, which is *v2*.
379+
Unless *nospace_cache* is specified, if *space_cache* is not specified at all
380+
or specified without version, the default (space cache *v2*) will be used.
379381

380382
ssd, ssd_spread, nossd, nossd_spread
381383
(default: SSD autodetected)

0 commit comments

Comments
 (0)