summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorGu Zheng <guz.fnst@cn.fujitsu.com>2013-06-20 17:52:39 +0800
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-07-02 08:48:14 +0900
commit6cc4af56066d8e9c62584cf61c6ce50fd0ab139a (patch)
tree6c81f17214074817227aad29eb8c0df74dfd1194 /fs/f2fs
parent8736fbf00372dcc0bc7b04b86d737eb5db31fff6 (diff)
downloadop-kernel-dev-6cc4af56066d8e9c62584cf61c6ce50fd0ab139a.zip
op-kernel-dev-6cc4af56066d8e9c62584cf61c6ce50fd0ab139a.tar.gz
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/gc.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 3a9df36..35f9b1a 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -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);
OpenPOWER on IntegriCloud