f2fs学习笔记 -11. f2fs gc

1.前言

GC分为前台GC和后台GC

2.总体流程

f2fs_fill_super
	start_gc_thread(sbi)
		init_waitqueue_head(&sbi->gc_thread->gc_wait_queue_head)
		kthread_run(gc_thread_func)

3.gc_thread_func

gc_thread_func
	f2fs_balance_fs(sbi)
		sync_dirty_dir_inodes
		sync_node_pages
	f2fs_gc
		__get_victim
		do_garbage_collect
  1. f2fs_balance_fs
    如果need_to_flush为true,将执行sync_dirty_dir_inodes来写入dirty directory inode
    sync_node_pages来写入dirty node page

  2. f2fs_gc
    如果has_not_enough_free_secs为false则执行f2fs_gc操作, 它实际会执行__get_victim,实际回调为get_victim_by_default,最终通过get_victim_by_default选择出合适的section, 通过对section中的每个segment执行do_garbage_collect进行GC回收。do_garbage_collect分为两种回收,gc_node_segment和gc_data_segment。

参考文档

1.https://blog.csdn.net/u011649400/article/details/100530006
F2FS源码分析-4.1 [F2FS GC部分] 垃圾回收机制源码分析
2.https://github.com/RiweiPan/F2FS-NOTES/blob/master/ImportantDataStructure/f2fs_summary.md
f2fs_summary 和 f2fs_summary_block

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值