btrfs: remove start field from struct btrfs_free_space_ctl

There's no need for the start field, we can take it from the block group.
This reduces the structure size from 152 bytes down to 144 bytes, so on
a 4K page system we can now fit 28 structures instead of 26.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Filipe Manana 2026-04-15 13:31:05 +01:00 committed by David Sterba
parent 66fd877b13
commit 5e4b57f77c
2 changed files with 4 additions and 6 deletions

View File

@ -1568,10 +1568,10 @@ static inline u64 offset_to_bitmap(struct btrfs_free_space_ctl *ctl,
u64 bytes_per_bitmap;
bytes_per_bitmap = BITS_PER_BITMAP * ctl->unit;
bitmap_start = offset - ctl->start;
bitmap_start = offset - ctl->block_group->start;
bitmap_start = div64_u64(bitmap_start, bytes_per_bitmap);
bitmap_start *= bytes_per_bitmap;
bitmap_start += ctl->start;
bitmap_start += ctl->block_group->start;
return bitmap_start;
}
@ -2050,9 +2050,9 @@ find_free_space(struct btrfs_free_space_ctl *ctl, u64 *offset, u64 *bytes,
* to match our requested alignment
*/
if (*bytes >= align) {
tmp = entry->offset - ctl->start + align - 1;
tmp = entry->offset - ctl->block_group->start + align - 1;
tmp = div64_u64(tmp, align);
tmp = tmp * align + ctl->start;
tmp = tmp * align + ctl->block_group->start;
align_off = tmp - entry->offset;
} else {
align_off = 0;
@ -2947,7 +2947,6 @@ void btrfs_init_free_space_ctl(struct btrfs_block_group *block_group,
spin_lock_init(&ctl->tree_lock);
ctl->unit = fs_info->sectorsize;
ctl->start = block_group->start;
ctl->block_group = block_group;
ctl->op = &free_space_op;
ctl->free_space_bytes = RB_ROOT_CACHED;

View File

@ -82,7 +82,6 @@ struct btrfs_free_space_ctl {
int free_extents;
int total_bitmaps;
int unit;
u64 start;
s32 discardable_extents[BTRFS_STAT_NR_ENTRIES];
s64 discardable_bytes[BTRFS_STAT_NR_ENTRIES];
const struct btrfs_free_space_op *op;