aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorGu Zheng <guz.fnst@cn.fujitsu.com>2014-01-10 18:09:08 +0800
committerrogersb11 <brettrogers11@gmail.com>2016-02-13 21:19:04 -0500
commit7c65ea7a446976b34ca8f0062f28f080a3b688da (patch)
treea86bce3989fbae6578e610fd00593b25043f40cf /fs
parent6f6ea5ff443dbe2ff4f8ae6edaf46a23a8a68d82 (diff)
downloadkernel_samsung_smdk4412-7c65ea7a446976b34ca8f0062f28f080a3b688da.tar.gz
kernel_samsung_smdk4412-7c65ea7a446976b34ca8f0062f28f080a3b688da.tar.bz2
kernel_samsung_smdk4412-7c65ea7a446976b34ca8f0062f28f080a3b688da.zip
f2fs: move alloc new orphan node out of lock protection region
Move alloc new orphan node out of lock protection region. Change-Id: Iea8bae6e1561e1a0644416ae07177c8f165e5393 Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/checkpoint.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 0d78bbe79f9..0dcf88f4060 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -219,26 +219,29 @@ void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
struct list_head *head, *this;
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);
head = &sbi->orphan_inode_list;
list_for_each(this, head) {
orphan = list_entry(this, struct orphan_inode_entry, list);
- if (orphan->ino == ino)
- goto out;
+ if (orphan->ino == ino) {
+ mutex_unlock(&sbi->orphan_inode_mutex);
+ kmem_cache_free(orphan_entry_slab, new);
+ return;
+ }
+
if (orphan->ino > ino)
break;
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 */
if (orphan)
list_add(&new->list, this->prev);
else
list_add_tail(&new->list, head);
-out:
mutex_unlock(&sbi->orphan_inode_mutex);
}