Commit c1ef3725 authored by Gu Zheng's avatar Gu Zheng Committed by Jaegeuk Kim

f2fs: move alloc new orphan node out of lock protection region

Move alloc new orphan node out of lock protection region.
Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk.kim@samsung.com>
parent 4531929e
...@@ -219,26 +219,29 @@ void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) ...@@ -219,26 +219,29 @@ void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
struct list_head *head, *this; struct list_head *head, *this;
struct orphan_inode_entry *new = NULL, *orphan = NULL; struct orphan_inode_entry *new = NULL, *orphan = NULL;
new = f2fs_kmem_cache_alloc(orphan_entry_slab, GFP_ATOMIC);
new->ino = ino;
mutex_lock(&sbi->orphan_inode_mutex); mutex_lock(&sbi->orphan_inode_mutex);
head = &sbi->orphan_inode_list; head = &sbi->orphan_inode_list;
list_for_each(this, head) { list_for_each(this, head) {
orphan = list_entry(this, struct orphan_inode_entry, list); orphan = list_entry(this, struct orphan_inode_entry, list);
if (orphan->ino == ino) if (orphan->ino == ino) {
goto out; mutex_unlock(&sbi->orphan_inode_mutex);
kmem_cache_free(orphan_entry_slab, new);
return;
}
if (orphan->ino > ino) if (orphan->ino > ino)
break; break;
orphan = NULL; orphan = NULL;
} }
new = f2fs_kmem_cache_alloc(orphan_entry_slab, GFP_ATOMIC);
new->ino = ino;
/* add new_oentry into list which is sorted by inode number */ /* add new_oentry into list which is sorted by inode number */
if (orphan) if (orphan)
list_add(&new->list, this->prev); list_add(&new->list, this->prev);
else else
list_add_tail(&new->list, head); list_add_tail(&new->list, head);
out:
mutex_unlock(&sbi->orphan_inode_mutex); mutex_unlock(&sbi->orphan_inode_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment