[<prev] [next>] [day] [month] [year] [list]
Message-ID: <51C2D0E7.3020403@cn.fujitsu.com>
Date: Thu, 20 Jun 2013 17:52:39 +0800
From: Gu Zheng <guz.fnst@...fujitsu.com>
To: jaegeuk.kim@...sung.com
CC: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel <linux-kernel@...r.kernel.org>,
guz.fnst@...fujitsu.com
Subject: [PATCH] fs/f2fs: Code cleanup and simplify in func {find/add}_gc_inode
Signed-off-by: Gu Zheng <guz.fnst@...fujitsu.com>
---
fs/f2fs/gc.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 1496159..0b8b439 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -314,28 +314,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);
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists