From: Filipe Manana Date: Wed, 11 Mar 2026 12:07:03 +0000 (+0000) Subject: btrfs: tag as unlikely branches that call extent_io_tree_panic() X-Git-Tag: ceph-for-7.1-rc4~321^2~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0f7c10d662ac4fcd749543568d15cd65325feef9;p=ceph-client.git btrfs: tag as unlikely branches that call extent_io_tree_panic() It's unexpected to ever call extent_io_tree_panic() so surround with 'unlikely' every if statement condition that leads to it, making it explicit to a reader and to hint the compiler to potentially generate better code. On x86_64, using gcc 14.2.0-19 from Debian, this resulted in a slightly decrease of the btrfs module's text size. Before: $ size fs/btrfs/btrfs.ko text data bss dec hex filename 1999832 174320 15592 2189744 2169b0 fs/btrfs/btrfs.ko After: $ size fs/btrfs/btrfs.ko text data bss dec hex filename 1999768 174320 15592 2189680 216970 fs/btrfs/btrfs.ko Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c index 68e48b493950..93dca9199249 100644 --- a/fs/btrfs/extent-io-tree.c +++ b/fs/btrfs/extent-io-tree.c @@ -696,7 +696,7 @@ hit_next: goto search_again; ret = split_state(tree, state, prealloc, start); prealloc = NULL; - if (ret) { + if (unlikely(ret)) { extent_io_tree_panic(tree, state, "split", ret); goto out; } @@ -762,7 +762,7 @@ hit_next: if (!prealloc) goto search_again; ret = split_state(tree, state, prealloc, end + 1); - if (ret) { + if (unlikely(ret)) { extent_io_tree_panic(tree, state, "split", ret); prealloc = NULL; goto out; @@ -1203,7 +1203,7 @@ hit_next: if (!prealloc) goto search_again; ret = split_state(tree, state, prealloc, start); - if (ret) + if (unlikely(ret)) extent_io_tree_panic(tree, state, "split", ret); prealloc = NULL; @@ -1293,7 +1293,7 @@ hit_next: if (!prealloc) goto search_again; ret = split_state(tree, state, prealloc, end + 1); - if (ret) { + if (unlikely(ret)) { extent_io_tree_panic(tree, state, "split", ret); prealloc = NULL; goto out; @@ -1448,7 +1448,7 @@ hit_next: } ret = split_state(tree, state, prealloc, start); prealloc = NULL; - if (ret) { + if (unlikely(ret)) { extent_io_tree_panic(tree, state, "split", ret); goto out; } @@ -1532,7 +1532,7 @@ hit_next: } ret = split_state(tree, state, prealloc, end + 1); - if (ret) { + if (unlikely(ret)) { extent_io_tree_panic(tree, state, "split", ret); prealloc = NULL; goto out;