dect
/
linux-2.6
Archived
13
0
Fork 0

f2fs: use _safe() version of list_for_each

This is calling list_del() inside a loop which is a problem when we try
move to the next item on the list.  I've converted it to use the _safe
version.  And also, as a cleanup, I've converted it to use
list_for_each_entry instead of list_for_each.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
Dan Carpenter 2013-01-20 18:02:58 +03:00 committed by Jaegeuk Kim
parent 9af45ef5ab
commit d8b79b2f94
1 changed files with 3 additions and 4 deletions

View File

@ -173,10 +173,9 @@ out:
static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi, static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi,
struct list_head *head) struct list_head *head)
{ {
struct list_head *this; struct fsync_inode_entry *entry, *tmp;
struct fsync_inode_entry *entry;
list_for_each(this, head) { list_for_each_entry_safe(entry, tmp, head, list) {
entry = list_entry(this, struct fsync_inode_entry, list);
iput(entry->inode); iput(entry->inode);
list_del(&entry->list); list_del(&entry->list);
kmem_cache_free(fsync_entry_slab, entry); kmem_cache_free(fsync_entry_slab, entry);