diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-01-27 22:22:14 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-17 00:58:52 -0500 |
commit | 5e443818fa0b2a2845561ee25bec181424fb2889 (patch) | |
tree | 726b5608e5d9ac845144ee0294d2a8fc55a59589 | |
parent | 744602cf45ce35758b8637f76bc263c871abc6ea (diff) |
f2fs: handle dirty segments inside refresh_sit_entry
This patch cleans up the refresh_sit_entry to handle locate_dirty_segments.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
-rw-r--r-- | fs/f2fs/f2fs.h | 1 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 24 |
2 files changed, 11 insertions, 14 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 0f0ad3aa148a..3f223aa64a57 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -1136,6 +1136,7 @@ void destroy_node_manager_caches(void); | |||
1136 | void f2fs_balance_fs(struct f2fs_sb_info *); | 1136 | void f2fs_balance_fs(struct f2fs_sb_info *); |
1137 | void f2fs_balance_fs_bg(struct f2fs_sb_info *); | 1137 | void f2fs_balance_fs_bg(struct f2fs_sb_info *); |
1138 | void invalidate_blocks(struct f2fs_sb_info *, block_t); | 1138 | void invalidate_blocks(struct f2fs_sb_info *, block_t); |
1139 | void refresh_sit_entry(struct f2fs_sb_info *, block_t, block_t); | ||
1139 | void clear_prefree_segments(struct f2fs_sb_info *); | 1140 | void clear_prefree_segments(struct f2fs_sb_info *); |
1140 | int npages_for_summary_flush(struct f2fs_sb_info *); | 1141 | int npages_for_summary_flush(struct f2fs_sb_info *); |
1141 | void allocate_new_segments(struct f2fs_sb_info *); | 1142 | void allocate_new_segments(struct f2fs_sb_info *); |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 7caac5f2ca9e..fba510b2f217 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -434,12 +434,14 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) | |||
434 | get_sec_entry(sbi, segno)->valid_blocks += del; | 434 | get_sec_entry(sbi, segno)->valid_blocks += del; |
435 | } | 435 | } |
436 | 436 | ||
437 | static void refresh_sit_entry(struct f2fs_sb_info *sbi, | 437 | void refresh_sit_entry(struct f2fs_sb_info *sbi, block_t old, block_t new) |
438 | block_t old_blkaddr, block_t new_blkaddr) | ||
439 | { | 438 | { |
440 | update_sit_entry(sbi, new_blkaddr, 1); | 439 | update_sit_entry(sbi, new, 1); |
441 | if (GET_SEGNO(sbi, old_blkaddr) != NULL_SEGNO) | 440 | if (GET_SEGNO(sbi, old) != NULL_SEGNO) |
442 | update_sit_entry(sbi, old_blkaddr, -1); | 441 | update_sit_entry(sbi, old, -1); |
442 | |||
443 | locate_dirty_segment(sbi, GET_SEGNO(sbi, old)); | ||
444 | locate_dirty_segment(sbi, GET_SEGNO(sbi, new)); | ||
443 | } | 445 | } |
444 | 446 | ||
445 | void invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr) | 447 | void invalidate_blocks(struct f2fs_sb_info *sbi, block_t addr) |
@@ -881,17 +883,15 @@ void allocate_data_block(struct f2fs_sb_info *sbi, struct page *page, | |||
881 | 883 | ||
882 | stat_inc_block_count(sbi, curseg); | 884 | stat_inc_block_count(sbi, curseg); |
883 | 885 | ||
886 | if (!__has_curseg_space(sbi, type)) | ||
887 | sit_i->s_ops->allocate_segment(sbi, type, false); | ||
884 | /* | 888 | /* |
885 | * SIT information should be updated before segment allocation, | 889 | * SIT information should be updated before segment allocation, |
886 | * since SSR needs latest valid block information. | 890 | * since SSR needs latest valid block information. |
887 | */ | 891 | */ |
888 | refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); | 892 | refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr); |
889 | |||
890 | if (!__has_curseg_space(sbi, type)) | ||
891 | sit_i->s_ops->allocate_segment(sbi, type, false); | ||
892 | |||
893 | locate_dirty_segment(sbi, old_cursegno); | 893 | locate_dirty_segment(sbi, old_cursegno); |
894 | locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); | 894 | |
895 | mutex_unlock(&sit_i->sentry_lock); | 895 | mutex_unlock(&sit_i->sentry_lock); |
896 | 896 | ||
897 | if (page && IS_NODESEG(type)) | 897 | if (page && IS_NODESEG(type)) |
@@ -992,9 +992,7 @@ void recover_data_page(struct f2fs_sb_info *sbi, | |||
992 | __add_sum_entry(sbi, type, sum); | 992 | __add_sum_entry(sbi, type, sum); |
993 | 993 | ||
994 | refresh_sit_entry(sbi, old_blkaddr, new_blkaddr); | 994 | refresh_sit_entry(sbi, old_blkaddr, new_blkaddr); |
995 | |||
996 | locate_dirty_segment(sbi, old_cursegno); | 995 | locate_dirty_segment(sbi, old_cursegno); |
997 | locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); | ||
998 | 996 | ||
999 | mutex_unlock(&sit_i->sentry_lock); | 997 | mutex_unlock(&sit_i->sentry_lock); |
1000 | mutex_unlock(&curseg->curseg_mutex); | 998 | mutex_unlock(&curseg->curseg_mutex); |
@@ -1045,9 +1043,7 @@ void rewrite_node_page(struct f2fs_sb_info *sbi, | |||
1045 | f2fs_submit_page_mbio(sbi, page, new_blkaddr, &fio); | 1043 | f2fs_submit_page_mbio(sbi, page, new_blkaddr, &fio); |
1046 | f2fs_submit_merged_bio(sbi, NODE, WRITE); | 1044 | f2fs_submit_merged_bio(sbi, NODE, WRITE); |
1047 | refresh_sit_entry(sbi, old_blkaddr, new_blkaddr); | 1045 | refresh_sit_entry(sbi, old_blkaddr, new_blkaddr); |
1048 | |||
1049 | locate_dirty_segment(sbi, old_cursegno); | 1046 | locate_dirty_segment(sbi, old_cursegno); |
1050 | locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); | ||
1051 | 1047 | ||
1052 | mutex_unlock(&sit_i->sentry_lock); | 1048 | mutex_unlock(&sit_i->sentry_lock); |
1053 | mutex_unlock(&curseg->curseg_mutex); | 1049 | mutex_unlock(&curseg->curseg_mutex); |