f2fs: add unlikely() macro for compiler more aggressively
This patch adds unlikely() macro into the most of codes. The basic rule is to add that when: - checking unusual errors, - checking page mappings, - and the other unlikely conditions. Change log from v1: - Don't add unlikely for the NULL test and error test: advised by Andi Kleen. Cc: Chao Yu <chao2.yu@samsung.com> Cc: Andi Kleen <andi@firstfloor.org> Reviewed-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
cfb271d485
commit
6bacf52fb5
|
@ -66,7 +66,7 @@ repeat:
|
||||||
goto repeat;
|
goto repeat;
|
||||||
|
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (page->mapping != mapping) {
|
if (unlikely(page->mapping != mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,7 @@ static int __add_dirty_inode(struct inode *inode, struct dir_inode_entry *new)
|
||||||
list_for_each(this, head) {
|
list_for_each(this, head) {
|
||||||
struct dir_inode_entry *entry;
|
struct dir_inode_entry *entry;
|
||||||
entry = list_entry(this, struct dir_inode_entry, list);
|
entry = list_entry(this, struct dir_inode_entry, list);
|
||||||
if (entry->inode == inode)
|
if (unlikely(entry->inode == inode))
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
list_add_tail(&new->list, head);
|
list_add_tail(&new->list, head);
|
||||||
|
@ -783,7 +783,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount)
|
||||||
/* Here, we only have one bio having CP pack */
|
/* Here, we only have one bio having CP pack */
|
||||||
sync_meta_pages(sbi, META_FLUSH, LONG_MAX);
|
sync_meta_pages(sbi, META_FLUSH, LONG_MAX);
|
||||||
|
|
||||||
if (!is_set_ckpt_flags(ckpt, CP_ERROR_FLAG)) {
|
if (unlikely(!is_set_ckpt_flags(ckpt, CP_ERROR_FLAG))) {
|
||||||
clear_prefree_segments(sbi);
|
clear_prefree_segments(sbi);
|
||||||
F2FS_RESET_SB_DIRT(sbi);
|
F2FS_RESET_SB_DIRT(sbi);
|
||||||
}
|
}
|
||||||
|
@ -840,11 +840,11 @@ int __init create_checkpoint_caches(void)
|
||||||
{
|
{
|
||||||
orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry",
|
orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry",
|
||||||
sizeof(struct orphan_inode_entry), NULL);
|
sizeof(struct orphan_inode_entry), NULL);
|
||||||
if (unlikely(!orphan_entry_slab))
|
if (!orphan_entry_slab)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
inode_entry_slab = f2fs_kmem_cache_create("f2fs_dirty_dir_entry",
|
inode_entry_slab = f2fs_kmem_cache_create("f2fs_dirty_dir_entry",
|
||||||
sizeof(struct dir_inode_entry), NULL);
|
sizeof(struct dir_inode_entry), NULL);
|
||||||
if (unlikely(!inode_entry_slab)) {
|
if (!inode_entry_slab) {
|
||||||
kmem_cache_destroy(orphan_entry_slab);
|
kmem_cache_destroy(orphan_entry_slab);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,11 @@ static void f2fs_read_end_io(struct bio *bio, int err)
|
||||||
if (--bvec >= bio->bi_io_vec)
|
if (--bvec >= bio->bi_io_vec)
|
||||||
prefetchw(&bvec->bv_page->flags);
|
prefetchw(&bvec->bv_page->flags);
|
||||||
|
|
||||||
if (uptodate) {
|
if (unlikely(!uptodate)) {
|
||||||
SetPageUptodate(page);
|
|
||||||
} else {
|
|
||||||
ClearPageUptodate(page);
|
ClearPageUptodate(page);
|
||||||
SetPageError(page);
|
SetPageError(page);
|
||||||
|
} else {
|
||||||
|
SetPageUptodate(page);
|
||||||
}
|
}
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
} while (bvec >= bio->bi_io_vec);
|
} while (bvec >= bio->bi_io_vec);
|
||||||
|
@ -73,7 +73,7 @@ static void f2fs_write_end_io(struct bio *bio, int err)
|
||||||
if (--bvec >= bio->bi_io_vec)
|
if (--bvec >= bio->bi_io_vec)
|
||||||
prefetchw(&bvec->bv_page->flags);
|
prefetchw(&bvec->bv_page->flags);
|
||||||
|
|
||||||
if (!uptodate) {
|
if (unlikely(!uptodate)) {
|
||||||
SetPageError(page);
|
SetPageError(page);
|
||||||
set_bit(AS_EIO, &page->mapping->flags);
|
set_bit(AS_EIO, &page->mapping->flags);
|
||||||
set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
|
set_ckpt_flags(sbi->ckpt, CP_ERROR_FLAG);
|
||||||
|
@ -249,7 +249,7 @@ int reserve_new_block(struct dnode_of_data *dn)
|
||||||
{
|
{
|
||||||
struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb);
|
struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb);
|
||||||
|
|
||||||
if (is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))
|
if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC)))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
if (unlikely(!inc_valid_block_count(sbi, dn->inode, 1)))
|
if (unlikely(!inc_valid_block_count(sbi, dn->inode, 1)))
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
|
@ -424,7 +424,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
|
|
||||||
/* By fallocate(), there is no cached page, but with NEW_ADDR */
|
/* By fallocate(), there is no cached page, but with NEW_ADDR */
|
||||||
if (dn.data_blkaddr == NEW_ADDR)
|
if (unlikely(dn.data_blkaddr == NEW_ADDR))
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
page = grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS);
|
page = grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS);
|
||||||
|
@ -443,7 +443,7 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
|
||||||
|
|
||||||
if (sync) {
|
if (sync) {
|
||||||
wait_on_page_locked(page);
|
wait_on_page_locked(page);
|
||||||
if (!PageUptodate(page)) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
f2fs_put_page(page, 0);
|
f2fs_put_page(page, 0);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ repeat:
|
||||||
}
|
}
|
||||||
f2fs_put_dnode(&dn);
|
f2fs_put_dnode(&dn);
|
||||||
|
|
||||||
if (dn.data_blkaddr == NULL_ADDR) {
|
if (unlikely(dn.data_blkaddr == NULL_ADDR)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
}
|
}
|
||||||
|
@ -502,11 +502,11 @@ repeat:
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (!PageUptodate(page)) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
if (page->mapping != mapping) {
|
if (unlikely(page->mapping != mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,6 @@ struct page *get_new_data_page(struct inode *inode,
|
||||||
err = f2fs_reserve_block(&dn, index);
|
err = f2fs_reserve_block(&dn, index);
|
||||||
if (err)
|
if (err)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
|
||||||
repeat:
|
repeat:
|
||||||
page = grab_cache_page(mapping, index);
|
page = grab_cache_page(mapping, index);
|
||||||
if (!page)
|
if (!page)
|
||||||
|
@ -552,11 +551,11 @@ repeat:
|
||||||
if (err)
|
if (err)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (!PageUptodate(page)) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
if (page->mapping != mapping) {
|
if (unlikely(page->mapping != mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
}
|
}
|
||||||
|
@ -841,11 +840,11 @@ repeat:
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (!PageUptodate(page)) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
if (page->mapping != mapping) {
|
if (unlikely(page->mapping != mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,9 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma,
|
||||||
|
|
||||||
file_update_time(vma->vm_file);
|
file_update_time(vma->vm_file);
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (page->mapping != inode->i_mapping ||
|
if (unlikely(page->mapping != inode->i_mapping ||
|
||||||
page_offset(page) > i_size_read(inode) ||
|
page_offset(page) > i_size_read(inode) ||
|
||||||
!PageUptodate(page)) {
|
!PageUptodate(page))) {
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -120,7 +120,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
|
||||||
.for_reclaim = 0,
|
.for_reclaim = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (f2fs_readonly(inode->i_sb))
|
if (unlikely(f2fs_readonly(inode->i_sb)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
trace_f2fs_sync_file_enter(inode);
|
trace_f2fs_sync_file_enter(inode);
|
||||||
|
@ -241,7 +241,7 @@ static void truncate_partial_data_page(struct inode *inode, u64 from)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (page->mapping != inode->i_mapping) {
|
if (unlikely(page->mapping != inode->i_mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,6 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
if (pg_start == pg_end)
|
if (pg_start == pg_end)
|
||||||
new_size = offset + len;
|
new_size = offset + len;
|
||||||
else if (index == pg_start && off_start)
|
else if (index == pg_start && off_start)
|
||||||
|
|
|
@ -119,7 +119,6 @@ int start_gc_thread(struct f2fs_sb_info *sbi)
|
||||||
kfree(gc_th);
|
kfree(gc_th);
|
||||||
sbi->gc_thread = NULL;
|
sbi->gc_thread = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -695,7 +694,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi)
|
||||||
|
|
||||||
INIT_LIST_HEAD(&ilist);
|
INIT_LIST_HEAD(&ilist);
|
||||||
gc_more:
|
gc_more:
|
||||||
if (!(sbi->sb->s_flags & MS_ACTIVE))
|
if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE)))
|
||||||
goto stop;
|
goto stop;
|
||||||
|
|
||||||
if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) {
|
if (gc_type == BG_GC && has_not_enough_free_secs(sbi, nfree)) {
|
||||||
|
|
|
@ -750,7 +750,7 @@ skip_partial:
|
||||||
if (offset[1] == 0 &&
|
if (offset[1] == 0 &&
|
||||||
rn->i.i_nid[offset[0] - NODE_DIR1_BLOCK]) {
|
rn->i.i_nid[offset[0] - NODE_DIR1_BLOCK]) {
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (page->mapping != node_mapping) {
|
if (unlikely(page->mapping != node_mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
@ -841,14 +841,14 @@ struct page *new_node_page(struct dnode_of_data *dn,
|
||||||
struct page *page;
|
struct page *page;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))
|
if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC)))
|
||||||
return ERR_PTR(-EPERM);
|
return ERR_PTR(-EPERM);
|
||||||
|
|
||||||
page = grab_cache_page(mapping, dn->nid);
|
page = grab_cache_page(mapping, dn->nid);
|
||||||
if (!page)
|
if (!page)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
if (!inc_valid_node_count(sbi, dn->inode)) {
|
if (unlikely(!inc_valid_node_count(sbi, dn->inode))) {
|
||||||
err = -ENOSPC;
|
err = -ENOSPC;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -898,7 +898,7 @@ static int read_node_page(struct page *page, int rw)
|
||||||
|
|
||||||
get_node_info(sbi, page->index, &ni);
|
get_node_info(sbi, page->index, &ni);
|
||||||
|
|
||||||
if (ni.blk_addr == NULL_ADDR) {
|
if (unlikely(ni.blk_addr == NULL_ADDR)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
@ -953,11 +953,11 @@ repeat:
|
||||||
goto got_it;
|
goto got_it;
|
||||||
|
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (!PageUptodate(page)) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
if (page->mapping != mapping) {
|
if (unlikely(page->mapping != mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
}
|
}
|
||||||
|
@ -1010,12 +1010,12 @@ repeat:
|
||||||
blk_finish_plug(&plug);
|
blk_finish_plug(&plug);
|
||||||
|
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if (page->mapping != mapping) {
|
if (unlikely(page->mapping != mapping)) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
goto repeat;
|
goto repeat;
|
||||||
}
|
}
|
||||||
page_hit:
|
page_hit:
|
||||||
if (!PageUptodate(page)) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
f2fs_put_page(page, 1);
|
f2fs_put_page(page, 1);
|
||||||
return ERR_PTR(-EIO);
|
return ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
|
@ -1173,9 +1173,9 @@ int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino)
|
||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_and_clear_bit(AS_ENOSPC, &mapping->flags))
|
if (unlikely(test_and_clear_bit(AS_ENOSPC, &mapping->flags)))
|
||||||
ret2 = -ENOSPC;
|
ret2 = -ENOSPC;
|
||||||
if (test_and_clear_bit(AS_EIO, &mapping->flags))
|
if (unlikely(test_and_clear_bit(AS_EIO, &mapping->flags)))
|
||||||
ret2 = -EIO;
|
ret2 = -EIO;
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = ret2;
|
ret = ret2;
|
||||||
|
@ -1202,7 +1202,7 @@ static int f2fs_write_node_page(struct page *page,
|
||||||
get_node_info(sbi, nid, &ni);
|
get_node_info(sbi, nid, &ni);
|
||||||
|
|
||||||
/* This page is already truncated */
|
/* This page is already truncated */
|
||||||
if (ni.blk_addr == NULL_ADDR) {
|
if (unlikely(ni.blk_addr == NULL_ADDR)) {
|
||||||
dec_page_count(sbi, F2FS_DIRTY_NODES);
|
dec_page_count(sbi, F2FS_DIRTY_NODES);
|
||||||
unlock_page(page);
|
unlock_page(page);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1627,14 +1627,14 @@ int restore_node_summary(struct f2fs_sb_info *sbi,
|
||||||
list_for_each_entry_safe(page, tmp, &page_list, lru) {
|
list_for_each_entry_safe(page, tmp, &page_list, lru) {
|
||||||
|
|
||||||
lock_page(page);
|
lock_page(page);
|
||||||
if(PageUptodate(page)) {
|
if (unlikely(!PageUptodate(page))) {
|
||||||
|
err = -EIO;
|
||||||
|
} else {
|
||||||
rn = F2FS_NODE(page);
|
rn = F2FS_NODE(page);
|
||||||
sum_entry->nid = rn->footer.nid;
|
sum_entry->nid = rn->footer.nid;
|
||||||
sum_entry->version = 0;
|
sum_entry->version = 0;
|
||||||
sum_entry->ofs_in_node = 0;
|
sum_entry->ofs_in_node = 0;
|
||||||
sum_entry++;
|
sum_entry++;
|
||||||
} else {
|
|
||||||
err = -EIO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list_del(&page->lru);
|
list_del(&page->lru);
|
||||||
|
|
|
@ -430,7 +430,7 @@ int recover_fsync_data(struct f2fs_sb_info *sbi)
|
||||||
|
|
||||||
fsync_entry_slab = f2fs_kmem_cache_create("f2fs_fsync_inode_entry",
|
fsync_entry_slab = f2fs_kmem_cache_create("f2fs_fsync_inode_entry",
|
||||||
sizeof(struct fsync_inode_entry), NULL);
|
sizeof(struct fsync_inode_entry), NULL);
|
||||||
if (unlikely(!fsync_entry_slab))
|
if (!fsync_entry_slab)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&inode_list);
|
INIT_LIST_HEAD(&inode_list);
|
||||||
|
|
|
@ -626,7 +626,7 @@ static struct inode *f2fs_nfs_get_inode(struct super_block *sb,
|
||||||
struct f2fs_sb_info *sbi = F2FS_SB(sb);
|
struct f2fs_sb_info *sbi = F2FS_SB(sb);
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
if (ino < F2FS_ROOT_INO(sbi))
|
if (unlikely(ino < F2FS_ROOT_INO(sbi)))
|
||||||
return ERR_PTR(-ESTALE);
|
return ERR_PTR(-ESTALE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -637,7 +637,7 @@ static struct inode *f2fs_nfs_get_inode(struct super_block *sb,
|
||||||
inode = f2fs_iget(sb, ino);
|
inode = f2fs_iget(sb, ino);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return ERR_CAST(inode);
|
return ERR_CAST(inode);
|
||||||
if (generation && inode->i_generation != generation) {
|
if (unlikely(generation && inode->i_generation != generation)) {
|
||||||
/* we didn't find the right inode.. */
|
/* we didn't find the right inode.. */
|
||||||
iput(inode);
|
iput(inode);
|
||||||
return ERR_PTR(-ESTALE);
|
return ERR_PTR(-ESTALE);
|
||||||
|
@ -740,10 +740,10 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi)
|
||||||
fsmeta += le32_to_cpu(ckpt->rsvd_segment_count);
|
fsmeta += le32_to_cpu(ckpt->rsvd_segment_count);
|
||||||
fsmeta += le32_to_cpu(raw_super->segment_count_ssa);
|
fsmeta += le32_to_cpu(raw_super->segment_count_ssa);
|
||||||
|
|
||||||
if (fsmeta >= total)
|
if (unlikely(fsmeta >= total))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (is_set_ckpt_flags(ckpt, CP_ERROR_FLAG)) {
|
if (unlikely(is_set_ckpt_flags(ckpt, CP_ERROR_FLAG))) {
|
||||||
f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck");
|
f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -808,7 +808,7 @@ retry:
|
||||||
brelse(*raw_super_buf);
|
brelse(*raw_super_buf);
|
||||||
f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem "
|
f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem "
|
||||||
"in %dth superblock", block + 1);
|
"in %dth superblock", block + 1);
|
||||||
if(block == 0) {
|
if (block == 0) {
|
||||||
block++;
|
block++;
|
||||||
goto retry;
|
goto retry;
|
||||||
} else {
|
} else {
|
||||||
|
@ -834,7 +834,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* set a block size */
|
/* set a block size */
|
||||||
if (!sb_set_blocksize(sb, F2FS_BLKSIZE)) {
|
if (unlikely(!sb_set_blocksize(sb, F2FS_BLKSIZE))) {
|
||||||
f2fs_msg(sb, KERN_ERR, "unable to set blocksize");
|
f2fs_msg(sb, KERN_ERR, "unable to set blocksize");
|
||||||
goto free_sbi;
|
goto free_sbi;
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1066,7 @@ static int __init init_inodecache(void)
|
||||||
{
|
{
|
||||||
f2fs_inode_cachep = f2fs_kmem_cache_create("f2fs_inode_cache",
|
f2fs_inode_cachep = f2fs_kmem_cache_create("f2fs_inode_cache",
|
||||||
sizeof(struct f2fs_inode_info), NULL);
|
sizeof(struct f2fs_inode_info), NULL);
|
||||||
if (f2fs_inode_cachep == NULL)
|
if (!f2fs_inode_cachep)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,7 +522,7 @@ static int __f2fs_setxattr(struct inode *inode, int name_index,
|
||||||
if (found)
|
if (found)
|
||||||
free = free + ENTRY_SIZE(here);
|
free = free + ENTRY_SIZE(here);
|
||||||
|
|
||||||
if (free < newsize) {
|
if (unlikely(free < newsize)) {
|
||||||
error = -ENOSPC;
|
error = -ENOSPC;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue