• Chao Yu's avatar
    f2fs: fix to account gc stats correctly · 9bf1dcbd
    Chao Yu authored
    As reported, status debugfs entry shows inconsistent GC stats as below:
    
    GC calls: 6008 (BG: 6161)
      - data segments : 3053 (BG: 3053)
      - node segments : 2955 (BG: 2955)
    
    Total GC calls is larger than BGGC calls, the reason is:
    - f2fs_stat_info.call_count accounts total migrated section count
    by f2fs_gc()
    - f2fs_stat_info.bg_gc accounts total call times of f2fs_gc() from
    background gc_thread
    
    Another issue is gc_foreground_calls sysfs entry shows total GC call
    count rather than FGGC call count.
    
    This patch changes as below for fix:
    - account GC calls and migrated segment count separately
    - support to account migrated section count if it enables large section
    mode
    - fix to show correct value in gc_foreground_calls sysfs entry
    
    Fixes: fc7100ea ("f2fs: Add f2fs stats to sysfs")
    Signed-off-by: default avatarChao Yu <chao@kernel.org>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    9bf1dcbd
super.c 131 KB