gc.c (274bd9ba39425610fdb9a6827602197a5cd27cd8) | gc.c (4354994f097d068a894aa1a0860da54571df3582) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/gc.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 356 unchanged lines hidden (view full) --- 365 } else { 366 nsearched++; 367 } 368 369 secno = GET_SEC_FROM_SEG(sbi, segno); 370 371 if (sec_usage_check(sbi, secno)) 372 goto next; | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * fs/f2fs/gc.c 4 * 5 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 6 * http://www.samsung.com/ 7 */ 8#include <linux/fs.h> --- 356 unchanged lines hidden (view full) --- 365 } else { 366 nsearched++; 367 } 368 369 secno = GET_SEC_FROM_SEG(sbi, segno); 370 371 if (sec_usage_check(sbi, secno)) 372 goto next; |
373 /* Don't touch checkpointed data */ 374 if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED) && 375 get_ckpt_valid_blocks(sbi, segno))) 376 goto next; |
|
373 if (gc_type == BG_GC && test_bit(secno, dirty_i->victim_secmap)) 374 goto next; 375 376 cost = get_gc_cost(sbi, segno, &p); 377 378 if (p.min_cost > cost) { 379 p.min_segno = segno; 380 p.min_cost = cost; --- 803 unchanged lines hidden (view full) --- 1184 } 1185 1186 if (gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) { 1187 /* 1188 * For example, if there are many prefree_segments below given 1189 * threshold, we can make them free by checkpoint. Then, we 1190 * secure free segments which doesn't need fggc any more. 1191 */ | 377 if (gc_type == BG_GC && test_bit(secno, dirty_i->victim_secmap)) 378 goto next; 379 380 cost = get_gc_cost(sbi, segno, &p); 381 382 if (p.min_cost > cost) { 383 p.min_segno = segno; 384 p.min_cost = cost; --- 803 unchanged lines hidden (view full) --- 1188 } 1189 1190 if (gc_type == BG_GC && has_not_enough_free_secs(sbi, 0, 0)) { 1191 /* 1192 * For example, if there are many prefree_segments below given 1193 * threshold, we can make them free by checkpoint. Then, we 1194 * secure free segments which doesn't need fggc any more. 1195 */ |
1192 if (prefree_segments(sbi)) { | 1196 if (prefree_segments(sbi) && 1197 !is_sbi_flag_set(sbi, SBI_CP_DISABLED)) { |
1193 ret = f2fs_write_checkpoint(sbi, &cpc); 1194 if (ret) 1195 goto stop; 1196 } 1197 if (has_not_enough_free_secs(sbi, 0, 0)) 1198 gc_type = FG_GC; 1199 } 1200 --- 35 unchanged lines hidden (view full) --- 1236 1237 if (first_skipped < last_skipped && 1238 (last_skipped - first_skipped) > 1239 sbi->skipped_gc_rwsem) { 1240 f2fs_drop_inmem_pages_all(sbi, true); 1241 segno = NULL_SEGNO; 1242 goto gc_more; 1243 } | 1198 ret = f2fs_write_checkpoint(sbi, &cpc); 1199 if (ret) 1200 goto stop; 1201 } 1202 if (has_not_enough_free_secs(sbi, 0, 0)) 1203 gc_type = FG_GC; 1204 } 1205 --- 35 unchanged lines hidden (view full) --- 1241 1242 if (first_skipped < last_skipped && 1243 (last_skipped - first_skipped) > 1244 sbi->skipped_gc_rwsem) { 1245 f2fs_drop_inmem_pages_all(sbi, true); 1246 segno = NULL_SEGNO; 1247 goto gc_more; 1248 } |
1244 if (gc_type == FG_GC) | 1249 if (gc_type == FG_GC && !is_sbi_flag_set(sbi, SBI_CP_DISABLED)) |
1245 ret = f2fs_write_checkpoint(sbi, &cpc); 1246 } 1247stop: 1248 SIT_I(sbi)->last_victim[ALLOC_NEXT] = 0; 1249 SIT_I(sbi)->last_victim[FLUSH_DEVICE] = init_segno; 1250 1251 trace_f2fs_gc_end(sbi->sb, ret, total_freed, sec_freed, 1252 get_pages(sbi, F2FS_DIRTY_NODES), --- 27 unchanged lines hidden --- | 1250 ret = f2fs_write_checkpoint(sbi, &cpc); 1251 } 1252stop: 1253 SIT_I(sbi)->last_victim[ALLOC_NEXT] = 0; 1254 SIT_I(sbi)->last_victim[FLUSH_DEVICE] = init_segno; 1255 1256 trace_f2fs_gc_end(sbi->sb, ret, total_freed, sec_freed, 1257 get_pages(sbi, F2FS_DIRTY_NODES), --- 27 unchanged lines hidden --- |