]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: tag as unlikely if statements that check for fs in error state
authorFilipe Manana <fdmanana@suse.com>
Wed, 1 Apr 2026 17:51:35 +0000 (18:51 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 17:41:42 +0000 (19:41 +0200)
commit7801f3ea9591cf040f7f92c44f8ec91eaa0d6207
tree49eb5c7112df952b482c053aac05db2e416f52fc
parent3f487be81292702a59ea9dbc4088b3360a50e837
btrfs: tag as unlikely if statements that check for fs in error state

Having the filesystem in an error state, meaning we had a transaction
abort, is unexpected. Mark every check for the error state with the
unlikely annotation to convey that and to allow the compiler to generate
better code.

On x86_64, using gcc 14.2.0-19 from Debian, resulted in a slightly
reduced object size and better code.

Before:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  2008598  175912   15592 2200102  219226 fs/btrfs/btrfs.ko

After:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  2008450  175912   15592 2199954  219192 fs/btrfs/btrfs.ko

Reviewed-by: Anand Jain <asj@kernel.org>
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/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/messages.c
fs/btrfs/scrub.c
fs/btrfs/super.c
fs/btrfs/transaction.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c