Re: [RFC][PATCH V5] btrfs: preferred_metadata: preferred device for metadata
From: Martin Svec <hidden>
Date: 2021-01-21 18:47:16
Hi all, Dne 20.01.2021 v 0:12 Zygo Blaxell napsal(a):
With the 4 device types we can trivially specify this arrangement.
The sorted device lists would be:
Metadata sort order Data sort order
metadata only (3) data only (2)
metadata preferred (1) data preferred (0)
data preferred (0) metadata preferred (1)
other devices (2 or other) other devices (3 or other)
We keep 3 device counts for the first 3 sort orders. If the number of all
preferred devices (type != 0) is zero, we just return ndevs; otherwise,
we pick the first device count that is >= mindevs. If all the device
counts are < mindevs then we return the 3rd count (metadata only +
metadata preferred + data preferred) and the caller will find ENOSPC.
More sophisticated future implementations can alter the sort order, or
operate in entirely separate parts of btrfs, without conflicting with
this scheme. If there is no mount option, then future implementations
can't conflict with it.I agree with Zygo and Josef that the mount option is ugly and needless. This should be a _per-device_ setting as suggested by Zygo (metadata only, metadata preferred, data preferred, data only, unspecified). Maybe in the future it might be useful to generalize this setting to something like a 0..255 priority but the 4 device types look like a sufficient solution for now. I would personally prefer a read-write sysfs option to change the device preference but btrfs-progs approach is fine for me too. Anyway, I'm REALLY happy that there's finally a patchset being actively discussed. I maintain a naive patch implementing "preferred_metadata=metadata" option for years and the impact e.g. for rsync backups is huge. Martin