f2fs: clean up the add_orphan_inode func
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>
This commit is contained in:
parent
aa43507f68
commit
a2617dc686
1 changed files with 4 additions and 12 deletions
|
@ -219,19 +219,11 @@ void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino)
|
||||||
new->ino = ino;
|
new->ino = ino;
|
||||||
|
|
||||||
/* add new_oentry into list which is sorted by inode number */
|
/* add new_oentry into list which is sorted by inode number */
|
||||||
if (orphan) {
|
if (orphan)
|
||||||
struct orphan_inode_entry *prev;
|
list_add(&new->list, this->prev);
|
||||||
|
else
|
||||||
/* 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 {
|
|
||||||
list_add_tail(&new->list, head);
|
list_add_tail(&new->list, head);
|
||||||
}
|
|
||||||
sbi->n_orphans++;
|
sbi->n_orphans++;
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&sbi->orphan_inode_mutex);
|
mutex_unlock(&sbi->orphan_inode_mutex);
|
||||||
|
|
Loading…
Add table
Reference in a new issue