]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: tag as unlikely error conditions in the transaction commit path
authorFilipe Manana <fdmanana@suse.com>
Wed, 17 Dec 2025 13:04:21 +0000 (13:04 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:49:12 +0000 (07:49 +0100)
commit858f32937c8ad5519c5daa9d5498963fe0bd0139
treea792d9123ec20eb751e0aafd2c7dbed08e489fc1
parent4cdb457a23751a1debebbf7d010300fe4eff47a8
btrfs: tag as unlikely error conditions in the transaction commit path

Errors are unexpected during the transaction commit path, and when they
happen we abort the transaction (by calling cleanup_transaction() under
the label 'cleanup_transaction' in btrfs_commit_transaction()). So mark
every error check in the transaction commit path as unlikely, to hint the
compiler so that it can possibly generate better code, and make it clear
for a reader about being unexpected.

On a x86_84 box using gcc 14.2.0-19 from Debian, this resulted in a slight
reduction of the module's text size.

Before:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1939476  172568   15592 2127636  207714 fs/btrfs/btrfs.ko

After:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1939044  172568   15592 2127204  207564 fs/btrfs/btrfs.ko

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/transaction.c