f2fs: clean up the add_orphan_inode func
authormajianpeng <majianpeng@gmail.com>
Tue, 29 Jan 2013 08:19:02 +0000 (16:19 +0800)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 11 Feb 2013 22:15:00 +0000 (07:15 +0900)
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>
fs/f2fs/checkpoint.c

index 9c16271650397c58041826136fe0af7d0f2db5b1..d3b34d05211f9b246ff10cfd01e930457a7e5e7a 100644 (file)
@@ -219,19 +219,11 @@ retry:
        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);