summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormajianpeng <majianpeng@gmail.com>2013-01-29 16:19:02 +0800
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-02-12 07:15:00 +0900
commita2617dc6863b21a8109c199ab533b3dbfe178f27 (patch)
treeb628ad6d5ada7b4d05fc48d55dae50834da4e9d6
parentaa43507f68e44fbc014d820e47eda5a369b8dc9d (diff)
downloadlinux-stable-a2617dc6863b21a8109c199ab533b3dbfe178f27.tar.gz
linux-stable-a2617dc6863b21a8109c199ab533b3dbfe178f27.tar.bz2
linux-stable-a2617dc6863b21a8109c199ab533b3dbfe178f27.zip
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>
-rw-r--r--fs/f2fs/checkpoint.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 9c1627165039..d3b34d05211f 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -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);