Skip to content

Commit 8f0534e

Browse files
fdmananakdave
authored andcommitted
btrfs: mark extent buffer alignment checks as unlikely
We are not expecting to ever fail the extent buffer alignment checks, so mark them as unlikely to allow the compiler to potentially generate more optimized code. 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>
1 parent 6a9e1d1 commit 8f0534e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

fs/btrfs/extent_io.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,25 +3228,25 @@ static bool check_eb_alignment(struct btrfs_fs_info *fs_info, u64 start)
32283228
{
32293229
const u32 nodesize = fs_info->nodesize;
32303230

3231-
if (!IS_ALIGNED(start, fs_info->sectorsize)) {
3231+
if (unlikely(!IS_ALIGNED(start, fs_info->sectorsize))) {
32323232
btrfs_err(fs_info, "bad tree block start %llu", start);
32333233
return true;
32343234
}
32353235

3236-
if (nodesize < PAGE_SIZE && !IS_ALIGNED(start, nodesize)) {
3236+
if (unlikely(nodesize < PAGE_SIZE && !IS_ALIGNED(start, nodesize))) {
32373237
btrfs_err(fs_info,
32383238
"tree block is not nodesize aligned, start %llu nodesize %u",
32393239
start, nodesize);
32403240
return true;
32413241
}
3242-
if (nodesize >= PAGE_SIZE && !PAGE_ALIGNED(start)) {
3242+
if (unlikely(nodesize >= PAGE_SIZE && !PAGE_ALIGNED(start))) {
32433243
btrfs_err(fs_info,
32443244
"tree block is not page aligned, start %llu nodesize %u",
32453245
start, nodesize);
32463246
return true;
32473247
}
3248-
if (!IS_ALIGNED(start, nodesize) &&
3249-
!test_and_set_bit(BTRFS_FS_UNALIGNED_TREE_BLOCK, &fs_info->flags)) {
3248+
if (unlikely(!IS_ALIGNED(start, nodesize) &&
3249+
!test_and_set_bit(BTRFS_FS_UNALIGNED_TREE_BLOCK, &fs_info->flags))) {
32503250
btrfs_warn(fs_info,
32513251
"tree block not nodesize aligned, start %llu nodesize %u, can be resolved by a full metadata balance",
32523252
start, nodesize);

0 commit comments

Comments
 (0)