f2fs: add unlikely() macro for compiler optimization
As we know, some of our branch condition will rarely be true. So we could add 'unlikely' to let compiler optimize these code, by this way we could drop unneeded 'jump' assemble code to improve performance. change log: o add *unlikely* as many as possible across the whole source files at once suggested by Jaegeuk Kim. Suggested-by: Jaegeuk Kim <jaegeuk.kim@samsung.com> Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
b9987a277f
commit
cfb271d485
6 changed files with 33 additions and 27 deletions
|
|
@ -251,7 +251,7 @@ int reserve_new_block(struct dnode_of_data *dn)
|
|||
|
||||
if (is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))
|
||||
return -EPERM;
|
||||
if (!inc_valid_block_count(sbi, dn->inode, 1))
|
||||
if (unlikely(!inc_valid_block_count(sbi, dn->inode, 1)))
|
||||
return -ENOSPC;
|
||||
|
||||
trace_f2fs_reserve_new_block(dn->inode, dn->nid, dn->ofs_in_node);
|
||||
|
|
@ -711,7 +711,7 @@ static int f2fs_write_data_page(struct page *page,
|
|||
|
||||
zero_user_segment(page, offset, PAGE_CACHE_SIZE);
|
||||
write:
|
||||
if (sbi->por_doing) {
|
||||
if (unlikely(sbi->por_doing)) {
|
||||
err = AOP_WRITEPAGE_ACTIVATE;
|
||||
goto redirty_out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue