aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChangman Lee <cm224.lee@samsung.com>2013-10-25 04:31:57 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-10-28 00:38:16 -0400
commit4625d6aac2d00a18f7bcc15bffe41e9de3a25332 (patch)
tree48843832b9a1b2e17e9962d0873d0be10c1be3cb /fs/f2fs/segment.c
parente943a10d94f6076f7bc8da91828cbdca5fbf62fc (diff)
f2fs: remove unnecessary segment bitmap updates
Only one dirty type is set in __locate_dirty_segment and we can know dirty type of segment. So we don't need to check other dirty types. Signed-off-by: Changman Lee <cm224.lee@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 487af619aeda..8f92c18a01fb 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -58,20 +58,10 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
58 58
59 if (dirty_type == DIRTY) { 59 if (dirty_type == DIRTY) {
60 struct seg_entry *sentry = get_seg_entry(sbi, segno); 60 struct seg_entry *sentry = get_seg_entry(sbi, segno);
61 enum dirty_type t = DIRTY_HOT_DATA; 61 enum dirty_type t = sentry->type;
62 62
63 dirty_type = sentry->type; 63 if (!test_and_set_bit(segno, dirty_i->dirty_segmap[t]))
64 64 dirty_i->nr_dirty[t]++;
65 if (!test_and_set_bit(segno, dirty_i->dirty_segmap[dirty_type]))
66 dirty_i->nr_dirty[dirty_type]++;
67
68 /* Only one bitmap should be set */
69 for (; t <= DIRTY_COLD_NODE; t++) {
70 if (t == dirty_type)
71 continue;
72 if (test_and_clear_bit(segno, dirty_i->dirty_segmap[t]))
73 dirty_i->nr_dirty[t]--;
74 }
75 } 65 }
76} 66}
77 67
@@ -84,16 +74,11 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
84 dirty_i->nr_dirty[dirty_type]--; 74 dirty_i->nr_dirty[dirty_type]--;
85 75
86 if (dirty_type == DIRTY) { 76 if (dirty_type == DIRTY) {
87 enum dirty_type t = DIRTY_HOT_DATA; 77 struct seg_entry *sentry = get_seg_entry(sbi, segno);
88 78 enum dirty_type t = sentry->type;
89 /* clear its dirty bitmap */ 79
90 for (; t <= DIRTY_COLD_NODE; t++) { 80 if (test_and_clear_bit(segno, dirty_i->dirty_segmap[t]))
91 if (test_and_clear_bit(segno, 81 dirty_i->nr_dirty[t]--;
92 dirty_i->dirty_segmap[t])) {
93 dirty_i->nr_dirty[t]--;
94 break;
95 }
96 }
97 82
98 if (get_valid_blocks(sbi, segno, sbi->segs_per_sec) == 0) 83 if (get_valid_blocks(sbi, segno, sbi->segs_per_sec) == 0)
99 clear_bit(GET_SECNO(sbi, segno), 84 clear_bit(GET_SECNO(sbi, segno),