]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: sysfs: export chunk size in space infos
authorStefan Roesch <shr@fb.com>
Tue, 8 Feb 2022 19:31:21 +0000 (11:31 -0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:32 +0000 (17:45 +0200)
commit0e3fe284e48c08b0a796c580da69e89fec9dd49d
tree2044a44b594e1ef3b59c87ba6af532624f4ffab1
parente415d765a1e45b32c60ee756af85ba281b49de5a
btrfs: sysfs: export chunk size in space infos

Add new sysfs knob

  /sys/fs/btrfs/<uuid>/allocation/<type>/chunk_size.

This allows to query the chunk size and also set the chunk size.

Constraints:

- can be changed by root only
- system chunk size can't be set
- maximum chunk size is 10% of the filesystem size
- final value is rounded down to a multiple of 256M
- cannot be set on zoned filesystem

Note, that rounding and the 10% clamp will result to a different value
on filesystems smaller than 10G, typically 768M.

Signed-off-by: Stefan Roesch <shr@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ Changes to original submission:
  - document setting constraints
  - drop read-only requirement
  - drop unnecessary error messages
  - fix return values of _store callback
  - use memparse for the value
  - fix rounding down to 256M
]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/sysfs.c