Skip to content

Commit

Permalink
f2fs: clean up the add_orphan_inode func
Browse files Browse the repository at this point in the history
For the code
> prev = list_entry(orphan->list.prev, typeof(*prev), list);
if orphan->list.prev == head, it can't get the right prev.
And we can use the parameter 'this' to add.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
  • Loading branch information
majianpeng authored and Jaegeuk Kim committed Feb 11, 2013
1 parent aa43507 commit a2617dc
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions fs/f2fs/checkpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,11 @@ void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
new->ino = ino;

/* add new_oentry into list which is sorted by inode number */
if (orphan) {
struct orphan_inode_entry *prev;

/* get previous entry */
prev = list_entry(orphan->list.prev, typeof(*prev), list);
if (&prev->list != head)
/* insert new orphan inode entry */
list_add(&new->list, &prev->list);
else
list_add(&new->list, head);
} else {
if (orphan)
list_add(&new->list, this->prev);
else
list_add_tail(&new->list, head);
}

sbi->n_orphans++;
out:
mutex_unlock(&sbi->orphan_inode_mutex);
Expand Down

0 comments on commit a2617dc

Please sign in to comment.