diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2013-06-20 05:52:39 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-07-01 19:48:14 -0400 |
commit | 6cc4af56066d8e9c62584cf61c6ce50fd0ab139a (patch) | |
tree | 6c81f17214074817227aad29eb8c0df74dfd1194 /fs/f2fs | |
parent | 8736fbf00372dcc0bc7b04b86d737eb5db31fff6 (diff) |
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.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 3a9df36491a5..35f9b1a196aa 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -321,28 +321,21 @@ static const struct victim_selection default_v_ops = { | |||
321 | 321 | ||
322 | static struct inode *find_gc_inode(nid_t ino, struct list_head *ilist) | 322 | static struct inode *find_gc_inode(nid_t ino, struct list_head *ilist) |
323 | { | 323 | { |
324 | struct list_head *this; | ||
325 | struct inode_entry *ie; | 324 | struct inode_entry *ie; |
326 | 325 | ||
327 | list_for_each(this, ilist) { | 326 | list_for_each_entry(ie, ilist, list) |
328 | ie = list_entry(this, struct inode_entry, list); | ||
329 | if (ie->inode->i_ino == ino) | 327 | if (ie->inode->i_ino == ino) |
330 | return ie->inode; | 328 | return ie->inode; |
331 | } | ||
332 | return NULL; | 329 | return NULL; |
333 | } | 330 | } |
334 | 331 | ||
335 | static void add_gc_inode(struct inode *inode, struct list_head *ilist) | 332 | static void add_gc_inode(struct inode *inode, struct list_head *ilist) |
336 | { | 333 | { |
337 | struct list_head *this; | 334 | struct inode_entry *new_ie; |
338 | struct inode_entry *new_ie, *ie; | ||
339 | 335 | ||
340 | list_for_each(this, ilist) { | 336 | if (inode == find_gc_inode(inode->i_ino, ilist)) { |
341 | ie = list_entry(this, struct inode_entry, list); | 337 | iput(inode); |
342 | if (ie->inode == inode) { | 338 | return; |
343 | iput(inode); | ||
344 | return; | ||
345 | } | ||
346 | } | 339 | } |
347 | repeat: | 340 | repeat: |
348 | new_ie = kmem_cache_alloc(winode_slab, GFP_NOFS); | 341 | new_ie = kmem_cache_alloc(winode_slab, GFP_NOFS); |