Skip to content

Commit

Permalink
f2fs: code cleanup and simplify in func {find/add}_gc_inode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gu Zheng authored and Jaegeuk Kim committed Jul 1, 2013
1 parent 8736fbf commit 6cc4af5
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions fs/f2fs/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,28 +321,21 @@ static const struct victim_selection default_v_ops = {

static struct inode *find_gc_inode(nid_t ino, struct list_head *ilist)
{
struct list_head *this;
struct inode_entry *ie;

list_for_each(this, ilist) {
ie = list_entry(this, struct inode_entry, list);
list_for_each_entry(ie, ilist, list)
if (ie->inode->i_ino == ino)
return ie->inode;
}
return NULL;
}

static void add_gc_inode(struct inode *inode, struct list_head *ilist)
{
struct list_head *this;
struct inode_entry *new_ie, *ie;
struct inode_entry *new_ie;

list_for_each(this, ilist) {
ie = list_entry(this, struct inode_entry, list);
if (ie->inode == inode) {
iput(inode);
return;
}
if (inode == find_gc_inode(inode->i_ino, ilist)) {
iput(inode);
return;
}
repeat:
new_ie = kmem_cache_alloc(winode_slab, GFP_NOFS);
Expand Down

0 comments on commit 6cc4af5

Please sign in to comment.