btrfs: reduce the width of devices counter
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | btrfs: reject a superblock with over 65536 devicesfs/ | +2 | 0 replies | |
| 2/2 | btrfs: reduce the width of device countersfs/ fs/ fs/ | +25 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] btrfs: reduce the width of devices counter
Currently btrfs_super_block::num_devices is u64, thus all of our internal devices counters are also u64.
But the truth is, it's really impractical to have that many devices, one of two dozens of devices may be the upper limit in the real world.
In fact we already have a sanity check for btrfs_super_block::num_devices, if the value is beyond 1<<31, we would consider it insane and reject the superblock.
Now let's go a step further, by reducing the limit to U16_MAX (65536), and with that change, we can also reduce the width from 64 to 16 for all our internal devices counters.
(superblock num_devices still stay u64 though).
Such reduce would slightly reduce the memory usage per-btrfs.
Also with the new device number limit, the 2nd patch would do extra device number check to avoid overflow u16.
Qu Wenruo (2):
btrfs: reject a superblock with over 65536 devices
btrfs: reduce the width of device counters
fs/btrfs/dev-replace.c | 9 +++++++++ fs/btrfs/disk-io.c | 3 ++- fs/btrfs/volumes.c | 11 ++++++++++- fs/btrfs/volumes.h | 12 ++++++------ 4 files changed, 27 insertions(+), 8 deletions(-)
Signature · 1 line
2.42.0