diff options
author | majianpeng <majianpeng@gmail.com> | 2013-01-29 03:19:02 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-02-11 17:15:00 -0500 |
commit | a2617dc6863b21a8109c199ab533b3dbfe178f27 (patch) | |
tree | b628ad6d5ada7b4d05fc48d55dae50834da4e9d6 /fs/f2fs | |
parent | aa43507f68e44fbc014d820e47eda5a369b8dc9d (diff) |
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/checkpoint.c | 16 |
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: | |||
219 | new->ino = ino; | 219 | new->ino = ino; |
220 | 220 | ||
221 | /* add new_oentry into list which is sorted by inode number */ | 221 | /* add new_oentry into list which is sorted by inode number */ |
222 | if (orphan) { | 222 | if (orphan) |
223 | struct orphan_inode_entry *prev; | 223 | list_add(&new->list, this->prev); |
224 | 224 | else | |
225 | /* get previous entry */ | ||
226 | prev = list_entry(orphan->list.prev, typeof(*prev), list); | ||
227 | if (&prev->list != head) | ||
228 | /* insert new orphan inode entry */ | ||
229 | list_add(&new->list, &prev->list); | ||
230 | else | ||
231 | list_add(&new->list, head); | ||
232 | } else { | ||
233 | list_add_tail(&new->list, head); | 225 | list_add_tail(&new->list, head); |
234 | } | 226 | |
235 | sbi->n_orphans++; | 227 | sbi->n_orphans++; |
236 | out: | 228 | out: |
237 | mutex_unlock(&sbi->orphan_inode_mutex); | 229 | mutex_unlock(&sbi->orphan_inode_mutex); |