btrfs: tag as unlikely error handling in run_one_delayed_ref()

We don't expect to get errors unless we have a corrupted fs, bad RAM or a
bug. So tag the error handling as unlikely.

This slightly reduces the module's text size on x86_64 using gcc 14.2.0-19
from Debian.

Before this change:

  $ size fs/btrfs/btrfs.ko
     text	   data	    bss	    dec	    hex	filename
  1939458	 172512	  15592	2127562	 2076ca	fs/btrfs/btrfs.ko

After this change:

  $ size fs/btrfs/btrfs.ko
     text	   data	    bss	    dec	    hex	filename
  1939398	 172512	  15592	2127502	 20768e	fs/btrfs/btrfs.ko

Reviewed-by: Boris Burkov <boris@bur.io>
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>
This commit is contained in:
Filipe Manana 2026-01-13 16:42:57 +00:00 committed by David Sterba
parent 271cbe7635
commit b322fa5ff1

View File

@ -1785,13 +1785,15 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans,
btrfs_err(fs_info, "unexpected delayed ref node type: %u", node->type);
}
if (ret && insert_reserved)
btrfs_pin_extent(trans, node->bytenr, node->num_bytes);
if (ret < 0)
if (unlikely(ret)) {
if (insert_reserved)
btrfs_pin_extent(trans, node->bytenr, node->num_bytes);
btrfs_err(fs_info,
"failed to run delayed ref for logical %llu num_bytes %llu type %u action %u ref_mod %d: %d",
node->bytenr, node->num_bytes, node->type,
node->action, node->ref_mod, ret);
}
return ret;
}