Commit ee39b432b4ac083acdafd7b4f156283722e3bf14
1 parent
5d99a998f3
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
btrfs: remove unlikely from data-dependent branches and slow paths
There are the branch hints that obviously depend on the data being processed, the CPU predictor will do better job according to the actual load. It also does not make sense to use the hints in slow paths that do a lot of other operations like locking, waiting or IO. Signed-off-by: David Sterba <dsterba@suse.cz>
Showing 5 changed files with 10 additions and 10 deletions Side-by-side Diff
fs/btrfs/extent-tree.c
... | ... | @@ -9694,7 +9694,7 @@ |
9694 | 9694 | |
9695 | 9695 | int btrfs_start_nocow_write(struct btrfs_root *root) |
9696 | 9696 | { |
9697 | - if (unlikely(atomic_read(&root->will_be_snapshoted))) | |
9697 | + if (atomic_read(&root->will_be_snapshoted)) | |
9698 | 9698 | return 0; |
9699 | 9699 | |
9700 | 9700 | percpu_counter_inc(&root->subv_writers->counter); |
... | ... | @@ -9702,7 +9702,7 @@ |
9702 | 9702 | * Make sure counter is updated before we check for snapshot creation. |
9703 | 9703 | */ |
9704 | 9704 | smp_mb(); |
9705 | - if (unlikely(atomic_read(&root->will_be_snapshoted))) { | |
9705 | + if (atomic_read(&root->will_be_snapshoted)) { | |
9706 | 9706 | btrfs_end_nocow_write(root); |
9707 | 9707 | return 0; |
9708 | 9708 | } |
fs/btrfs/file.c
... | ... | @@ -452,7 +452,7 @@ |
452 | 452 | if (unlikely(copied == 0)) |
453 | 453 | break; |
454 | 454 | |
455 | - if (unlikely(copied < PAGE_CACHE_SIZE - offset)) { | |
455 | + if (copied < PAGE_CACHE_SIZE - offset) { | |
456 | 456 | offset += copied; |
457 | 457 | } else { |
458 | 458 | pg++; |
... | ... | @@ -1792,7 +1792,7 @@ |
1792 | 1792 | if (sync) |
1793 | 1793 | atomic_inc(&BTRFS_I(inode)->sync_writers); |
1794 | 1794 | |
1795 | - if (unlikely(file->f_flags & O_DIRECT)) { | |
1795 | + if (file->f_flags & O_DIRECT) { | |
1796 | 1796 | num_written = __btrfs_direct_write(iocb, from, pos); |
1797 | 1797 | } else { |
1798 | 1798 | num_written = __btrfs_buffered_write(file, from, pos); |
fs/btrfs/inode.c
... | ... | @@ -7802,9 +7802,9 @@ |
7802 | 7802 | atomic_inc(&dip->pending_bios); |
7803 | 7803 | |
7804 | 7804 | while (bvec <= (orig_bio->bi_io_vec + orig_bio->bi_vcnt - 1)) { |
7805 | - if (unlikely(map_length < submit_len + bvec->bv_len || | |
7805 | + if (map_length < submit_len + bvec->bv_len || | |
7806 | 7806 | bio_add_page(bio, bvec->bv_page, bvec->bv_len, |
7807 | - bvec->bv_offset) < bvec->bv_len)) { | |
7807 | + bvec->bv_offset) < bvec->bv_len) { | |
7808 | 7808 | /* |
7809 | 7809 | * inc the count before we submit the bio so |
7810 | 7810 | * we know the end IO handler won't happen before |
... | ... | @@ -8017,8 +8017,8 @@ |
8017 | 8017 | ret = btrfs_delalloc_reserve_space(inode, count); |
8018 | 8018 | if (ret) |
8019 | 8019 | goto out; |
8020 | - } else if (unlikely(test_bit(BTRFS_INODE_READDIO_NEED_LOCK, | |
8021 | - &BTRFS_I(inode)->runtime_flags))) { | |
8020 | + } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, | |
8021 | + &BTRFS_I(inode)->runtime_flags)) { | |
8022 | 8022 | inode_dio_done(inode); |
8023 | 8023 | flags = DIO_LOCKING | DIO_SKIP_HOLES; |
8024 | 8024 | wakeup = false; |
fs/btrfs/ioctl.c
fs/btrfs/transaction.c