diff options
-rw-r--r-- | fs/f2fs/gc.c | 7 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 13 |
2 files changed, 6 insertions, 14 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index b90dbe55403a..d7947d90ccc3 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -186,7 +186,6 @@ static unsigned int get_max_cost(struct f2fs_sb_info *sbi, | |||
186 | static unsigned int check_bg_victims(struct f2fs_sb_info *sbi) | 186 | static unsigned int check_bg_victims(struct f2fs_sb_info *sbi) |
187 | { | 187 | { |
188 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); | 188 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); |
189 | unsigned int hint = 0; | ||
190 | unsigned int secno; | 189 | unsigned int secno; |
191 | 190 | ||
192 | /* | 191 | /* |
@@ -194,11 +193,9 @@ static unsigned int check_bg_victims(struct f2fs_sb_info *sbi) | |||
194 | * selected by background GC before. | 193 | * selected by background GC before. |
195 | * Those segments guarantee they have small valid blocks. | 194 | * Those segments guarantee they have small valid blocks. |
196 | */ | 195 | */ |
197 | next: | 196 | for_each_set_bit(secno, dirty_i->victim_secmap, TOTAL_SECS(sbi)) { |
198 | secno = find_next_bit(dirty_i->victim_secmap, TOTAL_SECS(sbi), hint++); | ||
199 | if (secno < TOTAL_SECS(sbi)) { | ||
200 | if (sec_usage_check(sbi, secno)) | 197 | if (sec_usage_check(sbi, secno)) |
201 | goto next; | 198 | continue; |
202 | clear_bit(secno, dirty_i->victim_secmap); | 199 | clear_bit(secno, dirty_i->victim_secmap); |
203 | return secno * sbi->segs_per_sec; | 200 | return secno * sbi->segs_per_sec; |
204 | } | 201 | } |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index c3b76d091450..0dfeebae2a50 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -439,17 +439,12 @@ static void add_discard_addrs(struct f2fs_sb_info *sbi, | |||
439 | static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi) | 439 | static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi) |
440 | { | 440 | { |
441 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); | 441 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); |
442 | unsigned int segno = -1; | 442 | unsigned int segno; |
443 | unsigned int total_segs = TOTAL_SEGS(sbi); | 443 | unsigned int total_segs = TOTAL_SEGS(sbi); |
444 | 444 | ||
445 | mutex_lock(&dirty_i->seglist_lock); | 445 | mutex_lock(&dirty_i->seglist_lock); |
446 | while (1) { | 446 | for_each_set_bit(segno, dirty_i->dirty_segmap[PRE], total_segs) |
447 | segno = find_next_bit(dirty_i->dirty_segmap[PRE], total_segs, | ||
448 | segno + 1); | ||
449 | if (segno >= total_segs) | ||
450 | break; | ||
451 | __set_test_and_free(sbi, segno); | 447 | __set_test_and_free(sbi, segno); |
452 | } | ||
453 | mutex_unlock(&dirty_i->seglist_lock); | 448 | mutex_unlock(&dirty_i->seglist_lock); |
454 | } | 449 | } |
455 | 450 | ||
@@ -1531,7 +1526,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi) | |||
1531 | struct page *page = NULL; | 1526 | struct page *page = NULL; |
1532 | struct f2fs_sit_block *raw_sit = NULL; | 1527 | struct f2fs_sit_block *raw_sit = NULL; |
1533 | unsigned int start = 0, end = 0; | 1528 | unsigned int start = 0, end = 0; |
1534 | unsigned int segno = -1; | 1529 | unsigned int segno; |
1535 | bool flushed; | 1530 | bool flushed; |
1536 | 1531 | ||
1537 | mutex_lock(&curseg->curseg_mutex); | 1532 | mutex_lock(&curseg->curseg_mutex); |
@@ -1543,7 +1538,7 @@ void flush_sit_entries(struct f2fs_sb_info *sbi) | |||
1543 | */ | 1538 | */ |
1544 | flushed = flush_sits_in_journal(sbi); | 1539 | flushed = flush_sits_in_journal(sbi); |
1545 | 1540 | ||
1546 | while ((segno = find_next_bit(bitmap, nsegs, segno + 1)) < nsegs) { | 1541 | for_each_set_bit(segno, bitmap, nsegs) { |
1547 | struct seg_entry *se = get_seg_entry(sbi, segno); | 1542 | struct seg_entry *se = get_seg_entry(sbi, segno); |
1548 | int sit_offset, offset; | 1543 | int sit_offset, offset; |
1549 | 1544 | ||