]> Gentwo Git Trees - linux/.git/commit
btrfs: inline btrfs_space_info_used()
authorFilipe Manana <fdmanana@suse.com>
Thu, 23 Oct 2025 12:01:34 +0000 (13:01 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Nov 2025 21:08:14 +0000 (22:08 +0100)
commit6f4779faa0c19c3a6ed0d52cb0f068ae891d7bb9
treede333879580fb34af1a4897111db9ca95daf3197
parent0ce6300feca082a866a58fa1f4f9af47a450c41c
btrfs: inline btrfs_space_info_used()

The function is simple enough to be inlined and in fact doing it even
reduces the object code. In x86_64 with gcc 14.2.0-19 from Debian the
results were the following:

  Before this change

    $ size fs/btrfs/btrfs.ko
      text    data     bss     dec     hex filename
    1919410  161703   15592 2096705  1ffe41 fs/btrfs/btrfs.ko

  After this change

    $ size fs/btrfs/btrfs.ko
      text    data     bss     dec     hex filename
    1918991  161675   15592 2096258  1ffc82 fs/btrfs/btrfs.ko

Also remove the ASSERT() that checks the space_info argument is not NULL,
as it's odd to be there since it can never be NULL and in case that ever
happens during development, a stack trace from a NULL pointer dereference
will be obvious. It was originally added when btrfs_space_info_used() was
introduced in commit 4136135b080f ("Btrfs: use helper to get used bytes
of space_info").

Also add a lockdep assertion to check the space_info's lock is being held
by the calling task.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c
fs/btrfs/space-info.h