btrfs: change the DEV_ITEM 'type' field via sysfs
Known limitations:
- Device replace does not copy the allocation hint to the target
device. Users must reapply it after replacement.
- The sysfs update is not serialized with chunk allocation through
chunk_mutex, so an allocation concurrent with an update may observe
either value.
A future revision should replace the type field with dedicated
transactional structures. Transactions should not be triggered directly
from sysfs writes, see:
https://lore.kernel.org/linux-btrfs/
20251213200920.
1808679-1-kai@kaishome.de/
v2:
- Adds a check to prevent modification while the file system is still
mounting.
v3:
- Accept only valid allocation hint types
v4:
- Document the device replace and chunk allocation synchronization
limitations of the current type-based interface.
Link: https://github.com/kakra/linux/pull/36#issuecomment-3406301805
Reported-by: Eli Venter <eli@genedx.com>
Co-authored-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: Kai Krakow <kai@kaishome.de>