• Chao Yu's avatar
    f2fs: record average update time of segment · 6f3a01ae
    Chao Yu authored
    
    
    Previously, once we update one block in segment, we will update mtime of
    segment to last time, making aged segment becoming freshest, result in
    that GC with cost benefit algorithm missing such segment, So this patch
    changes to record mtime as average block updating time instead of last
    updating time.
    
    It's not needed to reset mtime for prefree segment, as se->valid_blocks
    is zero, then old se->mtime won't take any weight with below calculation:
    
    	se->mtime = div_u64(se->mtime * se->valid_blocks + mtime,
    					se->valid_blocks + 1);
    Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    6f3a01ae
segment.c 131 KB