]> Gentwo Git Trees - linux/.git/commit
btrfs: annotate btrfs_is_testing() as unlikely and make it return bool
authorFilipe Manana <fdmanana@suse.com>
Fri, 19 Sep 2025 08:55:12 +0000 (09:55 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:24 +0000 (08:49 +0200)
commitdb524fd9802f7ec3281a7f1fdae66c67c9525ba3
treec9ac39a4c406e496a7ae96add6e3157e9653e1ee
parentf07575bab632af8d665c8cc95be0e83ca5d3bd80
btrfs: annotate btrfs_is_testing() as unlikely and make it return bool

We can annotate btrfs_is_testing() as unlikely since that's the most
expected scenario and it's desirable for the compiler to optimize for
the case we are not running the self tests. So add the annotation to
btrfs_is_testing() and while at it also make it return bool instead of
int.

Also make two of the existing callers use btrfs_is_testing() directly
instead of storing its result in a local variable.

On x86_64 with Debian's gcc 14.2.0-19 this resulted in a very tiny object
code reduction.

Before this change:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1913263  161567   15592 2090422  1fe5b6 fs/btrfs/btrfs.ko

After this change:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1913257  161567   15592 2090416  1fe5b0 fs/btrfs/btrfs.ko

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Qu Wenruo <wqu@suse.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/delayed-ref.c
fs/btrfs/disk-io.c
fs/btrfs/fs.h