f2fs: code cleanup and simplify in func {find/add}_gc_inode
This patch simplifies list operations in find_gc_inode and add_gc_inode. Just simple code cleanup. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> [Jaegeuk Kim: add description] Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
8736fbf003
commit
6cc4af5606
13
fs/f2fs/gc.c
13
fs/f2fs/gc.c
|
@ -321,29 +321,22 @@ static const struct victim_selection default_v_ops = {
|
||||||
|
|
||||||
static struct inode *find_gc_inode(nid_t ino, struct list_head *ilist)
|
static struct inode *find_gc_inode(nid_t ino, struct list_head *ilist)
|
||||||
{
|
{
|
||||||
struct list_head *this;
|
|
||||||
struct inode_entry *ie;
|
struct inode_entry *ie;
|
||||||
|
|
||||||
list_for_each(this, ilist) {
|
list_for_each_entry(ie, ilist, list)
|
||||||
ie = list_entry(this, struct inode_entry, list);
|
|
||||||
if (ie->inode->i_ino == ino)
|
if (ie->inode->i_ino == ino)
|
||||||
return ie->inode;
|
return ie->inode;
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_gc_inode(struct inode *inode, struct list_head *ilist)
|
static void add_gc_inode(struct inode *inode, struct list_head *ilist)
|
||||||
{
|
{
|
||||||
struct list_head *this;
|
struct inode_entry *new_ie;
|
||||||
struct inode_entry *new_ie, *ie;
|
|
||||||
|
|
||||||
list_for_each(this, ilist) {
|
if (inode == find_gc_inode(inode->i_ino, ilist)) {
|
||||||
ie = list_entry(this, struct inode_entry, list);
|
|
||||||
if (ie->inode == inode) {
|
|
||||||
iput(inode);
|
iput(inode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
repeat:
|
repeat:
|
||||||
new_ie = kmem_cache_alloc(winode_slab, GFP_NOFS);
|
new_ie = kmem_cache_alloc(winode_slab, GFP_NOFS);
|
||||||
if (!new_ie) {
|
if (!new_ie) {
|
||||||
|
|
Loading…
Reference in New Issue