]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: send: add unlikely to all unexpected overflow checks
authorFilipe Manana <fdmanana@suse.com>
Wed, 19 Nov 2025 16:43:11 +0000 (16:43 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:53:33 +0000 (01:53 +0100)
commit7c3acdb998dd723ac791cd4a47f13599d76a1f58
tree48a64b5ab6d4223be33f3370999253fcebdd0b0c
parent139e3167d81143f9cd719fde420a825dae7b711d
btrfs: send: add unlikely to all unexpected overflow checks

There are several checks for unexpected overflows of buffers and path
lengths that makes us fail the send operation with an error if for some
highly unexpected reason they happen. So add the unlikely tag to those
checks to hint the compiler to generate better code, while also making
it more explicit in the source that it's highly unexpected.

With gcc 14.2.0-19 from Debian on x86_64, I also got a small reduction
the text size of the btrfs module.

Before:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1936917  162723   15592 2115232  2046a0 fs/btrfs/btrfs.ko

After:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  1936789  162723   15592 2115104  204620 fs/btrfs/btrfs.ko

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