btrfs: reduce memory usage for btrfs_raid_bio structure
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | btrfs: raid56: remove sector_ptr::has_paddr memberfs/ | +26 | 0 replies | |
| 2/3 | btrfs: raid56: move sector_ptr::uptodate into a dedicated bitmapfs/ fs/ | +37 | 0 replies | |
| 3/3 | btrfs: raid56: remove sector_ptr structurefs/ fs/ | +127 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] btrfs: reduce memory usage for btrfs_raid_bio structure
This series replace the following members of btrfs_raid_bio:
struct sector_ptr bio_sectors[nr_sectors] struct sector_ptr stripe_sectors[nr_sectors]
To the following ones:
phys_addr_t bio_sectors[nr_sectors]
phys_addr_t stripe_sectors[nr_sectors]
unsigned long uptodate_bitmap[nr_sectors]
For x86_64 (4K page size) with the fixed 64K stripe size and 3 disks, the memory usage of those members (not the full structure) will be reduced from:
8 * 2 + 48 * 16 * 2 = 1552
To
8 * 3 + 48 * 8 * 2 + 8 * 2 = 808
Almost halved the memory usage.
The memory saving comes from:
- Compat sector_ptr::uptodate bit into a bitmap
This not only saves space, but also allow us to call bitmap_*() helpers when we need to set multiple bits in one go (mostly for subpage cases)
- Remove sector_ptr::uptodate flag
We can use a special paddr (not NULL though) to indicate if the paddr is valid or not.
- Get rid of sector_ptr
That structure has extra bits that take a full byte for each flag. This is the biggest space saving.
Qu Wenruo (3):
btrfs: raid56: remove sector_ptr::has_paddr member
btrfs: raid56: move sector_ptr::uptodate into a dedicated bitmap
btrfs: raid56: remove sector_ptr structure
fs/btrfs/raid56.c | 347 ++++++++++++++++++++++------------------------ fs/btrfs/raid56.h | 17 +-- 2 files changed, 168 insertions(+), 196 deletions(-)
Signature · 1 line
2.50.1