diff options
author | Dongho Sim <dh.sim@samsung.com> | 2014-07-30 02:52:41 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-07-30 18:38:59 -0400 |
commit | 33be828ada7274ebcade2001f16e5b4e33a4636e (patch) | |
tree | 52cd85e9e0f6eb23c68ab6a75ad904603381c19d /fs | |
parent | 24a9ee0fa3d40415765d2d9f6064930d72ad8b5a (diff) |
f2fs: remove redundant lines in allocate_data_block
There are redundant lines in allocate_data_block.
In this function, we call refresh_sit_entry with old seg and old curseg.
After that, we call locate_dirty_segment with old curseg.
But, the new address is always allocated from old curseg and
we call locate_dirty_segment with old curseg in refresh_sit_entry.
So, we do not need to call locate_dirty_segment with old curseg again.
We've discussed like below:
Jaegeuk said:
"When considering SSR, we need to take care of the following scenario.
- old segno : X
- new address : Z
- old curseg : Y
This means, a new block is supposed to be written to Z from X.
And Z is newly allocated in the same path from Y.
In that case, we should trigger locate_dirty_segment for Y, since
it was a current_segment and can be dirty owing to SSR.
But that was not included in the dirty list."
Changman said:
"We already choosed old curseg(Y) and then we allocate new address(Z) from old
curseg(Y). After that we call refresh_sit_entry(old address, new address).
In the funcation, we call locate_dirty_segment with old seg and old curseg.
So calling locate_dirty_segment after refresh_sit_entry again is redundant."
Jaegeuk said:
"Right. The new address is always allocated from old_curseg."
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Dongho Sim <dh.sim@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/f2fs/segment.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 5a53a0ac6e4f..c3b76d091450 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -976,14 +976,12 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, | |||
976 | { | 976 | { |
977 | struct sit_info *sit_i = SIT_I(sbi); | 977 | struct sit_info *sit_i = SIT_I(sbi); |
978 | struct curseg_info *curseg; | 978 | struct curseg_info *curseg; |
979 | unsigned int old_cursegno; | ||
980 | 979 | ||
981 | curseg = CURSEG_I(sbi, type); | 980 | curseg = CURSEG_I(sbi, type); |
982 | 981 | ||
983 | mutex_lock(&curseg->curseg_mutex); | 982 | mutex_lock(&curseg->curseg_mutex); |
984 | 983 | ||
985 | *new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); | 984 | *new_blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); |
986 | old_cursegno = curseg->segno; | ||
987 | 985 | ||
988 | /* | 986 | /* |
989 | * __add_sum_entry should be resided under the curseg_mutex | 987 | * __add_sum_entry should be resided under the curseg_mutex |
@@ -1004,7 +1002,6 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, | |||
1004 | * since SSR needs latest valid block information. | 1002 | * since SSR needs latest valid block information. |
1005 | */ | 1003 | */ |
1006 | refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); | 1004 | refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); |
1007 | locate_dirty_segment(sbi, old_cursegno); | ||
1008 | 1005 | ||
1009 | mutex_unlock(&sit_i->sentry_lock); | 1006 | mutex_unlock(&sit_i->sentry_lock); |
1010 | 1007 | ||