Skip to content

Commit

Permalink
f2fs: use _safe() version of list_for_each
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Jaegeuk Kim committed Jan 22, 2013
1 parent 9af45ef commit d8b79b2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/f2fs/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,9 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)
static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi,
struct list_head *head)
{
struct list_head *this;
struct fsync_inode_entry *entry;
list_for_each(this, head) {
entry = list_entry(this, struct fsync_inode_entry, list);
struct fsync_inode_entry *entry, *tmp;

list_for_each_entry_safe(entry, tmp, head, list) {
iput(entry->inode);
list_del(&entry->list);
kmem_cache_free(fsync_entry_slab, entry);
Expand Down

0 comments on commit d8b79b2

Please sign in to comment.